From a4cc3f83c87bd5d56c4ecb4a9c092077249a397c Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 20 Jan 2021 22:19:27 +0200 Subject: [PATCH 1/3] Track tab - GPX Context menu Change UI for statistic block (Distance, Timespan etc). The text should be on the left and icon on the right, the icon is 16dp (currently is used big 24dp icons) Options edit, delete, split interval --- OsmAnd/res/layout/gpx_item_altitude.xml | 446 ++++++++---------- OsmAnd/res/layout/gpx_item_general.xml | 397 +++++++--------- OsmAnd/res/layout/gpx_item_speed.xml | 355 ++++++-------- OsmAnd/res/menu/track_segment_menu.xml | 5 + .../plus/myplaces/GPXItemPagerAdapter.java | 41 +- .../plus/myplaces/SegmentActionsListener.java | 2 +- .../plus/myplaces/TrackSegmentFragment.java | 16 +- .../osmand/plus/track/TrackMenuFragment.java | 16 +- 8 files changed, 563 insertions(+), 715 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index af46a440a4..6563cb8c31 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -1,11 +1,11 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> + android:layout_height="@dimen/list_item_description_width" + android:layout_gravity="center_vertical" /> + osmand:typeface="@string/font_roboto_regular" /> + android:paddingEnd="@dimen/content_padding" + android:paddingRight="@dimen/content_padding" /> @@ -61,242 +61,98 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingTop="13dp" - android:paddingBottom="11dp"> + android:paddingTop="@dimen/context_menu_first_line_top_margin" + android:paddingBottom="@dimen/content_padding_small"> - - + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:layout_weight="1" + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + - - + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:textSize="@dimen/default_desc_text_size" /> - - + tools:text="30m - 53m" /> - - - - - - - - - - - - + android:layout_height="@dimen/poi_icon_size" + android:layout_marginTop="@dimen/subHeaderPadding" + osmand:srcCompat="@drawable/ic_action_altitude_average" /> @@ -305,61 +161,157 @@ + android:layout_marginStart="@dimen/content_padding_small" + android:layout_marginLeft="@dimen/content_padding_small" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:background="?attr/dashboard_divider" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + android:gravity="center" + android:orientation="horizontal"> - - + android:textColor="?attr/color_dialog_buttons" + android:textSize="@dimen/default_list_text_size" + osmand:typeface="@string/font_roboto_regular" /> + + diff --git a/OsmAnd/res/layout/gpx_item_general.xml b/OsmAnd/res/layout/gpx_item_general.xml index d0f23f6a38..b24f63be69 100644 --- a/OsmAnd/res/layout/gpx_item_general.xml +++ b/OsmAnd/res/layout/gpx_item_general.xml @@ -1,11 +1,11 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> + android:layout_height="@dimen/list_item_description_width" + android:layout_gravity="center_vertical" /> + osmand:typeface="@string/font_roboto_regular" /> + android:paddingEnd="@dimen/content_padding" + android:paddingRight="@dimen/content_padding" /> @@ -61,144 +61,112 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingTop="13dp" - android:paddingBottom="11dp"> + android:paddingTop="@dimen/context_menu_first_line_top_margin" + android:paddingBottom="@dimen/content_padding"> - - + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:layout_weight="1" + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + - - + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + + - - - - - - - - - - - - - - - + android:layout_height="1dp" + android:layout_marginStart="@dimen/content_padding_small" + android:layout_marginLeft="@dimen/content_padding_small" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:background="?attr/dashboard_divider" /> - - + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:layout_weight="1" + android:orientation="horizontal"> - - - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + + + - - + android:orientation="horizontal"> - - - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + + + @@ -323,61 +291,46 @@ + android:background="?attr/dashboard_divider" /> - - + android:gravity="center" + android:orientation="horizontal"> - - + android:textColor="?attr/color_dialog_buttons" + android:textSize="@dimen/default_list_text_size" + osmand:typeface="@string/font_roboto_regular" /> + + diff --git a/OsmAnd/res/layout/gpx_item_speed.xml b/OsmAnd/res/layout/gpx_item_speed.xml index 0c98402703..d2cbbff4f2 100644 --- a/OsmAnd/res/layout/gpx_item_speed.xml +++ b/OsmAnd/res/layout/gpx_item_speed.xml @@ -1,11 +1,11 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> + android:layout_gravity="center_vertical" /> + osmand:typeface="@string/font_roboto_regular" /> + android:paddingEnd="@dimen/content_padding" + android:paddingRight="@dimen/content_padding" /> @@ -66,139 +66,106 @@ - - + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:layout_weight="1" + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + - - + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + - - - - - - - - - - - - - - - + android:layout_height="1dp" + android:layout_marginStart="@dimen/content_padding_small" + android:layout_marginLeft="@dimen/content_padding_small" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:background="?attr/dashboard_divider" /> - - + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding_small" + android:layout_weight="1" + android:orientation="horizontal"> - - + android:layout_weight="1" + android:orientation="vertical"> + android:textSize="@dimen/default_desc_text_size" /> + + + + - - + android:orientation="horizontal"> + android:layout_weight="1" + android:orientation="vertical"> + + - - + tools:text="42 km" /> + + @@ -305,61 +273,46 @@ + android:background="?attr/dashboard_divider" /> - - + android:gravity="center" + android:orientation="horizontal"> - - + android:textColor="?attr/color_dialog_buttons" + android:textSize="@dimen/default_list_text_size" + osmand:typeface="@string/font_roboto_regular" /> + + diff --git a/OsmAnd/res/menu/track_segment_menu.xml b/OsmAnd/res/menu/track_segment_menu.xml index 196bb49b2f..2b5b3ba46d 100644 --- a/OsmAnd/res/menu/track_segment_menu.xml +++ b/OsmAnd/res/menu/track_segment_menu.xml @@ -9,4 +9,9 @@ android:id="@+id/action_delete" android:icon="@drawable/ic_action_remove_dark" android:title="@string/shared_string_delete"/> + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java index 81d9ee9d72..185c915cbc 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java @@ -275,17 +275,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_SPEED); } }); - if (gpxFile.showCurrentTrack) { - view.findViewById(R.id.split_interval).setVisibility(View.GONE); - } else { - view.findViewById(R.id.split_interval).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - openSplitIntervalScreen(); - } - }); - } - ImageView overflowMenu = view.findViewById(R.id.overflow_menu); + TextView overflowMenu = view.findViewById(R.id.overflow_menu); if (!gpxItem.group.getTrack().generalTrack) { setupOptionsPopupMenu(overflowMenu, false); } else { @@ -293,13 +283,12 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid } } - private void setupOptionsPopupMenu(ImageView overflowMenu, final boolean confirmDeletion) { - overflowMenu.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_overflow_menu_white)); + private void setupOptionsPopupMenu(TextView overflowMenu, final boolean confirmDeletion) { overflowMenu.setVisibility(View.VISIBLE); overflowMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - actionsListener.showOptionsPopupMenu(view, getTrkSegment(), confirmDeletion); + actionsListener.showOptionsPopupMenu(view, getTrkSegment(), confirmDeletion, gpxItem); } }); } @@ -359,17 +348,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_ALTITUDE); } }); - if (gpxFile.showCurrentTrack) { - view.findViewById(R.id.split_interval).setVisibility(View.GONE); - } else { - view.findViewById(R.id.split_interval).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - openSplitIntervalScreen(); - } - }); - } - ImageView overflowMenu = view.findViewById(R.id.overflow_menu); + TextView overflowMenu = view.findViewById(R.id.overflow_menu); if (!gpxItem.group.getTrack().generalTrack) { setupOptionsPopupMenu(overflowMenu, false); } else { @@ -436,17 +415,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_GENERAL); } }); - if (gpxFile.showCurrentTrack) { - view.findViewById(R.id.split_interval).setVisibility(View.GONE); - } else { - view.findViewById(R.id.split_interval).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - openSplitIntervalScreen(); - } - }); - } - ImageView overflowMenu = view.findViewById(R.id.overflow_menu); + TextView overflowMenu = view.findViewById(R.id.overflow_menu); if (!gpxItem.group.getTrack().generalTrack) { setupOptionsPopupMenu(overflowMenu, true); } else { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java b/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java index 4033dedd7a..e6bea1b9f6 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SegmentActionsListener.java @@ -21,7 +21,7 @@ public interface SegmentActionsListener { void openSplitInterval(GpxDisplayItem gpxItem, TrkSegment trkSegment); - void showOptionsPopupMenu(View view, TrkSegment trkSegment, boolean confirmDeletion); + void showOptionsPopupMenu(View view, TrkSegment trkSegment, boolean confirmDeletion, GpxDisplayItem gpxItem); void openAnalyzeOnMap(GpxDisplayItem gpxItem, List dataSets, GPXTabItemType tabType); } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index c10fa883ad..c60092ea1f 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -66,7 +66,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit private TrackDisplayHelper displayHelper; private TrackActivityFragmentAdapter fragmentAdapter; private SegmentGPXAdapter adapter; - private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; + private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; private IconPopupMenu optionsPopupMenu; private boolean updateEnable; @@ -357,14 +357,20 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit } @Override - public void showOptionsPopupMenu(View view, final TrkSegment segment, final boolean confirmDeletion) { + public void showOptionsPopupMenu(final View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { FragmentActivity activity = getActivity(); if (activity != null) { - optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); - Menu menu = optionsPopupMenu.getMenu(); + IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); + final Menu menu = optionsPopupMenu.getMenu(); optionsPopupMenu.getMenuInflater().inflate(R.menu.track_segment_menu, menu); menu.findItem(R.id.action_edit).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_edit_dark)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)); + boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; + if (isSelectedTrackRecordingNow) { + menu.findItem(R.id.split_interval).setVisible(false); + } else { + menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval)); + } optionsPopupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { @@ -389,6 +395,8 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit builder.show(); } return true; + } else if (i == R.id.split_interval) { + openSplitInterval(gpxItem, segment); } return false; } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 03f8ab374a..c066e0136f 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -462,7 +462,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card segment = segments.get(0); } } - GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; + GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; List items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); if (segment != null && !Algorithms.isEmpty(items)) { SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment); @@ -677,14 +677,20 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } @Override - public void showOptionsPopupMenu(View view, final TrkSegment segment, final boolean confirmDeletion) { + public void showOptionsPopupMenu(final View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { FragmentActivity activity = getActivity(); if (activity != null) { IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); - Menu menu = optionsPopupMenu.getMenu(); + final Menu menu = optionsPopupMenu.getMenu(); optionsPopupMenu.getMenuInflater().inflate(R.menu.track_segment_menu, menu); menu.findItem(R.id.action_edit).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_edit_dark)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)); + boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; + if (isSelectedTrackRecordingNow) { + menu.findItem(R.id.split_interval).setVisible(false); + } else { + menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval)); + } optionsPopupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { @@ -709,6 +715,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card builder.show(); } return true; + } else if (i == R.id.split_interval) { + openSplitInterval(gpxItem, segment); } return false; } @@ -762,7 +770,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public void gpxSavingFinished(Exception errorMessage) { if (selectedGpxFile != null) { - List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}); + List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}); selectedGpxFile.setDisplayGroups(groups, app); selectedGpxFile.processPoints(app); } From 3a2b54bbcc4866b02143a38899e9de76523670a5 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 20 Jan 2021 22:58:21 +0200 Subject: [PATCH 2/3] Hide/show divider fix --- OsmAnd/res/layout/gpx_item_altitude.xml | 8 ++++++++ OsmAnd/res/layout/gpx_item_general.xml | 13 ++++++++++--- OsmAnd/res/layout/gpx_item_speed.xml | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index 6563cb8c31..2deccbca65 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -158,6 +158,12 @@ + + + + - + + + + + android:paddingTop="@dimen/context_menu_first_line_top_margin" + android:paddingBottom="@dimen/content_padding_small"> + + + + + Date: Mon, 25 Jan 2021 09:49:57 +0200 Subject: [PATCH 3/3] Small cleanup in gpx tabs xml --- OsmAnd/res/layout/gpx_item_altitude.xml | 551 ++++++++--------- OsmAnd/res/layout/gpx_item_general.xml | 583 +++++++++--------- OsmAnd/res/layout/gpx_item_speed.xml | 553 ++++++++--------- .../plus/myplaces/TrackSegmentFragment.java | 7 +- .../osmand/plus/track/TrackMenuFragment.java | 10 +- 5 files changed, 840 insertions(+), 864 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index 2deccbca65..9dd2037878 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -1,328 +1,321 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - + \ No newline at end of file diff --git a/OsmAnd/res/layout/gpx_item_general.xml b/OsmAnd/res/layout/gpx_item_general.xml index cbdb7553a9..962bbbe9f5 100644 --- a/OsmAnd/res/layout/gpx_item_general.xml +++ b/OsmAnd/res/layout/gpx_item_general.xml @@ -1,346 +1,339 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - + \ No newline at end of file diff --git a/OsmAnd/res/layout/gpx_item_speed.xml b/OsmAnd/res/layout/gpx_item_speed.xml index 48154d9ee9..d5bc1d3edb 100644 --- a/OsmAnd/res/layout/gpx_item_speed.xml +++ b/OsmAnd/res/layout/gpx_item_speed.xml @@ -1,330 +1,323 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index db5475054c..c95d511526 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -59,7 +59,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit private TrackDisplayHelper displayHelper; private TrackActivityFragmentAdapter fragmentAdapter; private SegmentGPXAdapter adapter; - private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; + private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; private IconPopupMenu optionsPopupMenu; private boolean updateEnable; @@ -304,7 +304,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit } @Override - public void showOptionsPopupMenu(final View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { + public void showOptionsPopupMenu(View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { FragmentActivity activity = getActivity(); if (activity != null) { IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); @@ -312,8 +312,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit optionsPopupMenu.getMenuInflater().inflate(R.menu.track_segment_menu, menu); menu.findItem(R.id.action_edit).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_edit_dark)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)); - boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; - if (isSelectedTrackRecordingNow) { + if (displayHelper.getGpx().showCurrentTrack) { menu.findItem(R.id.split_interval).setVisible(false); } else { menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval)); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 91e6b90bdf..d3504abb4d 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -351,7 +351,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card if (mapActivity != null && trackChartPoints != null) { mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints); } - updateHeader(); startLocationUpdate(); } @@ -570,7 +569,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card segment = segments.get(0); } } - GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; + GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; List items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); if (segment != null && !Algorithms.isEmpty(items)) { SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment); @@ -734,16 +733,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } @Override - public void showOptionsPopupMenu(final View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { + public void showOptionsPopupMenu(View view, final TrkSegment segment, final boolean confirmDeletion, final GpxDisplayItem gpxItem) { FragmentActivity activity = getActivity(); if (activity != null) { IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); - final Menu menu = optionsPopupMenu.getMenu(); + Menu menu = optionsPopupMenu.getMenu(); optionsPopupMenu.getMenuInflater().inflate(R.menu.track_segment_menu, menu); menu.findItem(R.id.action_edit).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_edit_dark)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)); - boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; - if (isSelectedTrackRecordingNow) { + if (getGpx().showCurrentTrack) { menu.findItem(R.id.split_interval).setVisible(false); } else { menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval));