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); }