diff --git a/OsmAnd/res/layout-land/track_details.xml b/OsmAnd/res/layout-land/track_details.xml index 81cc4c9437..8129507a94 100644 --- a/OsmAnd/res/layout-land/track_details.xml +++ b/OsmAnd/res/layout-land/track_details.xml @@ -121,7 +121,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/default_desc_text_size" tools:text="@string/altitude"/> @@ -130,7 +130,7 @@ android:id="@+id/y_axis_arrow" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:src="@drawable/ic_action_arrow_drop_down"/> @@ -165,7 +165,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/default_desc_text_size" tools:text="@string/map_widget_speed"/> @@ -174,7 +174,7 @@ android:id="@+id/x_axis_arrow" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:src="@drawable/ic_action_arrow_drop_down"/> diff --git a/OsmAnd/res/layout/track_details.xml b/OsmAnd/res/layout/track_details.xml index 9ad30ce0e1..5498ee81de 100644 --- a/OsmAnd/res/layout/track_details.xml +++ b/OsmAnd/res/layout/track_details.xml @@ -50,7 +50,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/default_desc_text_size" tools:text="@string/altitude"/> @@ -59,7 +59,7 @@ android:id="@+id/y_axis_arrow" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:src="@drawable/ic_action_arrow_drop_down"/> @@ -94,7 +94,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/default_desc_text_size" tools:text="@string/distance"/> @@ -103,7 +103,7 @@ android:id="@+id/x_axis_arrow" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginRight="8dp" android:src="@drawable/ic_action_arrow_drop_down"/> diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index 295dd7c795..9b080e0c8c 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -236,5 +236,8 @@ #c32561c2 #c3b35f00 #c3197d2a + #2561c2 + #b27700 + #197d2a \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index 53b42ae8cc..ecd2837174 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -674,6 +674,7 @@ public class GpxSelectionHelper { public Bitmap image; public boolean expanded; public boolean route; + public boolean wasHidden = true; public WptPt locationOnMap; public GPXDataSetType[] chartTypes; diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index c579d817fe..d55a30f3fc 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -208,10 +208,14 @@ public class GpxUiHelper { if (allGpxList.isEmpty()) { Toast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show(); } - allGpxList.add(0, new GPXInfo(activity.getString(R.string.show_current_gpx_title), 0, 0)); - final ContextMenuAdapter adapter = createGpxContextMenuAdapter(allGpxList, selectedGpxList, true); + boolean showCurrentTrack = false; + if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) { + allGpxList.add(0, new GPXInfo(activity.getString(R.string.show_current_gpx_title), 0, 0)); + showCurrentTrack = true; + } + final ContextMenuAdapter adapter = createGpxContextMenuAdapter(allGpxList, selectedGpxList, showCurrentTrack); - return createDialog(activity, true, true, true, callbackWithObject, allGpxList, adapter); + return createDialog(activity, showCurrentTrack, true, true, callbackWithObject, allGpxList, adapter); } public static AlertDialog selectGPXFile(final Activity activity, @@ -1136,7 +1140,7 @@ public class GpxUiHelper { } else { yAxis = mChart.getAxisLeft(); } - yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue)); + yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue_label)); yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_blue_grid)); yAxis.setGranularity(1f); yAxis.resetAxisMinimum(); @@ -1234,7 +1238,7 @@ public class GpxUiHelper { } else { yAxis = mChart.getAxisLeft(); } - yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange)); + yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_label)); yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid)); yAxis.setAxisMinimum(0f); @@ -1354,7 +1358,7 @@ public class GpxUiHelper { } else { yAxis = mChart.getAxisLeft(); } - yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green)); + yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green_label)); yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_green_grid)); yAxis.setGranularity(1f); yAxis.resetAxisMinimum(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index 08d694bbab..31b6b59484 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -78,7 +78,11 @@ public class TrackDetailsMenu { mapActivity.getMapView().setMapPositionX(1); } else { toolbarController = new TrackDetailsBarController(); - toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details)); + if (gpxItem != null && gpxItem.group != null) { + toolbarController.setTitle(gpxItem.group.getGpxName()); + } else { + toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details)); + } toolbarController.setOnBackButtonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -88,21 +92,9 @@ public class TrackDetailsMenu { toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - MapActivity.clearPrevActivityIntent(); hide(); } }); - /* - if (gpxItem.group.getGpx().showCurrentTrack) { - toolbarController.setRefreshBtnVisible(true); - toolbarController.setOnRefreshButtonClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - update(); - } - }); - } - */ mapActivity.showTopToolbar(toolbarController); } @@ -141,6 +133,9 @@ public class TrackDetailsMenu { public void onDismiss() { VISIBLE = false; + if (gpxItem != null && !gpxItem.route && gpxItem.wasHidden && gpxItem.group != null && gpxItem.group.getGpx() != null) { + mapActivity.getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxItem.group.getGpx(), false, false); + } if (toolbarController != null) { mapActivity.hideTopToolbar(toolbarController); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java index 2d84982757..d838481cdb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenuFragment.java @@ -41,6 +41,15 @@ public class TrackDetailsMenuFragment extends Fragment { mainView = view.findViewById(R.id.main_view); + TextView topBarTitle = (TextView) mainView.findViewById(R.id.top_bar_title); + if (topBarTitle != null) { + if (menu.getGpxItem().group != null) { + topBarTitle.setText(menu.getGpxItem().group.getGpxName()); + } else { + topBarTitle.setText(mapActivity.getString(R.string.rendering_category_details)); + } + } + ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button); ImageButton closeButton = (ImageButton) mainView.findViewById(R.id.top_bar_close_button); if (backButton != null) { @@ -55,7 +64,6 @@ public class TrackDetailsMenuFragment extends Fragment { closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - MapActivity.clearPrevActivityIntent(); dismiss(); } }); @@ -75,7 +83,9 @@ public class TrackDetailsMenuFragment extends Fragment { } else { obs.removeGlobalOnLayoutListener(this); } - updateInfo(); + if (getMapActivity() != null) { + updateInfo(); + } } }); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index 0dfcbaa587..a3e9d21f90 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -1357,6 +1357,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { } if (gpxItem.group.getGpx() != null) { + gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) == null; app.getSelectedGpxHelper().setGpxFileToDisplay(gpxItem.group.getGpx()); } final OsmandSettings settings = app.getSettings();