Merge pull request #10667 from osmandapp/points_fixes
Points fixes first part
This commit is contained in:
commit
fec4ae002b
19 changed files with 184 additions and 174 deletions
|
@ -153,12 +153,12 @@ public class GpxSelectionHelper {
|
||||||
return followTrackListener;
|
return followTrackListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class GpxFileLoaderTask extends AsyncTask<Void, Void, GPXFile> {
|
public static class GpxFileLoaderTask extends AsyncTask<Void, Void, GPXFile> {
|
||||||
|
|
||||||
private File fileToLoad;
|
private File fileToLoad;
|
||||||
private CallbackWithObject<GPXFile> callback;
|
private CallbackWithObject<GPXFile> callback;
|
||||||
|
|
||||||
GpxFileLoaderTask(File fileToLoad, CallbackWithObject<GPXFile> callback) {
|
public GpxFileLoaderTask(File fileToLoad, CallbackWithObject<GPXFile> callback) {
|
||||||
this.fileToLoad = fileToLoad;
|
this.fileToLoad = fileToLoad;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1628,8 +1628,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
launchMapActivityMoveToTop(activity, null);
|
launchMapActivityMoveToTop(activity, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launchMapActivityMoveToTop(Context activity, Bundle intentParams) {
|
public static void launchMapActivityMoveToTop(Context activity, Bundle prevIntentParams) {
|
||||||
launchMapActivityMoveToTop(activity, intentParams, null, null);
|
launchMapActivityMoveToTop(activity, prevIntentParams, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearPrevActivityIntent() {
|
public static void clearPrevActivityIntent() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -37,6 +38,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
||||||
|
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
|
||||||
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
||||||
|
|
||||||
public class IntentHelper {
|
public class IntentHelper {
|
||||||
|
@ -250,6 +253,12 @@ public class IntentHelper {
|
||||||
}
|
}
|
||||||
mapActivity.setIntent(null);
|
mapActivity.setIntent(null);
|
||||||
}
|
}
|
||||||
|
if (intent.hasExtra(TrackMenuFragment.OPEN_TRACK_MENU)) {
|
||||||
|
String path = intent.getStringExtra(TRACK_FILE_NAME);
|
||||||
|
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
|
||||||
|
TrackMenuFragment.showInstance(mapActivity, path, currentRecording);
|
||||||
|
mapActivity.setIntent(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.ActivityResultListener;
|
import net.osmand.plus.activities.ActivityResultListener;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.dialogs.ImportGpxBottomSheetDialogFragment;
|
import net.osmand.plus.dialogs.ImportGpxBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
||||||
|
@ -37,6 +36,7 @@ import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
||||||
import net.osmand.plus.settings.backend.ExportSettingsType;
|
import net.osmand.plus.settings.backend.ExportSettingsType;
|
||||||
import net.osmand.plus.settings.backend.backup.SettingsHelper;
|
import net.osmand.plus.settings.backend.backup.SettingsHelper;
|
||||||
import net.osmand.plus.settings.backend.backup.SettingsItem;
|
import net.osmand.plus.settings.backend.backup.SettingsItem;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -596,10 +596,7 @@ public class ImportHelper {
|
||||||
|
|
||||||
private void showGpxInDetailsActivity(String gpxFilePath) {
|
private void showGpxInDetailsActivity(String gpxFilePath) {
|
||||||
if (!Algorithms.isEmpty(gpxFilePath)) {
|
if (!Algorithms.isEmpty(gpxFilePath)) {
|
||||||
Intent newIntent = new Intent(activity, app.getAppCustomization().getTrackActivity());
|
TrackMenuFragment.openTrack(activity, new File(gpxFilePath), null);
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxFilePath);
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
activity.startActivity(newIntent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.builders;
|
package net.osmand.plus.mapcontextmenu.builders;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
@ -16,13 +15,12 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.GpxSelectionHelper;
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
|
||||||
import net.osmand.plus.mapcontextmenu.CollapsableView;
|
import net.osmand.plus.mapcontextmenu.CollapsableView;
|
||||||
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.layers.POIMapLayer;
|
import net.osmand.plus.views.layers.POIMapLayer;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -181,12 +179,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
OsmAndAppCustomization appCustomization = app.getAppCustomization();
|
TrackMenuFragment.openTrack(mapActivity, new File(gpxFile.path), null);
|
||||||
final Intent intent = new Intent(context, appCustomization.getTrackActivity());
|
|
||||||
intent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxFile.path);
|
|
||||||
intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.addView(button);
|
view.addView(button);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.controllers;
|
package net.osmand.plus.mapcontextmenu.controllers;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
@ -17,9 +16,7 @@ import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.SelectedGpxMenuBuilder;
|
import net.osmand.plus.mapcontextmenu.builders.SelectedGpxMenuBuilder;
|
||||||
|
@ -45,21 +42,9 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
|
||||||
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
||||||
if (Version.isDeveloperVersion(app)) {
|
mapActivity.getContextMenu().hide(false);
|
||||||
mapActivity.getContextMenu().hide(false);
|
TrackMenuFragment.showInstance(mapActivity, selectedGpxFile.getGpxFile().path, selectedGpxFile.isShowCurrentTrack());
|
||||||
TrackMenuFragment.showInstance(mapActivity, selectedGpxFile.getGpxFile().path, selectedGpxFile.isShowCurrentTrack());
|
|
||||||
} else {
|
|
||||||
Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getTrackActivity());
|
|
||||||
if (selectedGpxFile.isShowCurrentTrack()) {
|
|
||||||
intent.putExtra(TrackActivity.CURRENT_RECORDING, true);
|
|
||||||
} else {
|
|
||||||
intent.putExtra(TrackActivity.TRACK_FILE_NAME, selectedGpxFile.getGpxFile().path);
|
|
||||||
}
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
mapActivity.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Dialog;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -66,7 +65,6 @@ import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -78,6 +76,8 @@ import net.osmand.plus.mapmarkers.CoordinateInputFormats.DDM;
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS;
|
import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS;
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
||||||
import net.osmand.plus.mapmarkers.adapters.CoordinateInputAdapter;
|
import net.osmand.plus.mapmarkers.adapters.CoordinateInputAdapter;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.widgets.EditTextEx;
|
import net.osmand.plus.widgets.EditTextEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.LocationParser;
|
import net.osmand.util.LocationParser;
|
||||||
|
@ -1097,11 +1097,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
.setAction(R.string.shared_string_show, new View.OnClickListener() {
|
.setAction(R.string.shared_string_show, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(app, app.getAppCustomization().getTrackActivity());
|
TrackMenuFragment.openTrack(app, new File(getGpx().path), null);
|
||||||
intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
|
||||||
intent.putExtra(TrackActivity.TRACK_FILE_NAME, getGpx().path);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
UiUtilities.setupSnackbar(snackbar, !lightTheme);
|
UiUtilities.setupSnackbar(snackbar, !lightTheme);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapmarkers;
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -29,19 +28,20 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.LockableViewPager;
|
import net.osmand.plus.LockableViewPager;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.OnPointsSavedListener;
|
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.OnPointsSavedListener;
|
||||||
import net.osmand.plus.mapmarkers.DirectionIndicationDialogFragment.DirectionIndicationFragmentListener;
|
import net.osmand.plus.mapmarkers.DirectionIndicationDialogFragment.DirectionIndicationFragmentListener;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener;
|
||||||
import net.osmand.plus.mapmarkers.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
|
import net.osmand.plus.mapmarkers.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
|
||||||
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener;
|
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener;
|
||||||
import net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener;
|
import net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -486,11 +486,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
|
||||||
.setAction(R.string.shared_string_show, new View.OnClickListener() {
|
.setAction(R.string.shared_string_show, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(mapActivity, getMyApplication().getAppCustomization().getTrackActivity());
|
TrackMenuFragment.openTrack(mapActivity, new File(gpxPath), null);
|
||||||
intent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxPath);
|
|
||||||
intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
UiUtilities.setupSnackbar(snackbar, !lightTheme);
|
UiUtilities.setupSnackbar(snackbar, !lightTheme);
|
||||||
|
|
|
@ -47,7 +47,6 @@ import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityActions;
|
import net.osmand.plus.activities.MapActivityActions;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.base.ContextMenuFragment.MenuState;
|
import net.osmand.plus.base.ContextMenuFragment.MenuState;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -76,6 +75,7 @@ import net.osmand.plus.routepreparationmenu.RouteOptionsBottomSheet.DialogMode;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.layers.MapControlsLayer.MapControlsThemeInfoProvider;
|
import net.osmand.plus.views.layers.MapControlsLayer.MapControlsThemeInfoProvider;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
|
@ -1914,11 +1914,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
GpxData gpxData = editingCtx.getGpxData();
|
GpxData gpxData = editingCtx.getGpxData();
|
||||||
GPXFile gpx = gpxData != null ? gpxData.getGpxFile() : null;
|
GPXFile gpx = gpxData != null ? gpxData.getGpxFile() : null;
|
||||||
if (gpx != null) {
|
if (gpx != null) {
|
||||||
Intent newIntent = new Intent(mapActivity, app.getAppCustomization().getTrackActivity());
|
TrackMenuFragment.openTrack(mapActivity, new File(gpx.path), null);
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpx.path);
|
|
||||||
newIntent.putExtra(TrackActivity.OPEN_TRACKS_LIST, true);
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
startActivity(newIntent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editingCtx.resetRouteSettingsListener();
|
editingCtx.resetRouteSettingsListener();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.measurementtool;
|
package net.osmand.plus.measurementtool;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -10,16 +9,15 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemButton;
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemButton;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -60,11 +58,7 @@ public class SavedTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFr
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null && !Algorithms.isEmpty(fileName)) {
|
if (activity != null && !Algorithms.isEmpty(fileName)) {
|
||||||
OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
TrackMenuFragment.openTrack(activity, new File(fileName), null);
|
||||||
Intent newIntent = new Intent(activity, app.getAppCustomization().getTrackActivity());
|
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, fileName);
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
activity.startActivity(newIntent);
|
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,16 +13,14 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.IndexConstants;
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.plus.GpxSelectionHelper;
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
@ -33,6 +31,9 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
||||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -153,7 +154,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
AvailableGPXFragment.openTrack(getActivity(), null);
|
TrackMenuFragment.openTrack(getActivity(), null, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.findViewById(R.id.divider_dash).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.divider_dash).setVisibility(View.VISIBLE);
|
||||||
|
@ -172,7 +173,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
v.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
AvailableGPXFragment.openTrack(getActivity(), f);
|
TrackMenuFragment.openTrack(getActivity(), f, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ImageButton showOnMap = ((ImageButton) v.findViewById(R.id.show_on_map));
|
ImageButton showOnMap = ((ImageButton) v.findViewById(R.id.show_on_map));
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||||
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -167,7 +168,7 @@ public class SaveGPXBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||||
}
|
}
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (openTrack && activity != null) {
|
if (openTrack && activity != null) {
|
||||||
AvailableGPXFragment.openTrack(activity, file);
|
TrackMenuFragment.openTrack(activity, file, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -27,7 +25,6 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.Filter;
|
import android.widget.Filter;
|
||||||
import android.widget.Filterable;
|
import android.widget.Filterable;
|
||||||
|
@ -75,7 +72,6 @@ import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.base.OsmandExpandableListFragment;
|
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
|
@ -103,14 +99,12 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import static net.osmand.plus.GpxSelectionHelper.CURRENT_TRACK;
|
import static net.osmand.plus.GpxSelectionHelper.CURRENT_TRACK;
|
||||||
import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB;
|
import static net.osmand.plus.myplaces.FavoritesActivity.GPX_TAB;
|
||||||
import static net.osmand.plus.myplaces.FavoritesActivity.OPEN_GPX_REQUEST;
|
|
||||||
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
||||||
|
import static net.osmand.plus.track.TrackMenuFragment.openTrack;
|
||||||
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
|
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
|
||||||
import static net.osmand.util.Algorithms.collectDirs;
|
|
||||||
import static net.osmand.util.Algorithms.formatDuration;
|
import static net.osmand.util.Algorithms.formatDuration;
|
||||||
import static net.osmand.util.Algorithms.objectEquals;
|
import static net.osmand.util.Algorithms.objectEquals;
|
||||||
import static net.osmand.util.Algorithms.removeAllFiles;
|
import static net.osmand.util.Algorithms.removeAllFiles;
|
||||||
|
@ -348,10 +342,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
currentGpxView.findViewById(R.id.current_track_info).setOnClickListener(new View.OnClickListener() {
|
currentGpxView.findViewById(R.id.current_track_info).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
|
FragmentActivity activity = getActivity();
|
||||||
newIntent.putExtra(TrackActivity.CURRENT_RECORDING, true);
|
if (activity != null) {
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
openTrack(activity, null, storeState());
|
||||||
startActivity(newIntent);
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
listView.addHeaderView(currentGpxView);
|
listView.addHeaderView(currentGpxView);
|
||||||
|
@ -419,18 +413,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
updateCurrentTrack();
|
updateCurrentTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openTrack(Activity a, final File f) {
|
|
||||||
Intent newIntent = new Intent(a, ((OsmandApplication) a.getApplication()).getAppCustomization().getTrackActivity());
|
|
||||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
if (f == null) {
|
|
||||||
newIntent.putExtra(TrackActivity.CURRENT_RECORDING, true);
|
|
||||||
} else {
|
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, f.getAbsolutePath());
|
|
||||||
}
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
a.startActivityForResult(newIntent, OPEN_GPX_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reloadTracks() {
|
public void reloadTracks() {
|
||||||
asyncLoader = new LoadGpxTask();
|
asyncLoader = new LoadGpxTask();
|
||||||
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
||||||
|
@ -1615,7 +1597,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
|
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
|
||||||
|
|
||||||
if (!selectionMode) {
|
if (!selectionMode) {
|
||||||
openTrack(getActivity(), item.file);
|
openTrack(getActivity(), item.file, storeState());
|
||||||
} else {
|
} else {
|
||||||
if (!selectedItems.contains(item)) {
|
if (!selectedItems.contains(item)) {
|
||||||
selectedItems.add(item);
|
selectedItems.add(item);
|
||||||
|
|
|
@ -81,11 +81,15 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
|
||||||
}
|
}
|
||||||
items.add(new TitleItem(getCategoryName(app, group.getName())));
|
items.add(new TitleItem(getCategoryName(app, group.getName())));
|
||||||
|
|
||||||
|
boolean trackPoints = group.getType() == GpxDisplayItemType.TRACK_POINTS;
|
||||||
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(group.getGpx().path);
|
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(group.getGpx().path);
|
||||||
if (group.getType() == GpxDisplayItemType.TRACK_POINTS && selectedGpxFile != null) {
|
if (trackPoints && selectedGpxFile != null) {
|
||||||
items.add(createShowOnMapItem(selectedGpxFile));
|
items.add(createShowOnMapItem(selectedGpxFile));
|
||||||
}
|
}
|
||||||
items.add(createEditNameItem());
|
items.add(createEditNameItem());
|
||||||
|
if (trackPoints) {
|
||||||
|
items.add(createChangeColorItem());
|
||||||
|
}
|
||||||
items.add(new OptionsDividerItem(app));
|
items.add(new OptionsDividerItem(app));
|
||||||
|
|
||||||
// items.add(createCopyToMarkersItem());
|
// items.add(createCopyToMarkersItem());
|
||||||
|
@ -272,8 +276,10 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||||
final View changeColorView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
final View changeColorView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
R.layout.change_fav_color, null);
|
R.layout.change_fav_color, null);
|
||||||
((ImageView) changeColorView.findViewById(R.id.change_color_icon))
|
ImageView icon = ((ImageView) changeColorView.findViewById(R.id.change_color_icon));
|
||||||
.setImageDrawable(getContentIcon(R.drawable.ic_action_appearance));
|
icon.setImageDrawable(getContentIcon(R.drawable.ic_action_appearance));
|
||||||
|
int margin = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_icon_margin_large);
|
||||||
|
UiUtilities.setMargins(icon, 0, 0, margin, 0);
|
||||||
updateColorView((ImageView) changeColorView.findViewById(R.id.colorImage));
|
updateColorView((ImageView) changeColorView.findViewById(R.id.colorImage));
|
||||||
return new BaseBottomSheetItem.Builder()
|
return new BaseBottomSheetItem.Builder()
|
||||||
.setCustomView(changeColorView)
|
.setCustomView(changeColorView)
|
||||||
|
|
|
@ -178,10 +178,6 @@ public class OsmAndAppCustomization {
|
||||||
return MapActivity.class;
|
return MapActivity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<TrackActivity> getTrackActivity() {
|
|
||||||
return TrackActivity.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<FavoritesActivity> getFavoritesActivity() {
|
public Class<FavoritesActivity> getFavoritesActivity() {
|
||||||
return FavoritesActivity.class;
|
return FavoritesActivity.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,13 @@ import androidx.recyclerview.widget.RecyclerView.ItemDecoration;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
import net.osmand.plus.myplaces.SegmentActionsListener;
|
import net.osmand.plus.myplaces.SegmentActionsListener;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
|
@ -93,38 +95,43 @@ public class OverviewCard extends BaseCard {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initStatBlocks() {
|
void initStatBlocks() {
|
||||||
GpxDisplayItem gpxItem = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)).get(0);
|
List<GpxDisplayGroup> groups = displayHelper.getOriginalGroups(filterTypes);
|
||||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
if (!Algorithms.isEmpty(groups)) {
|
||||||
boolean joinSegments = displayHelper.isJoinSegments();
|
GpxDisplayItem gpxItem = TrackDisplayHelper.flatten(groups).get(0);
|
||||||
float totalDistance = !joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||||
float timeSpan = !joinSegments && gpxItem.isGeneralTrack() ? analysis.timeSpanWithoutGaps : analysis.timeSpan;
|
boolean joinSegments = displayHelper.isJoinSegments();
|
||||||
String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app);
|
float totalDistance = !joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
||||||
String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app);
|
float timeSpan = !joinSegments && gpxItem.isGeneralTrack() ? analysis.timeSpanWithoutGaps : analysis.timeSpan;
|
||||||
String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app);
|
String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app);
|
||||||
String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app);
|
||||||
|
String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app);
|
||||||
|
String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
||||||
|
|
||||||
StatBlock sDistance = new StatBlock(app.getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app),
|
StatBlock sDistance = new StatBlock(app.getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app),
|
||||||
R.drawable.ic_action_track_16, R.color.icon_color_default_light, GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED);
|
R.drawable.ic_action_track_16, R.color.icon_color_default_light, GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED);
|
||||||
StatBlock sAscent = new StatBlock(app.getString(R.string.altitude_ascent), asc,
|
StatBlock sAscent = new StatBlock(app.getString(R.string.altitude_ascent), asc,
|
||||||
R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, GPXDataSetType.SLOPE, null);
|
R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, GPXDataSetType.SLOPE, null);
|
||||||
StatBlock sDescent = new StatBlock(app.getString(R.string.altitude_descent), desc,
|
StatBlock sDescent = new StatBlock(app.getString(R.string.altitude_descent), desc,
|
||||||
R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE);
|
R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE);
|
||||||
StatBlock sAvSpeed = new StatBlock(app.getString(R.string.average_speed), avg,
|
StatBlock sAvSpeed = new StatBlock(app.getString(R.string.average_speed), avg,
|
||||||
R.drawable.ic_action_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
R.drawable.ic_action_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
||||||
StatBlock sMaxSpeed = new StatBlock(app.getString(R.string.max_speed), max,
|
StatBlock sMaxSpeed = new StatBlock(app.getString(R.string.max_speed), max,
|
||||||
R.drawable.ic_action_max_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
R.drawable.ic_action_max_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
||||||
StatBlock sTimeSpan = new StatBlock(app.getString(R.string.shared_string_time_span),
|
StatBlock sTimeSpan = new StatBlock(app.getString(R.string.shared_string_time_span),
|
||||||
Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()),
|
Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()),
|
||||||
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null);
|
||||||
|
|
||||||
LinearLayoutManager llManager = new LinearLayoutManager(app);
|
LinearLayoutManager llManager = new LinearLayoutManager(app);
|
||||||
llManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
llManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||||
rvOverview.setLayoutManager(llManager);
|
rvOverview.setLayoutManager(llManager);
|
||||||
rvOverview.setItemAnimator(new DefaultItemAnimator());
|
rvOverview.setItemAnimator(new DefaultItemAnimator());
|
||||||
List<StatBlock> items = Arrays.asList(sDistance, sAscent, sDescent, sAvSpeed, sMaxSpeed, sTimeSpan);
|
List<StatBlock> items = Arrays.asList(sDistance, sAscent, sDescent, sAvSpeed, sMaxSpeed, sTimeSpan);
|
||||||
final StatBlockAdapter siAdapter = new StatBlockAdapter(items);
|
final StatBlockAdapter siAdapter = new StatBlockAdapter(items);
|
||||||
rvOverview.setAdapter(siAdapter);
|
rvOverview.setAdapter(siAdapter);
|
||||||
rvOverview.addItemDecoration(new HorizontalDividerDecoration(app));
|
rvOverview.addItemDecoration(new HorizontalDividerDecoration(app));
|
||||||
|
} else {
|
||||||
|
AndroidUiHelper.updateVisibility(rvOverview, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initShowButton(final int iconColorDef, final int iconColorPres) {
|
private void initShowButton(final int iconColorDef, final int iconColorPres) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.osmand.plus.track;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -22,6 +24,7 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
@ -32,6 +35,7 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.FileUtils;
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.FileUtils.RenameCallback;
|
import net.osmand.FileUtils.RenameCallback;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
@ -42,10 +46,10 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.GpxDbHelper;
|
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.GpxFileLoaderTask;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
|
@ -56,6 +60,7 @@ import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityActions;
|
import net.osmand.plus.activities.MapActivityActions;
|
||||||
|
import net.osmand.plus.activities.TrackActivity;
|
||||||
import net.osmand.plus.base.ContextMenuFragment;
|
import net.osmand.plus.base.ContextMenuFragment;
|
||||||
import net.osmand.plus.base.ContextMenuScrollFragment;
|
import net.osmand.plus.base.ContextMenuScrollFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -86,6 +91,7 @@ import net.osmand.util.MapUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
||||||
|
@ -110,6 +116,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
|
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
|
||||||
OsmAndLocationListener, OsmAndCompassListener {
|
OsmAndLocationListener, OsmAndCompassListener {
|
||||||
|
|
||||||
|
public static final String OPEN_TRACK_MENU = "open_track_menu";
|
||||||
|
|
||||||
public static final String TAG = TrackMenuFragment.class.getName();
|
public static final String TAG = TrackMenuFragment.class.getName();
|
||||||
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
|
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
|
||||||
|
|
||||||
|
@ -202,33 +210,39 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
app = requireMyApplication();
|
app = requireMyApplication();
|
||||||
GpxDbHelper gpxDbHelper = app.getGpxDbHelper();
|
|
||||||
displayHelper = new TrackDisplayHelper(app);
|
displayHelper = new TrackDisplayHelper(app);
|
||||||
updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
|
updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
|
||||||
|
|
||||||
Bundle arguments = getArguments();
|
if (!selectedGpxFile.isShowCurrentTrack()) {
|
||||||
if (arguments != null) {
|
File file = new File(selectedGpxFile.getGpxFile().path);
|
||||||
String gpxFilePath = arguments.getString(TRACK_FILE_NAME);
|
displayHelper.setFile(file);
|
||||||
boolean currentRecording = arguments.getBoolean(CURRENT_RECORDING, false);
|
displayHelper.setGpxDataItem(app.getGpxDbHelper().getItem(file));
|
||||||
if (currentRecording) {
|
|
||||||
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
|
||||||
} else {
|
|
||||||
File file = new File(gpxFilePath);
|
|
||||||
displayHelper.setFile(file);
|
|
||||||
displayHelper.setGpxDataItem(gpxDbHelper.getItem(file));
|
|
||||||
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxFilePath);
|
|
||||||
}
|
|
||||||
displayHelper.setGpx(selectedGpxFile.getGpxFile());
|
|
||||||
String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
|
|
||||||
gpxTitle = GpxUiHelper.getGpxTitle(fileName);
|
|
||||||
}
|
}
|
||||||
|
displayHelper.setGpx(selectedGpxFile.getGpxFile());
|
||||||
|
String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
|
||||||
|
gpxTitle = GpxUiHelper.getGpxTitle(fileName);
|
||||||
toolbarHeightPx = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
toolbarHeightPx = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
||||||
|
|
||||||
|
FragmentActivity activity = requireMyActivity();
|
||||||
|
activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
mapActivity.launchPrevActivityIntent();
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPXFile getGpx() {
|
public GPXFile getGpx() {
|
||||||
return displayHelper.getGpx();
|
return displayHelper.getGpx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
|
||||||
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
@ -996,7 +1010,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
@Override
|
@Override
|
||||||
public void gpxSavingFinished(Exception errorMessage) {
|
public void gpxSavingFinished(Exception errorMessage) {
|
||||||
if (selectedGpxFile != null) {
|
if (selectedGpxFile != null) {
|
||||||
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT});
|
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT});
|
||||||
selectedGpxFile.setDisplayGroups(groups, app);
|
selectedGpxFile.setDisplayGroups(groups, app);
|
||||||
selectedGpxFile.processPoints(app);
|
selectedGpxFile.processPoints(app);
|
||||||
}
|
}
|
||||||
|
@ -1029,16 +1043,60 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity, String path, boolean showCurrentTrack) {
|
public static void openTrack(@NonNull Context context, @Nullable File file, Bundle prevIntentParams) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean(OPEN_TRACK_MENU, true);
|
||||||
|
if (file == null) {
|
||||||
|
bundle.putBoolean(TrackActivity.CURRENT_RECORDING, true);
|
||||||
|
} else {
|
||||||
|
bundle.putString(TrackActivity.TRACK_FILE_NAME, file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
MapActivity.launchMapActivityMoveToTop(context, prevIntentParams, null, bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull final MapActivity mapActivity, @Nullable String path, boolean showCurrentTrack) {
|
||||||
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
SelectedGpxFile selectedGpxFile;
|
||||||
|
if (showCurrentTrack) {
|
||||||
|
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||||
|
} else {
|
||||||
|
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(path);
|
||||||
|
}
|
||||||
|
if (selectedGpxFile != null) {
|
||||||
|
showInstance(mapActivity, selectedGpxFile);
|
||||||
|
} else if (!Algorithms.isEmpty(path)) {
|
||||||
|
String title = app.getString(R.string.loading_smth, "");
|
||||||
|
final ProgressDialog progress = ProgressDialog.show(mapActivity, title, app.getString(R.string.loading_data));
|
||||||
|
final WeakReference<MapActivity> mapActivityRef = new WeakReference<>(mapActivity);
|
||||||
|
|
||||||
|
GpxFileLoaderTask gpxFileLoaderTask = new GpxFileLoaderTask(new File(path), new CallbackWithObject<GPXFile>() {
|
||||||
|
@Override
|
||||||
|
public boolean processResult(GPXFile result) {
|
||||||
|
MapActivity mapActivity = mapActivityRef.get();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().selectGpxFile(result, true, false);
|
||||||
|
showInstance(mapActivity, selectedGpxFile);
|
||||||
|
}
|
||||||
|
if (progress != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
||||||
|
progress.dismiss();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gpxFileLoaderTask.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showInstance(@NonNull MapActivity mapActivity, SelectedGpxFile selectedGpxFile) {
|
||||||
try {
|
try {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(TRACK_FILE_NAME, path);
|
|
||||||
args.putBoolean(CURRENT_RECORDING, showCurrentTrack);
|
|
||||||
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
|
||||||
|
|
||||||
TrackMenuFragment fragment = new TrackMenuFragment();
|
TrackMenuFragment fragment = new TrackMenuFragment();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setRetainInstance(true);
|
fragment.setRetainInstance(true);
|
||||||
|
fragment.setSelectedGpxFile(selectedGpxFile);
|
||||||
|
|
||||||
mapActivity.getSupportFragmentManager()
|
mapActivity.getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -14,7 +13,6 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.RtePtEditor;
|
import net.osmand.plus.mapcontextmenu.editors.RtePtEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
||||||
|
@ -22,6 +20,8 @@ import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener;
|
||||||
import net.osmand.plus.track.TrackMenuFragment;
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.plus.views.layers.ContextMenuLayer;
|
import net.osmand.plus.views.layers.ContextMenuLayer;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class AddGpxPointBottomSheetHelper implements OnDismissListener {
|
public class AddGpxPointBottomSheetHelper implements OnDismissListener {
|
||||||
private final View view;
|
private final View view;
|
||||||
private final TextView title;
|
private final TextView title;
|
||||||
|
@ -149,18 +149,10 @@ public class AddGpxPointBottomSheetHelper implements OnDismissListener {
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.show();
|
fragment.show();
|
||||||
} else {
|
} else {
|
||||||
openTrackActivity();
|
TrackMenuFragment.openTrack(mapActivity, new File(newGpxPoint.getGpx().path), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openTrackActivity() {
|
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getTrackActivity());
|
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, newGpxPoint.getGpx().path);
|
|
||||||
newIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
mapActivity.startActivity(newIntent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class NewGpxPoint {
|
public static class NewGpxPoint {
|
||||||
private PointDescription pointDescription;
|
private PointDescription pointDescription;
|
||||||
private GPXFile gpx;
|
private GPXFile gpx;
|
||||||
|
|
|
@ -27,14 +27,12 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentManager.BackStackEntry;
|
import androidx.fragment.app.FragmentManager.BackStackEntry;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities;
|
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -46,6 +44,7 @@ import net.osmand.plus.wikivoyage.data.TravelArticle;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelArticle.TravelArticleIdentifier;
|
import net.osmand.plus.wikivoyage.data.TravelArticle.TravelArticleIdentifier;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelHelper;
|
import net.osmand.plus.wikivoyage.data.TravelHelper;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
|
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
|
||||||
|
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -53,6 +52,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static net.osmand.plus.track.TrackMenuFragment.openTrack;
|
||||||
import static net.osmand.plus.wikipedia.WikiArticleShowImages.OFF;
|
import static net.osmand.plus.wikipedia.WikiArticleShowImages.OFF;
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,12 +150,13 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
||||||
if (article == null || activity == null || fm == null) {
|
if (article == null || activity == null || fm == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (activity instanceof WikivoyageExploreActivity) {
|
||||||
|
WikivoyageExploreActivity exploreActivity = (WikivoyageExploreActivity) activity;
|
||||||
|
exploreActivity.setArticle(article);
|
||||||
|
}
|
||||||
TravelHelper travelHelper = getMyApplication().getTravelHelper();
|
TravelHelper travelHelper = getMyApplication().getTravelHelper();
|
||||||
File path = travelHelper.createGpxFile(article);
|
File file = travelHelper.createGpxFile(article);
|
||||||
Intent newIntent = new Intent(activity, getMyApplication().getAppCustomization().getTrackActivity());
|
openTrack(activity, new File(file.getAbsolutePath()), null);
|
||||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, path.getAbsolutePath());
|
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
startActivity(newIntent);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue