My places refactoring in progress

This commit is contained in:
Alexey Kulish 2017-02-16 15:59:20 +03:00
parent c3236535f3
commit 9deaf35b40
4 changed files with 42 additions and 37 deletions

View file

@ -5,7 +5,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background" android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:orientation="vertical"> android:orientation="vertical"
android:gravity="center_vertical">
<View <View
android:id="@+id/divider" android:id="@+id/divider"
@ -16,14 +17,14 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal"
android:gravity="center_vertical">
<CheckBox <CheckBox
android:id="@+id/check_local_index" android:id="@+id/check_local_index"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/local_index_check_right_margin" android:layout_marginLeft="@dimen/local_index_check_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:focusable="false" android:focusable="false"
android:visibility="gone"/> android:visibility="gone"/>
@ -32,7 +33,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding" android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:src="@drawable/ic_gpx_track" android:src="@drawable/ic_gpx_track"
android:visibility="gone"/> android:visibility="gone"/>
@ -40,7 +40,8 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_marginTop="@dimen/gpx_text_top_margin"
android:layout_marginBottom="@dimen/gpx_text_top_margin"
android:layout_marginLeft="@dimen/subHeaderMarginLeft" android:layout_marginLeft="@dimen/subHeaderMarginLeft"
android:layout_marginRight="@dimen/showAllButtonMarginRight" android:layout_marginRight="@dimen/showAllButtonMarginRight"
android:layout_weight="1" android:layout_weight="1"
@ -49,7 +50,6 @@
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_marginTop="@dimen/gpx_text_top_margin"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
@ -63,22 +63,6 @@
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible"> android:visibility="visible">
<ImageView
android:id="@+id/points_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/gpx_small_icon_margin"
android:src="@drawable/ic_small_point"/>
<TextView
android:id="@+id/points_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/gpx_small_text_margin"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
<ImageView <ImageView
android:id="@+id/distance_icon" android:id="@+id/distance_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -95,6 +79,22 @@
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_sub_text_size"/>
<ImageView
android:id="@+id/points_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/gpx_small_icon_margin"
android:src="@drawable/ic_small_point"/>
<TextView
android:id="@+id/points_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/gpx_small_text_margin"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
<ImageView <ImageView
android:id="@+id/time_icon" android:id="@+id/time_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -143,7 +143,6 @@
android:id="@+id/show_on_map" android:id="@+id/show_on_map"
android:layout_width="@dimen/list_item_height" android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/favorites_icon_right_margin" android:layout_marginLeft="@dimen/favorites_icon_right_margin"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_gsave_dark" android:src="@drawable/ic_action_gsave_dark"
@ -154,7 +153,6 @@
android:id="@+id/stop" android:id="@+id/stop"
android:layout_width="@dimen/list_item_height" android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_rec_stop" android:src="@drawable/ic_action_rec_stop"
android:visibility="gone" android:visibility="gone"
@ -170,12 +168,19 @@
android:src="@drawable/ic_overflow_menu_white" android:src="@drawable/ic_overflow_menu_white"
android:visibility="gone"/> android:visibility="gone"/>
<include android:layout_width="wrap_content" <LinearLayout
android:layout_height="wrap_content" android:id="@+id/check_item"
android:layout_gravity="top" android:layout_width="wrap_content"
layout="@layout/check_item_rel"/> android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="@dimen/list_content_padding">
<include android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/check_item_rel"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -25,7 +25,7 @@ public abstract class OsmandBaseExpandableListAdapter extends BaseExpandableList
protected void setCategoryIcon(OsmandApplication app, int resId, int groupPosition, boolean isExpanded, View row, boolean light) { protected void setCategoryIcon(OsmandApplication app, int resId, int groupPosition, boolean isExpanded, View row, boolean light) {
ImageView icon = (ImageView) row.findViewById(R.id.category_icon); ImageView icon = (ImageView) row.findViewById(R.id.category_icon);
if (resId == 0) { if (resId == 0) {
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_folder, light)); icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_folder_stroke, light));
} else { } else {
icon.setImageDrawable(app.getIconsCache().getIcon(resId, light)); icon.setImageDrawable(app.getIconsCache().getIcon(resId, light));
} }

View file

@ -220,7 +220,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app);
String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app);
((TextView) headerView.findViewById(R.id.range_text)) ((TextView) headerView.findViewById(R.id.range_text))
.setText(min + " " + max); .setText(min + " - " + max);
String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app);
String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app);

View file

@ -277,7 +277,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
v.findViewById(R.id.divider).setVisibility(View.GONE); v.findViewById(R.id.divider).setVisibility(View.GONE);
v.findViewById(R.id.options).setVisibility(View.GONE); v.findViewById(R.id.options).setVisibility(View.GONE);
v.findViewById(R.id.stop).setVisibility(View.VISIBLE); v.findViewById(R.id.stop).setVisibility(View.VISIBLE);
v.findViewById(R.id.toggle_item).setVisibility(View.GONE); v.findViewById(R.id.check_item).setVisibility(View.GONE);
} }
@Override @Override
@ -807,10 +807,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
final CompoundButton checkItem = (CompoundButton) v.findViewById(R.id.toggle_item); final CompoundButton checkItem = (CompoundButton) v.findViewById(R.id.toggle_item);
if (isSelectedGroup(groupPosition)) { if (isSelectedGroup(groupPosition)) {
checkItem.setVisibility(View.VISIBLE); v.findViewById(R.id.check_item).setVisibility(View.VISIBLE);
v.findViewById(R.id.options).setVisibility(View.GONE); v.findViewById(R.id.options).setVisibility(View.GONE);
} else { } else {
checkItem.setVisibility(View.GONE); v.findViewById(R.id.check_item).setVisibility(View.GONE);
} }
@ -1290,7 +1290,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
// ImageView icon = (ImageView) v.findViewById(!isDashItem? R.id.icon : R.id.show_on_map); // ImageView icon = (ImageView) v.findViewById(!isDashItem? R.id.icon : R.id.show_on_map);
ImageView icon = (ImageView) v.findViewById(R.id.icon); ImageView icon = (ImageView) v.findViewById(R.id.icon);
icon.setVisibility(View.VISIBLE); icon.setVisibility(View.VISIBLE);
icon.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_gpx_track)); icon.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_polygom_dark));
if (child.isCorrupted()) { if (child.isCorrupted()) {
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC); viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
} else { } else {
@ -1300,7 +1300,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
selectedGpxHelper.getSelectedFileByName(child.getFileName()); selectedGpxHelper.getSelectedFileByName(child.getFileName());
GPXTrackAnalysis analysis = null; GPXTrackAnalysis analysis = null;
if (sgpx != null) { if (sgpx != null) {
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_gpx_track, R.color.color_distance)); icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_polygom_dark, R.color.color_distance));
analysis = sgpx.getTrackAnalysis(); analysis = sgpx.getTrackAnalysis();
} }
@ -1361,6 +1361,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
TextView descr = ((TextView) v.findViewById(R.id.description)); TextView descr = ((TextView) v.findViewById(R.id.description));
descr.setVisibility(View.GONE); descr.setVisibility(View.GONE);
v.findViewById(R.id.toggle_item).setVisibility(View.GONE); v.findViewById(R.id.check_item).setVisibility(View.GONE);
} }
} }