Small cleanup in gpx tabs xml

This commit is contained in:
Vitaliy 2021-01-25 09:49:57 +02:00
parent 0fd282e4c2
commit 17133f8354
5 changed files with 840 additions and 864 deletions

View file

@ -7,11 +7,6 @@
android:background="?attr/bg_color" android:background="?attr/bg_color"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart <com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart" android:id="@+id/chart"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -323,6 +318,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -7,11 +7,6 @@
android:background="?attr/bg_color" android:background="?attr/bg_color"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart <com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart" android:id="@+id/chart"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -341,6 +336,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -7,11 +7,6 @@
android:background="?attr/bg_color" android:background="?attr/bg_color"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart <com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart" android:id="@+id/chart"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -325,6 +320,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -59,7 +59,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
private TrackDisplayHelper displayHelper; private TrackDisplayHelper displayHelper;
private TrackActivityFragmentAdapter fragmentAdapter; private TrackActivityFragmentAdapter fragmentAdapter;
private SegmentGPXAdapter adapter; 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 IconPopupMenu optionsPopupMenu;
private boolean updateEnable; private boolean updateEnable;
@ -304,7 +304,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
} }
@Override @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(); FragmentActivity activity = getActivity();
if (activity != null) { if (activity != null) {
IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); 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); 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_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)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; if (displayHelper.getGpx().showCurrentTrack) {
if (isSelectedTrackRecordingNow) {
menu.findItem(R.id.split_interval).setVisible(false); menu.findItem(R.id.split_interval).setVisible(false);
} else { } else {
menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval)); menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval));

View file

@ -351,7 +351,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
if (mapActivity != null && trackChartPoints != null) { if (mapActivity != null && trackChartPoints != null) {
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints); mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints);
} }
updateHeader();
startLocationUpdate(); startLocationUpdate();
} }
@ -570,7 +569,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
segment = segments.get(0); segment = segments.get(0);
} }
} }
GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT};
List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); List<GpxDisplayItem> items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes));
if (segment != null && !Algorithms.isEmpty(items)) { if (segment != null && !Algorithms.isEmpty(items)) {
SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment); SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment);
@ -734,16 +733,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} }
@Override @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(); FragmentActivity activity = getActivity();
if (activity != null) { if (activity != null) {
IconPopupMenu optionsPopupMenu = new IconPopupMenu(activity, view.findViewById(R.id.overflow_menu)); 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); 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_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)); menu.findItem(R.id.action_delete).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
boolean isSelectedTrackRecordingNow = displayHelper.getGpx().showCurrentTrack; if (getGpx().showCurrentTrack) {
if (isSelectedTrackRecordingNow) {
menu.findItem(R.id.split_interval).setVisible(false); menu.findItem(R.id.split_interval).setVisible(false);
} else { } else {
menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval)); menu.findItem(R.id.split_interval).setIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_split_interval));