Fix appearance screen with disabled track
This commit is contained in:
parent
c4707e415b
commit
9c9b4ea6de
6 changed files with 62 additions and 80 deletions
|
@ -67,8 +67,7 @@ import net.osmand.plus.AppInitializer;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.AppInitializer.InitEvents;
|
import net.osmand.plus.AppInitializer.InitEvents;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
|
||||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndLocationSimulation;
|
import net.osmand.plus.OsmAndLocationSimulation;
|
||||||
|
@ -80,7 +79,6 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.base.ContextMenuFragment;
|
|
||||||
import net.osmand.plus.base.FailSafeFuntions;
|
import net.osmand.plus.base.FailSafeFuntions;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.chooseplan.OsmLiveGoneDialog;
|
import net.osmand.plus.chooseplan.OsmLiveGoneDialog;
|
||||||
|
@ -108,10 +106,11 @@ import net.osmand.plus.helpers.ScrollHelper.OnScrollEventListener;
|
||||||
import net.osmand.plus.importfiles.ImportHelper;
|
import net.osmand.plus.importfiles.ImportHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
|
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
|
||||||
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
|
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
|
||||||
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
import net.osmand.plus.mapmarkers.PlanRouteFragment;
|
import net.osmand.plus.mapmarkers.PlanRouteFragment;
|
||||||
import net.osmand.plus.measurementtool.GpxApproximationFragment;
|
import net.osmand.plus.measurementtool.GpxApproximationFragment;
|
||||||
import net.osmand.plus.measurementtool.GpxData;
|
import net.osmand.plus.measurementtool.GpxData;
|
||||||
|
@ -125,8 +124,8 @@ import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenuFragment;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenuFragment;
|
||||||
import net.osmand.plus.routing.IRouteInformationListener;
|
import net.osmand.plus.routing.IRouteInformationListener;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
|
||||||
import net.osmand.plus.routing.RouteCalculationProgressCallback;
|
import net.osmand.plus.routing.RouteCalculationProgressCallback;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.TransportRoutingHelper.TransportRouteCalculationProgressCallback;
|
import net.osmand.plus.routing.TransportRoutingHelper.TransportRouteCalculationProgressCallback;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment;
|
import net.osmand.plus.search.QuickSearchDialogFragment;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
||||||
|
@ -169,8 +168,6 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||||
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
|
||||||
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
|
|
||||||
|
|
||||||
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
public class MapActivity extends OsmandActionBarActivity implements DownloadEvents,
|
||||||
OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener,
|
OnRequestPermissionsResultCallback, IRouteInformationListener, AMapPointUpdateListener,
|
||||||
|
@ -1177,15 +1174,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
|
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
|
||||||
} else if (toShow instanceof GPXFile) {
|
} else if (toShow instanceof GPXFile) {
|
||||||
hideContextAndRouteInfoMenues();
|
hideContextAndRouteInfoMenues();
|
||||||
|
GPXFile gpxFile = (GPXFile) toShow;
|
||||||
|
SelectedGpxFile selectedGpxFile;
|
||||||
|
if (gpxFile.showCurrentTrack) {
|
||||||
|
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
||||||
|
} else {
|
||||||
|
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
|
||||||
|
}
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
TrackAppearanceFragment.showInstance(this, selectedGpxFile);
|
||||||
args.putString(TRACK_FILE_NAME, ((GPXFile) toShow).path);
|
|
||||||
args.putBoolean(CURRENT_RECORDING, ((GPXFile) toShow).showCurrentTrack);
|
|
||||||
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuController.MenuState.HALF_SCREEN);
|
|
||||||
|
|
||||||
TrackAppearanceFragment fragment = new TrackAppearanceFragment();
|
|
||||||
fragment.setArguments(args);
|
|
||||||
TrackAppearanceFragment.showInstance(this, fragment);
|
|
||||||
} else if (toShow instanceof QuadRect) {
|
} else if (toShow instanceof QuadRect) {
|
||||||
QuadRect qr = (QuadRect) toShow;
|
QuadRect qr = (QuadRect) toShow;
|
||||||
mapView.fitRectToMap(qr.left, qr.right, qr.top, qr.bottom, (int) qr.width(), (int) qr.height(), 0);
|
mapView.fitRectToMap(qr.left, qr.right, qr.top, qr.bottom, (int) qr.width(), (int) qr.height(), 0);
|
||||||
|
|
|
@ -99,6 +99,7 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
|
||||||
import net.osmand.plus.helpers.enums.MetricsConstants;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.helpers.enums.SpeedConstants;
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
import net.osmand.plus.myplaces.SaveCurrentTrackTask;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -2192,6 +2193,23 @@ public class GpxUiHelper {
|
||||||
new SaveGpxAsyncTask(file, gpxFile, listener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new SaveGpxAsyncTask(file, gpxFile, listener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveAndShareCurrentGpx(@NonNull final OsmandApplication app, @NonNull final GPXFile gpxFile) {
|
||||||
|
SaveGpxListener saveGpxListener = new SaveGpxListener() {
|
||||||
|
@Override
|
||||||
|
public void gpxSavingStarted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gpxSavingFinished(Exception errorMessage) {
|
||||||
|
if (errorMessage == null) {
|
||||||
|
GpxUiHelper.shareGpx(app, new File(gpxFile.path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new SaveCurrentTrackTask(app, gpxFile, saveGpxListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
|
||||||
public static void saveAndShareGpxWithAppearance(@NonNull final Context context, @NonNull final GPXFile gpxFile) {
|
public static void saveAndShareGpxWithAppearance(@NonNull final Context context, @NonNull final GPXFile gpxFile) {
|
||||||
OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||||
GpxDataItem dataItem = getDataItem(app, gpxFile);
|
GpxDataItem dataItem = getDataItem(app, gpxFile);
|
||||||
|
|
|
@ -23,9 +23,7 @@ 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;
|
||||||
import net.osmand.plus.myplaces.SaveCurrentTrackTask;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener;
|
|
||||||
import net.osmand.plus.track.TrackMenuFragment;
|
import net.osmand.plus.track.TrackMenuFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -217,7 +215,7 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
if (gpxFile != null) {
|
if (gpxFile != null) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
if (Algorithms.isEmpty(gpxFile.path)) {
|
if (Algorithms.isEmpty(gpxFile.path)) {
|
||||||
saveAndShareCurrentGpx(app, gpxFile);
|
GpxUiHelper.saveAndShareCurrentGpx(app, gpxFile);
|
||||||
} else {
|
} else {
|
||||||
GpxUiHelper.saveAndShareGpxWithAppearance(app, gpxFile);
|
GpxUiHelper.saveAndShareGpxWithAppearance(app, gpxFile);
|
||||||
}
|
}
|
||||||
|
@ -227,23 +225,6 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAndShareCurrentGpx(@NonNull final OsmandApplication app, @NonNull final GPXFile gpxFile) {
|
|
||||||
SaveGpxListener saveGpxListener = new SaveGpxListener() {
|
|
||||||
@Override
|
|
||||||
public void gpxSavingStarted() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void gpxSavingFinished(Exception errorMessage) {
|
|
||||||
if (errorMessage == null) {
|
|
||||||
GpxUiHelper.shareGpx(app, new File(gpxFile.path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new SaveCurrentTrackTask(app, gpxFile, saveGpxListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SelectedGpxPoint {
|
public static class SelectedGpxPoint {
|
||||||
|
|
||||||
private final WptPt selectedPoint;
|
private final WptPt selectedPoint;
|
||||||
|
|
|
@ -67,10 +67,12 @@ public class OptionsCard extends BaseCard {
|
||||||
itemsContainer.removeAllViews();
|
itemsContainer.removeAllViews();
|
||||||
items.clear();
|
items.clear();
|
||||||
|
|
||||||
|
boolean fileAvailable = gpxFile.path != null && !gpxFile.showCurrentTrack;
|
||||||
items.add(createShowOnMapItem());
|
items.add(createShowOnMapItem());
|
||||||
items.add(createAppearanceItem());
|
items.add(createAppearanceItem());
|
||||||
|
if (fileAvailable) {
|
||||||
items.add(createDirectionsItem());
|
items.add(createDirectionsItem());
|
||||||
|
}
|
||||||
items.add(createDividerItem());
|
items.add(createDividerItem());
|
||||||
items.add(createJoinGapsItem());
|
items.add(createJoinGapsItem());
|
||||||
items.add(createAnalyzeOnMapItem());
|
items.add(createAnalyzeOnMapItem());
|
||||||
|
@ -78,18 +80,15 @@ public class OptionsCard extends BaseCard {
|
||||||
|
|
||||||
items.add(createDividerItem());
|
items.add(createDividerItem());
|
||||||
items.add(createShareItem());
|
items.add(createShareItem());
|
||||||
items.add(createUploadOsmItem());
|
|
||||||
|
|
||||||
|
if (fileAvailable) {
|
||||||
|
items.add(createUploadOsmItem());
|
||||||
items.add(createDividerItem());
|
items.add(createDividerItem());
|
||||||
items.add(createEditItem());
|
items.add(createEditItem());
|
||||||
items.add(createRenameItem());
|
items.add(createRenameItem());
|
||||||
items.add(createChangeFolderItem());
|
items.add(createChangeFolderItem());
|
||||||
|
|
||||||
items.add(createDividerItem());
|
items.add(createDividerItem());
|
||||||
items.add(createDeleteItem());
|
items.add(createDeleteItem());
|
||||||
|
|
||||||
if (gpxFile.path != null && !gpxFile.showCurrentTrack) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
items.add(new DividerSpaceItem(mapActivity, AndroidUtils.dpToPx(app, 6)));
|
items.add(new DividerSpaceItem(mapActivity, AndroidUtils.dpToPx(app, 6)));
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
|
|
||||||
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
|
|
||||||
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
|
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR;
|
||||||
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD;
|
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD;
|
||||||
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM;
|
import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM;
|
||||||
|
@ -121,6 +119,10 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
return trackDrawInfo;
|
return trackDrawInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) {
|
||||||
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSupportedMenuStatesPortrait() {
|
public int getSupportedMenuStatesPortrait() {
|
||||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||||
|
@ -132,40 +134,25 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
app = requireMyApplication();
|
app = requireMyApplication();
|
||||||
gpxDbHelper = app.getGpxDbHelper();
|
gpxDbHelper = app.getGpxDbHelper();
|
||||||
|
|
||||||
Bundle arguments = getArguments();
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
trackDrawInfo = new TrackDrawInfo(savedInstanceState);
|
trackDrawInfo = new TrackDrawInfo(savedInstanceState);
|
||||||
if (trackDrawInfo.isCurrentRecording()) {
|
|
||||||
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
|
||||||
} else {
|
|
||||||
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(trackDrawInfo.getFilePath());
|
|
||||||
}
|
|
||||||
if (!selectedGpxFile.isShowCurrentTrack()) {
|
if (!selectedGpxFile.isShowCurrentTrack()) {
|
||||||
gpxDataItem = gpxDbHelper.getItem(new File(trackDrawInfo.getFilePath()));
|
gpxDataItem = gpxDbHelper.getItem(new File(trackDrawInfo.getFilePath()));
|
||||||
}
|
}
|
||||||
showStartFinishIconsInitialValue = savedInstanceState.getBoolean(SHOW_START_FINISH_ICONS_INITIAL_VALUE_KEY,
|
showStartFinishIconsInitialValue = savedInstanceState.getBoolean(SHOW_START_FINISH_ICONS_INITIAL_VALUE_KEY,
|
||||||
app.getSettings().SHOW_START_FINISH_ICONS.get());
|
app.getSettings().SHOW_START_FINISH_ICONS.get());
|
||||||
} else if (arguments != null) {
|
} else {
|
||||||
String gpxFilePath = arguments.getString(TRACK_FILE_NAME);
|
|
||||||
boolean currentRecording = arguments.getBoolean(CURRENT_RECORDING, false);
|
|
||||||
showStartFinishIconsInitialValue = app.getSettings().SHOW_START_FINISH_ICONS.get();
|
showStartFinishIconsInitialValue = app.getSettings().SHOW_START_FINISH_ICONS.get();
|
||||||
|
|
||||||
if (gpxFilePath == null && !currentRecording) {
|
if (selectedGpxFile.isShowCurrentTrack()) {
|
||||||
log.error("Required extra '" + TRACK_FILE_NAME + "' is missing");
|
|
||||||
dismiss();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (currentRecording) {
|
|
||||||
trackDrawInfo = new TrackDrawInfo(true);
|
trackDrawInfo = new TrackDrawInfo(true);
|
||||||
trackDrawInfo.setColor(app.getSettings().CURRENT_TRACK_COLOR.get());
|
trackDrawInfo.setColor(app.getSettings().CURRENT_TRACK_COLOR.get());
|
||||||
trackDrawInfo.setWidth(app.getSettings().CURRENT_TRACK_WIDTH.get());
|
trackDrawInfo.setWidth(app.getSettings().CURRENT_TRACK_WIDTH.get());
|
||||||
trackDrawInfo.setShowArrows(app.getSettings().CURRENT_TRACK_SHOW_ARROWS.get());
|
trackDrawInfo.setShowArrows(app.getSettings().CURRENT_TRACK_SHOW_ARROWS.get());
|
||||||
trackDrawInfo.setShowStartFinish(app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.get());
|
trackDrawInfo.setShowStartFinish(app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.get());
|
||||||
selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack();
|
|
||||||
} else {
|
} else {
|
||||||
gpxDataItem = gpxDbHelper.getItem(new File(gpxFilePath));
|
gpxDataItem = gpxDbHelper.getItem(new File(selectedGpxFile.getGpxFile().path));
|
||||||
trackDrawInfo = new TrackDrawInfo(app, gpxDataItem, false);
|
trackDrawInfo = new TrackDrawInfo(app, gpxDataItem, false);
|
||||||
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxFilePath);
|
|
||||||
}
|
}
|
||||||
updateTrackColor();
|
updateTrackColor();
|
||||||
}
|
}
|
||||||
|
@ -726,8 +713,12 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
return totalScreenHeight - frameTotalHeight;
|
return totalScreenHeight - frameTotalHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity, TrackAppearanceFragment fragment) {
|
public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile) {
|
||||||
try {
|
try {
|
||||||
|
TrackAppearanceFragment fragment = new TrackAppearanceFragment();
|
||||||
|
fragment.setSelectedGpxFile(selectedGpxFile);
|
||||||
|
fragment.setRetainInstance(true);
|
||||||
|
|
||||||
mapActivity.getSupportFragmentManager()
|
mapActivity.getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.fragmentContainer, fragment, fragment.getFragmentTag())
|
.replace(R.id.fragmentContainer, fragment, fragment.getFragmentTag())
|
||||||
|
|
|
@ -420,16 +420,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, gpxFileSelected, false);
|
app.getSelectedGpxHelper().selectGpxFile(gpxFile, gpxFileSelected, false);
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
} else if (buttonIndex == APPEARANCE_BUTTON_INDEX) {
|
} else if (buttonIndex == APPEARANCE_BUTTON_INDEX) {
|
||||||
app.getSelectedGpxHelper().selectGpxFile(gpxFile, true, false);
|
TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile);
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(TRACK_FILE_NAME, gpxFile.path);
|
|
||||||
args.putBoolean(CURRENT_RECORDING, gpxFile.showCurrentTrack);
|
|
||||||
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HALF_SCREEN);
|
|
||||||
|
|
||||||
TrackAppearanceFragment fragment = new TrackAppearanceFragment();
|
|
||||||
fragment.setArguments(args);
|
|
||||||
TrackAppearanceFragment.showInstance(mapActivity, fragment);
|
|
||||||
} else if (buttonIndex == DIRECTIONS_BUTTON_INDEX) {
|
} else if (buttonIndex == DIRECTIONS_BUTTON_INDEX) {
|
||||||
MapActivityActions mapActions = mapActivity.getMapActions();
|
MapActivityActions mapActions = mapActivity.getMapActions();
|
||||||
if (app.getRoutingHelper().isFollowingMode()) {
|
if (app.getRoutingHelper().isFollowingMode()) {
|
||||||
|
@ -469,7 +460,12 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment);
|
SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment);
|
||||||
}
|
}
|
||||||
} else if (buttonIndex == SHARE_BUTTON_INDEX) {
|
} else if (buttonIndex == SHARE_BUTTON_INDEX) {
|
||||||
GpxUiHelper.shareGpx(mapActivity, new File(gpxFile.path));
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
if (gpxFile.showCurrentTrack) {
|
||||||
|
GpxUiHelper.saveAndShareCurrentGpx(app, gpxFile);
|
||||||
|
} else if (!Algorithms.isEmpty(gpxFile.path)) {
|
||||||
|
GpxUiHelper.saveAndShareGpxWithAppearance(app, gpxFile);
|
||||||
|
}
|
||||||
} else if (buttonIndex == UPLOAD_OSM_BUTTON_INDEX) {
|
} else if (buttonIndex == UPLOAD_OSM_BUTTON_INDEX) {
|
||||||
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
if (osmEditingPlugin != null) {
|
if (osmEditingPlugin != null) {
|
||||||
|
|
Loading…
Reference in a new issue