Fix #6484
This commit is contained in:
parent
2611dbf829
commit
d022bec9a2
6 changed files with 261 additions and 161 deletions
|
@ -165,6 +165,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
||||||
private static MapRouteInfoMenu mapRouteInfoMenu = new MapRouteInfoMenu();
|
private static MapRouteInfoMenu mapRouteInfoMenu = new MapRouteInfoMenu();
|
||||||
|
private static TrackDetailsMenu trackDetailsMenu = new TrackDetailsMenu();
|
||||||
private static Intent prevActivityIntent = null;
|
private static Intent prevActivityIntent = null;
|
||||||
|
|
||||||
private List<ActivityResultListener> activityResultListeners = new ArrayList<>();
|
private List<ActivityResultListener> activityResultListeners = new ArrayList<>();
|
||||||
|
@ -228,6 +229,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
mapViewTrackingUtilities = app.getMapViewTrackingUtilities();
|
mapViewTrackingUtilities = app.getMapViewTrackingUtilities();
|
||||||
mapContextMenu.setMapActivity(this);
|
mapContextMenu.setMapActivity(this);
|
||||||
mapRouteInfoMenu.setMapActivity(this);
|
mapRouteInfoMenu.setMapActivity(this);
|
||||||
|
trackDetailsMenu.setMapActivity(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// Full screen is not used here
|
// Full screen is not used here
|
||||||
|
@ -345,8 +347,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (removeFragment(PlanRouteFragment.TAG)) {
|
if (removeFragment(PlanRouteFragment.TAG)) {
|
||||||
app.getMapMarkersHelper().getPlanRouteContext().setFragmentVisible(true);
|
app.getMapMarkersHelper().getPlanRouteContext().setFragmentVisible(true);
|
||||||
}
|
}
|
||||||
if (TrackDetailsMenu.isVisible()) {
|
if (trackDetailsMenu.isVisible()) {
|
||||||
mapLayers.getMapControlsLayer().getTrackDetailsMenu().hide();
|
trackDetailsMenu.dismiss();
|
||||||
}
|
}
|
||||||
removeFragment(ImportGpxBottomSheetDialogFragment.TAG);
|
removeFragment(ImportGpxBottomSheetDialogFragment.TAG);
|
||||||
removeFragment(AdditionalActionsBottomSheetDialogFragment.TAG);
|
removeFragment(AdditionalActionsBottomSheetDialogFragment.TAG);
|
||||||
|
@ -587,8 +589,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TrackDetailsMenu.isVisible()) {
|
if (trackDetailsMenu.isVisible()) {
|
||||||
getMapLayers().getMapControlsLayer().getTrackDetailsMenu().hide();
|
trackDetailsMenu.hide();
|
||||||
if (prevActivityIntent == null) {
|
if (prevActivityIntent == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1094,6 +1096,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
dashboardOnMap.hideDashboard();
|
dashboardOnMap.hideDashboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (trackDetailsMenu.isVisible()) {
|
||||||
|
trackDetailsMenu.show();
|
||||||
|
}
|
||||||
if (searchRequestToShow != null) {
|
if (searchRequestToShow != null) {
|
||||||
showQuickSearch(searchRequestToShow);
|
showQuickSearch(searchRequestToShow);
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1129,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
//mapContextMenu.setMapZoom(settings.getMapZoomToShow());
|
//mapContextMenu.setMapZoom(settings.getMapZoomToShow());
|
||||||
mapContextMenu.setMapZoom(tb.getZoom());
|
mapContextMenu.setMapZoom(tb.getZoom());
|
||||||
if (toShow instanceof GpxDisplayItem) {
|
if (toShow instanceof GpxDisplayItem) {
|
||||||
TrackDetailsMenu trackDetailsMenu = mapLayers.getMapControlsLayer().getTrackDetailsMenu();
|
|
||||||
trackDetailsMenu.setGpxItem((GpxDisplayItem) toShow);
|
trackDetailsMenu.setGpxItem((GpxDisplayItem) toShow);
|
||||||
trackDetailsMenu.show();
|
trackDetailsMenu.show();
|
||||||
} else if (mapRouteInfoMenu.isVisible()) {
|
} else if (mapRouteInfoMenu.isVisible()) {
|
||||||
|
@ -1269,6 +1273,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mapContextMenu.setMapActivity(null);
|
mapContextMenu.setMapActivity(null);
|
||||||
mapRouteInfoMenu.setMapActivity(null);
|
mapRouteInfoMenu.setMapActivity(null);
|
||||||
|
trackDetailsMenu.setMapActivity(null);
|
||||||
unregisterReceiver(screenOffReceiver);
|
unregisterReceiver(screenOffReceiver);
|
||||||
app.getAidlApi().onDestroyMapActivity(this);
|
app.getAidlApi().onDestroyMapActivity(this);
|
||||||
FailSafeFuntions.quitRouteRestoreDialog();
|
FailSafeFuntions.quitRouteRestoreDialog();
|
||||||
|
@ -1596,6 +1601,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
return mapRouteInfoMenu;
|
return mapRouteInfoMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public TrackDetailsMenu getTrackDetailsMenu() {
|
||||||
|
return trackDetailsMenu;
|
||||||
|
}
|
||||||
|
|
||||||
public void openDrawer() {
|
public void openDrawer() {
|
||||||
mapActions.updateDrawerMenu();
|
mapActions.updateDrawerMenu();
|
||||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -21,14 +21,14 @@ import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.QuadRect;
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.QuadRect;
|
||||||
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -43,7 +43,6 @@ import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -51,42 +50,114 @@ import java.util.List;
|
||||||
|
|
||||||
public class TrackDetailsMenu {
|
public class TrackDetailsMenu {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
@Nullable
|
||||||
private GpxDisplayItem gpxItem;
|
private GpxDisplayItem gpxItem;
|
||||||
|
@Nullable
|
||||||
private TrackDetailsBarController toolbarController;
|
private TrackDetailsBarController toolbarController;
|
||||||
|
@Nullable
|
||||||
private TrkSegment segment;
|
private TrkSegment segment;
|
||||||
|
@Nullable
|
||||||
private TrackChartPoints trackChartPoints;
|
private TrackChartPoints trackChartPoints;
|
||||||
|
@Nullable
|
||||||
private List<WptPt> xAxisPoints;
|
private List<WptPt> xAxisPoints;
|
||||||
private int topMarginPx;
|
private int topMarginPx;
|
||||||
|
private boolean visible;
|
||||||
|
private boolean hidding;
|
||||||
|
|
||||||
private static boolean VISIBLE;
|
public TrackDetailsMenu() {
|
||||||
|
|
||||||
public TrackDetailsMenu(@NonNull MapActivity mapActivity) {
|
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
topMarginPx = AndroidUtils.dpToPx(mapActivity, 48f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public MapActivity getMapActivity() {
|
||||||
|
return mapActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapActivity(@Nullable MapActivity mapActivity) {
|
||||||
|
this.mapActivity = mapActivity;
|
||||||
|
if (mapActivity != null) {
|
||||||
|
if (topMarginPx == 0) {
|
||||||
|
topMarginPx = AndroidUtils.dpToPx(mapActivity, 48f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public GpxDisplayItem getGpxItem() {
|
public GpxDisplayItem getGpxItem() {
|
||||||
return gpxItem;
|
return gpxItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGpxItem(GpxDisplayItem gpxItem) {
|
public void setGpxItem(@NonNull GpxDisplayItem gpxItem) {
|
||||||
this.gpxItem = gpxItem;
|
this.gpxItem = gpxItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVisible() {
|
public boolean isVisible() {
|
||||||
return VISIBLE;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
if (!VISIBLE) {
|
MapActivity mapActivity = getMapActivity();
|
||||||
VISIBLE = true;
|
if (mapActivity != null && getGpxItem() != null) {
|
||||||
|
visible = true;
|
||||||
|
TrackDetailsMenuFragment.showInstance(mapActivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismiss() {
|
||||||
|
TrackDetailsMenuFragment fragment = getMenuFragment();
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hide() {
|
||||||
|
TrackDetailsMenuFragment fragment = getMenuFragment();
|
||||||
|
if (fragment != null) {
|
||||||
|
hidding = true;
|
||||||
|
fragment.dismiss();
|
||||||
|
} else {
|
||||||
|
segment = null;
|
||||||
|
trackChartPoints = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
TrackDetailsMenuFragment fragment = getMenuFragment();
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.updateInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TrackDetailsMenuFragment getMenuFragment() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
TrackDetailsMenuFragment fragment = (TrackDetailsMenuFragment) mapActivity.getSupportFragmentManager()
|
||||||
|
.findFragmentByTag(TrackDetailsMenuFragment.TAG);
|
||||||
|
if (fragment != null && !fragment.isDetached()) {
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onShow() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (mapActivity != null && gpxItem != null) {
|
||||||
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
GPXFile groupGpx = gpxItem.group.getGpx();
|
||||||
|
if (groupGpx != null) {
|
||||||
|
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(groupGpx.path) == null;
|
||||||
|
app.getSelectedGpxHelper().setGpxFileToDisplay(groupGpx);
|
||||||
|
}
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
if (!portrait) {
|
if (!portrait) {
|
||||||
mapActivity.getMapView().setMapPositionX(1);
|
mapActivity.getMapView().setMapPositionX(1);
|
||||||
} else {
|
} else {
|
||||||
toolbarController = new TrackDetailsBarController();
|
TrackDetailsBarController toolbarController = new TrackDetailsBarController();
|
||||||
if (gpxItem != null && gpxItem.group != null) {
|
this.toolbarController = toolbarController;
|
||||||
|
if (gpxItem.group != null) {
|
||||||
toolbarController.setTitle(gpxItem.group.getGpxName());
|
toolbarController.setTitle(gpxItem.group.getGpxName());
|
||||||
} else {
|
} else {
|
||||||
toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details));
|
toolbarController.setTitle(mapActivity.getString(R.string.rendering_category_details));
|
||||||
|
@ -94,7 +165,10 @@ public class TrackDetailsMenu {
|
||||||
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
|
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mapActivity.onBackPressed();
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
mapActivity.onBackPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
||||||
|
@ -105,55 +179,34 @@ public class TrackDetailsMenu {
|
||||||
});
|
});
|
||||||
mapActivity.showTopToolbar(toolbarController);
|
mapActivity.showTopToolbar(toolbarController);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
|
|
||||||
TrackDetailsMenuFragment.showInstance(mapActivity);
|
|
||||||
mapActivity.getMapLayers().getContextMenuLayer().enterGpxDetailsMode();
|
mapActivity.getMapLayers().getContextMenuLayer().enterGpxDetailsMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide() {
|
|
||||||
WeakReference<TrackDetailsMenuFragment> fragmentRef = findMenuFragment();
|
|
||||||
if (fragmentRef != null) {
|
|
||||||
fragmentRef.get().dismiss();
|
|
||||||
} else {
|
|
||||||
segment = null;
|
|
||||||
VISIBLE = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update() {
|
|
||||||
WeakReference<TrackDetailsMenuFragment> fragmentRef = findMenuFragment();
|
|
||||||
if (fragmentRef != null) {
|
|
||||||
fragmentRef.get().updateInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WeakReference<TrackDetailsMenuFragment> findMenuFragment() {
|
|
||||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(TrackDetailsMenuFragment.TAG);
|
|
||||||
if (fragment != null && !fragment.isDetached()) {
|
|
||||||
return new WeakReference<>((TrackDetailsMenuFragment) fragment);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDismiss() {
|
public void onDismiss() {
|
||||||
VISIBLE = false;
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
if (gpxItem != null && !gpxItem.route && gpxItem.wasHidden && gpxItem.group != null && gpxItem.group.getGpx() != null) {
|
MapActivity mapActivity = getMapActivity();
|
||||||
mapActivity.getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxItem.group.getGpx(), false, false);
|
if (mapActivity != null) {
|
||||||
|
if (gpxItem != null && !gpxItem.route && gpxItem.wasHidden && gpxItem.group != null && gpxItem.group.getGpx() != null) {
|
||||||
|
mapActivity.getMyApplication().getSelectedGpxHelper().selectGpxFile(gpxItem.group.getGpx(), false, false);
|
||||||
|
}
|
||||||
|
TrackDetailsBarController toolbarController = this.toolbarController;
|
||||||
|
if (toolbarController != null) {
|
||||||
|
mapActivity.hideTopToolbar(toolbarController);
|
||||||
|
}
|
||||||
|
mapActivity.getMapLayers().getContextMenuLayer().exitGpxDetailsMode();
|
||||||
|
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null);
|
||||||
|
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(null);
|
||||||
|
mapActivity.getMapView().setMapPositionX(0);
|
||||||
|
mapActivity.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
if (toolbarController != null) {
|
if (hidding) {
|
||||||
mapActivity.hideTopToolbar(toolbarController);
|
hidding = false;
|
||||||
|
visible = false;
|
||||||
|
segment = null;
|
||||||
|
trackChartPoints = null;
|
||||||
}
|
}
|
||||||
mapActivity.getMapLayers().getContextMenuLayer().exitGpxDetailsMode();
|
|
||||||
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null);
|
|
||||||
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(null);
|
|
||||||
mapActivity.getMapView().setMapPositionX(0);
|
|
||||||
mapActivity.getMapView().refreshMap();
|
|
||||||
segment = null;
|
|
||||||
trackChartPoints = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInfo(final View main) {
|
public void updateInfo(final View main) {
|
||||||
|
@ -161,9 +214,11 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrkSegment getTrackSegment(LineChart chart) {
|
private TrkSegment getTrackSegment(LineChart chart) {
|
||||||
|
TrkSegment segment = this.segment;
|
||||||
if (segment == null) {
|
if (segment == null) {
|
||||||
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
||||||
if (ds != null && ds.size() > 0) {
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (ds != null && ds.size() > 0 && gpxItem != null) {
|
||||||
for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) {
|
for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) {
|
||||||
for (TrkSegment s : t.segments) {
|
for (TrkSegment s : t.segments) {
|
||||||
if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) {
|
if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) {
|
||||||
|
@ -175,6 +230,7 @@ public class TrackDetailsMenu {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.segment = segment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return segment;
|
return segment;
|
||||||
|
@ -183,11 +239,12 @@ public class TrackDetailsMenu {
|
||||||
private WptPt getPoint(LineChart chart, float pos) {
|
private WptPt getPoint(LineChart chart, float pos) {
|
||||||
WptPt wpt = null;
|
WptPt wpt = null;
|
||||||
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
||||||
if (ds != null && ds.size() > 0) {
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (ds != null && ds.size() > 0 && gpxItem != null) {
|
||||||
TrkSegment segment = getTrackSegment(chart);
|
TrkSegment segment = getTrackSegment(chart);
|
||||||
OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0);
|
OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0);
|
||||||
if (gpxItem.chartAxisType == GPXDataSetAxisType.TIME ||
|
if (gpxItem.chartAxisType == GPXDataSetAxisType.TIME ||
|
||||||
gpxItem.chartAxisType == GPXDataSetAxisType.TIMEOFDAY) {
|
gpxItem.chartAxisType == GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
float time = pos * 1000;
|
float time = pos * 1000;
|
||||||
for (WptPt p : segment.points) {
|
for (WptPt p : segment.points) {
|
||||||
if (p.time - gpxItem.analysis.startTime >= time) {
|
if (p.time - gpxItem.analysis.startTime >= time) {
|
||||||
|
@ -220,7 +277,8 @@ public class TrackDetailsMenu {
|
||||||
double left = 0, right = 0;
|
double left = 0, right = 0;
|
||||||
double top = 0, bottom = 0;
|
double top = 0, bottom = 0;
|
||||||
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
List<ILineDataSet> ds = chart.getLineData().getDataSets();
|
||||||
if (ds != null && ds.size() > 0) {
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (ds != null && ds.size() > 0 && gpxItem != null) {
|
||||||
TrkSegment segment = getTrackSegment(chart);
|
TrkSegment segment = getTrackSegment(chart);
|
||||||
OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0);
|
OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0);
|
||||||
if (gpxItem.chartAxisType == GPXDataSetAxisType.TIME || gpxItem.chartAxisType == GPXDataSetAxisType.TIMEOFDAY) {
|
if (gpxItem.chartAxisType == GPXDataSetAxisType.TIME || gpxItem.chartAxisType == GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
|
@ -274,45 +332,55 @@ public class TrackDetailsMenu {
|
||||||
|
|
||||||
private void fitTrackOnMap(LineChart chart, LatLon location, boolean forceFit) {
|
private void fitTrackOnMap(LineChart chart, LatLon location, boolean forceFit) {
|
||||||
QuadRect rect = getRect(chart, chart.getLowestVisibleX(), chart.getHighestVisibleX());
|
QuadRect rect = getRect(chart, chart.getLowestVisibleX(), chart.getHighestVisibleX());
|
||||||
RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
|
MapActivity mapActivity = getMapActivity();
|
||||||
int tileBoxWidthPx = 0;
|
if (mapActivity != null) {
|
||||||
int tileBoxHeightPx = 0;
|
RotatedTileBox tb = mapActivity.getMapView().getCurrentRotatedTileBox().copy();
|
||||||
|
int tileBoxWidthPx = 0;
|
||||||
|
int tileBoxHeightPx = 0;
|
||||||
|
|
||||||
WeakReference<TrackDetailsMenuFragment> fragmentRef = findMenuFragment();
|
TrackDetailsMenuFragment fragment = getMenuFragment();
|
||||||
if (fragmentRef != null) {
|
if (fragment != null) {
|
||||||
TrackDetailsMenuFragment f = fragmentRef.get();
|
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
if (!portrait) {
|
||||||
if (!portrait) {
|
tileBoxWidthPx = tb.getPixWidth() - fragment.getWidth();
|
||||||
tileBoxWidthPx = tb.getPixWidth() - f.getWidth();
|
} else {
|
||||||
} else {
|
tileBoxHeightPx = tb.getPixHeight() - fragment.getHeight();
|
||||||
tileBoxHeightPx = tb.getPixHeight() - f.getHeight();
|
}
|
||||||
}
|
}
|
||||||
}
|
if (tileBoxHeightPx > 0 || tileBoxWidthPx > 0) {
|
||||||
if (tileBoxHeightPx > 0 || tileBoxWidthPx > 0) {
|
if (forceFit) {
|
||||||
if (forceFit) {
|
mapActivity.getMapView().fitRectToMap(rect.left, rect.right, rect.top, rect.bottom,
|
||||||
mapActivity.getMapView().fitRectToMap(rect.left, rect.right, rect.top, rect.bottom,
|
tileBoxWidthPx, tileBoxHeightPx, topMarginPx);
|
||||||
tileBoxWidthPx, tileBoxHeightPx, topMarginPx);
|
} else if (location != null &&
|
||||||
} else if (location != null &&
|
!mapActivity.getMapView().getTileBox(tileBoxWidthPx, tileBoxHeightPx, topMarginPx).containsLatLon(location)) {
|
||||||
!mapActivity.getMapView().getTileBox(tileBoxWidthPx, tileBoxHeightPx, topMarginPx).containsLatLon(location)) {
|
boolean animating = mapActivity.getMapView().getAnimatedDraggingThread().isAnimating();
|
||||||
boolean animating = mapActivity.getMapView().getAnimatedDraggingThread().isAnimating();
|
mapActivity.getMapView().fitLocationToMap(location.getLatitude(), location.getLongitude(),
|
||||||
mapActivity.getMapView().fitLocationToMap(location.getLatitude(), location.getLongitude(),
|
mapActivity.getMapView().getZoom(), tileBoxWidthPx, tileBoxHeightPx, topMarginPx, !animating);
|
||||||
mapActivity.getMapView().getZoom(), tileBoxWidthPx, tileBoxHeightPx, topMarginPx, !animating);
|
} else {
|
||||||
} else {
|
mapActivity.refreshMap();
|
||||||
mapActivity.refreshMap();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshChart(LineChart chart, boolean forceFit) {
|
private void refreshChart(LineChart chart, boolean forceFit) {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (mapActivity == null || gpxItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Highlight[] highlights = chart.getHighlighted();
|
Highlight[] highlights = chart.getHighlighted();
|
||||||
LatLon location = null;
|
LatLon location = null;
|
||||||
|
|
||||||
|
TrackChartPoints trackChartPoints = this.trackChartPoints;
|
||||||
if (trackChartPoints == null) {
|
if (trackChartPoints == null) {
|
||||||
trackChartPoints = new TrackChartPoints();
|
trackChartPoints = new TrackChartPoints();
|
||||||
TrkSegment segment = getTrackSegment(chart);
|
TrkSegment segment = getTrackSegment(chart);
|
||||||
int segmentColor = segment != null ? segment.getColor(0) : 0;
|
int segmentColor = segment != null ? segment.getColor(0) : 0;
|
||||||
trackChartPoints.setSegmentColor(segmentColor);
|
trackChartPoints.setSegmentColor(segmentColor);
|
||||||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
trackChartPoints.setGpx(gpxItem.group.getGpx());
|
||||||
|
this.trackChartPoints = trackChartPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
float minimumVisibleXValue = chart.getLowestVisibleX();
|
float minimumVisibleXValue = chart.getLowestVisibleX();
|
||||||
|
@ -370,6 +438,11 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateView(final View parentView) {
|
private void updateView(final View parentView) {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
|
if (mapActivity == null || gpxItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||||
if (analysis == null || gpxItem.chartTypes == null) {
|
if (analysis == null || gpxItem.chartTypes == null) {
|
||||||
parentView.setVisibility(View.GONE);
|
parentView.setVisibility(View.GONE);
|
||||||
|
@ -408,15 +481,18 @@ public class TrackDetailsMenu {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChartGestureEnd(MotionEvent me, ChartGesture lastPerformedGesture) {
|
public void onChartGestureEnd(MotionEvent me, ChartGesture lastPerformedGesture) {
|
||||||
if ((lastPerformedGesture == ChartGesture.DRAG && hasTranslated) ||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
lastPerformedGesture == ChartGesture.X_ZOOM ||
|
if (gpxItem != null) {
|
||||||
lastPerformedGesture == ChartGesture.Y_ZOOM ||
|
if ((lastPerformedGesture == ChartGesture.DRAG && hasTranslated) ||
|
||||||
lastPerformedGesture == ChartGesture.PINCH_ZOOM ||
|
lastPerformedGesture == ChartGesture.X_ZOOM ||
|
||||||
lastPerformedGesture == ChartGesture.DOUBLE_TAP ||
|
lastPerformedGesture == ChartGesture.Y_ZOOM ||
|
||||||
lastPerformedGesture == ChartGesture.ROTATE) {
|
lastPerformedGesture == ChartGesture.PINCH_ZOOM ||
|
||||||
|
lastPerformedGesture == ChartGesture.DOUBLE_TAP ||
|
||||||
|
lastPerformedGesture == ChartGesture.ROTATE) {
|
||||||
|
|
||||||
gpxItem.chartMatrix = new Matrix(chart.getViewPortHandler().getMatrixTouch());
|
gpxItem.chartMatrix = new Matrix(chart.getViewPortHandler().getMatrixTouch());
|
||||||
refreshChart(chart, true);
|
refreshChart(chart, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,21 +576,21 @@ public class TrackDetailsMenu {
|
||||||
final List<GPXDataSetType[]> availableTypes = new ArrayList<>();
|
final List<GPXDataSetType[]> availableTypes = new ArrayList<>();
|
||||||
boolean hasSlopeChart = false;
|
boolean hasSlopeChart = false;
|
||||||
if (analysis.hasElevationData) {
|
if (analysis.hasElevationData) {
|
||||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE });
|
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE});
|
||||||
if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
||||||
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SLOPE});
|
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SLOPE});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (analysis.hasSpeedData) {
|
if (analysis.hasSpeedData) {
|
||||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.SPEED });
|
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SPEED});
|
||||||
}
|
}
|
||||||
if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME
|
||||||
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
&& gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) {
|
||||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE });
|
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE});
|
||||||
}
|
}
|
||||||
if (analysis.hasElevationData && analysis.hasSpeedData) {
|
if (analysis.hasElevationData && analysis.hasSpeedData) {
|
||||||
availableTypes.add(new GPXDataSetType[] { GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED });
|
availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GPXDataSetType t : gpxItem.chartTypes) {
|
for (GPXDataSetType t : gpxItem.chartTypes) {
|
||||||
|
@ -529,7 +605,7 @@ public class TrackDetailsMenu {
|
||||||
yAxis.setOnClickListener(new View.OnClickListener() {
|
yAxis.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final PopupMenu optionsMenu = new PopupMenu(mapActivity, v);
|
PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||||
for (final GPXDataSetType[] types : availableTypes) {
|
for (final GPXDataSetType[] types : availableTypes) {
|
||||||
MenuItem menuItem = optionsMenu.getMenu()
|
MenuItem menuItem = optionsMenu.getMenu()
|
||||||
|
@ -538,6 +614,7 @@ public class TrackDetailsMenu {
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem mItem) {
|
public boolean onMenuItemClick(MenuItem mItem) {
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
gpxItem.chartTypes = types;
|
gpxItem.chartTypes = types;
|
||||||
update();
|
update();
|
||||||
return true;
|
return true;
|
||||||
|
@ -572,20 +649,24 @@ public class TrackDetailsMenu {
|
||||||
xAxis.setOnClickListener(new View.OnClickListener() {
|
xAxis.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final PopupMenu optionsMenu = new PopupMenu(mapActivity, v);
|
final PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||||
for (final GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
for (final GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
||||||
MenuItem menuItem = optionsMenu.getMenu()
|
MenuItem menuItem = optionsMenu.getMenu()
|
||||||
.add(type.getStringId()).setIcon(type.getImageDrawable(app));
|
.add(type.getStringId()).setIcon(type.getImageDrawable(app));
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem mItem) {
|
public boolean onMenuItemClick(MenuItem mItem) {
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
gpxItem.chartAxisType = type;
|
if (gpxItem != null) {
|
||||||
gpxItem.chartHighlightPos = -1;
|
gpxItem.chartAxisType = type;
|
||||||
gpxItem.chartMatrix = null;
|
gpxItem.chartHighlightPos = -1;
|
||||||
update();
|
gpxItem.chartMatrix = null;
|
||||||
return true;
|
update();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -603,15 +684,18 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateChart(LineChart chart) {
|
private void updateChart(LineChart chart) {
|
||||||
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
chart.notifyDataSetChanged();
|
chart.notifyDataSetChanged();
|
||||||
chart.invalidate();
|
chart.invalidate();
|
||||||
if (gpxItem.chartMatrix != null) {
|
if (gpxItem != null) {
|
||||||
chart.getViewPortHandler().refresh(new Matrix(gpxItem.chartMatrix), chart, true);
|
if (gpxItem.chartMatrix != null) {
|
||||||
}
|
chart.getViewPortHandler().refresh(new Matrix(gpxItem.chartMatrix), chart, true);
|
||||||
if (gpxItem.chartHighlightPos != -1) {
|
}
|
||||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
} else {
|
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||||
chart.highlightValue(null);
|
} else {
|
||||||
|
chart.highlightValue(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.view.ContextThemeWrapper;
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
|
@ -25,16 +26,23 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
private TrackDetailsMenu menu;
|
private TrackDetailsMenu menu;
|
||||||
private View mainView;
|
private View mainView;
|
||||||
|
private boolean paused = true;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity) getActivity();
|
return (MapActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private MapActivity requireMapActivity() {
|
||||||
|
return (MapActivity) requireMyActivity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = requireMapActivity();
|
||||||
menu = mapActivity.getMapLayers().getMapControlsLayer().getTrackDetailsMenu();
|
menu = mapActivity.getTrackDetailsMenu();
|
||||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
ContextThemeWrapper context =
|
ContextThemeWrapper context =
|
||||||
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||||
|
@ -74,7 +82,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
dismiss();
|
menu.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -107,7 +115,16 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (menu == null || menu.getGpxItem() == null) {
|
if (menu == null || menu.getGpxItem() == null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
} else {
|
||||||
|
menu.onShow();
|
||||||
}
|
}
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
paused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -123,6 +140,10 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
return R.color.status_bar_transparent_gradient;
|
return R.color.status_bar_transparent_gradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaused() {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
return mainView.getHeight();
|
return mainView.getHeight();
|
||||||
|
@ -164,26 +185,28 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
public void applyDayNightMode() {
|
public void applyDayNightMode() {
|
||||||
MapActivity ctx = getMapActivity();
|
MapActivity ctx = getMapActivity();
|
||||||
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
if (ctx != null) {
|
||||||
boolean landscapeLayout = !portraitMode;
|
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||||
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean landscapeLayout = !portraitMode;
|
||||||
if (!landscapeLayout) {
|
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
if (!landscapeLayout) {
|
||||||
} else {
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
} else {
|
||||||
}
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||||
|
}
|
||||||
|
|
||||||
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.y_axis_title), nightMode);
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.y_axis_title), nightMode);
|
||||||
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.x_axis_title), nightMode);
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.x_axis_title), nightMode);
|
||||||
|
|
||||||
ImageView yAxisArrow = (ImageView) mainView.findViewById(R.id.y_axis_arrow);
|
ImageView yAxisArrow = (ImageView) mainView.findViewById(R.id.y_axis_arrow);
|
||||||
ImageView xAxisArrow = (ImageView) mainView.findViewById(R.id.x_axis_arrow);
|
ImageView xAxisArrow = (ImageView) mainView.findViewById(R.id.x_axis_arrow);
|
||||||
yAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
yAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||||
xAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
xAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||||
|
|
||||||
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
|
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
|
||||||
if (backButton != null) {
|
if (backButton != null) {
|
||||||
backButton.setImageDrawable(getIcon(R.drawable.ic_arrow_back, R.color.color_white));
|
backButton.setImageDrawable(getIcon(R.drawable.ic_arrow_back, R.color.color_white));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1358,10 +1358,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
gpxItem.chartTypes = list.toArray(new GPXDataSetType[list.size()]);
|
gpxItem.chartTypes = list.toArray(new GPXDataSetType[list.size()]);
|
||||||
}
|
}
|
||||||
if (gpxItem.group.getGpx() != null) {
|
|
||||||
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(gpxInfo.file.getAbsolutePath()) == null;
|
|
||||||
app.getSelectedGpxHelper().setGpxFileToDisplay(gpxItem.group.getGpx());
|
|
||||||
}
|
|
||||||
final OsmandSettings settings = app.getSettings();
|
final OsmandSettings settings = app.getSettings();
|
||||||
settings.setMapLocationToShow(gpxItem.locationStart.lat, gpxItem.locationStart.lon,
|
settings.setMapLocationToShow(gpxItem.locationStart.lat, gpxItem.locationStart.lon,
|
||||||
settings.getLastKnownMapZoom(),
|
settings.getLastKnownMapZoom(),
|
||||||
|
|
|
@ -1168,12 +1168,6 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
gpxItem.locationOnMap = gpxItem.locationStart;
|
gpxItem.locationOnMap = gpxItem.locationStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPXFile gpx = getGpx();
|
|
||||||
GPXFile groupGpx = gpxItem.group.getGpx();
|
|
||||||
if (gpx != null && groupGpx != null) {
|
|
||||||
gpxItem.wasHidden = app.getSelectedGpxHelper().getSelectedFileByPath(gpx.path) == null;
|
|
||||||
app.getSelectedGpxHelper().setGpxFileToDisplay(groupGpx);
|
|
||||||
}
|
|
||||||
final OsmandSettings settings = app.getSettings();
|
final OsmandSettings settings = app.getSettings();
|
||||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||||
settings.getLastKnownMapZoom(),
|
settings.getLastKnownMapZoom(),
|
||||||
|
|
|
@ -46,14 +46,13 @@ import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
|
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
|
||||||
|
import net.osmand.plus.base.ContextMenuFragment.MenuState;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.base.ContextMenuFragment.MenuState;
|
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||||
|
@ -101,7 +100,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
|
||||||
private MapRouteInfoMenu mapRouteInfoMenu;
|
private MapRouteInfoMenu mapRouteInfoMenu;
|
||||||
private TrackDetailsMenu trackDetailsMenu;
|
|
||||||
private MapHudButton backToLocationControl;
|
private MapHudButton backToLocationControl;
|
||||||
private MapHudButton menuControl;
|
private MapHudButton menuControl;
|
||||||
private MapHudButton compassHud;
|
private MapHudButton compassHud;
|
||||||
|
@ -132,10 +130,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackDetailsMenu getTrackDetailsMenu() {
|
|
||||||
return trackDetailsMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean drawInScreenPixels() {
|
public boolean drawInScreenPixels() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -299,7 +293,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private void initRouteControls() {
|
private void initRouteControls() {
|
||||||
mapRouteInfoMenu = mapActivity.getMapRouteInfoMenu();
|
mapRouteInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||||
trackDetailsMenu = new TrackDetailsMenu(mapActivity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setControlsClickable(boolean clickable) {
|
public void setControlsClickable(boolean clickable) {
|
||||||
|
@ -753,7 +746,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanningMode = true;
|
routePlanningMode = true;
|
||||||
}
|
}
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
||||||
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
|
|
Loading…
Reference in a new issue