QuickAction Show/hide selected gpx tracks

This commit is contained in:
madwasp79 2019-02-21 11:59:03 +02:00
parent d9bf5ca746
commit 92b3e2142e
4 changed files with 24 additions and 2 deletions

View file

@ -42,6 +42,7 @@ public class GpxSelectionHelper {
private OsmandApplication app;
@NonNull
private List<SelectedGpxFile> selectedGPXFiles = new java.util.ArrayList<>();
private List<SelectedGpxFile> selectedGpxFilesBackUp = new java.util.ArrayList<>();
private SavingTrackHelper savingTrackHelper;
public GpxSelectionHelper(OsmandApplication osmandApplication, SavingTrackHelper trackHelper) {
@ -50,14 +51,27 @@ public class GpxSelectionHelper {
}
public void clearAllGpxFileToShow() {
selectedGpxFilesBackUp.clear();
selectedGpxFilesBackUp.addAll(selectedGPXFiles);
selectedGPXFiles.clear();
saveCurrentSelections();
}
public void restoreSelectedGpxFiles() {
if (!selectedGpxFilesBackUp.isEmpty()) {
selectedGPXFiles.addAll(selectedGpxFilesBackUp);
}
}
public boolean isSelectedGpxFilesBackUp() {
return !selectedGpxFilesBackUp.isEmpty();
}
public boolean isShowingAnyGpxFiles() {
return !selectedGPXFiles.isEmpty();
}
@NonNull
public List<SelectedGpxFile> getSelectedGPXFiles() {
return selectedGPXFiles;

View file

@ -153,6 +153,7 @@ public class ConfigureMapMenu {
private List<String> getAlreadySelectedGpx() {
GpxSelectionHelper selectedGpxHelper = ma.getMyApplication().getSelectedGpxHelper();
selectedGpxHelper.restoreSelectedGpxFiles();
List<GpxSelectionHelper.SelectedGpxFile> selectedGpxFiles = selectedGpxHelper.getSelectedGPXFiles();
List<String> files = new ArrayList<>();
for (GpxSelectionHelper.SelectedGpxFile file : selectedGpxFiles) {
@ -235,7 +236,7 @@ public class ConfigureMapMenu {
@Override
public void onDismiss(DialogInterface dialog) {
OsmandApplication app = ma.getMyApplication();
boolean selected = app.getSelectedGpxHelper().isShowingAnyGpxFiles();
boolean selected = app.getSelectedGpxHelper().isShowingAnyGpxFiles() || app.getSelectedGpxHelper().isSelectedGpxFilesBackUp();
item.setSelected(app.getSelectedGpxHelper().isShowingAnyGpxFiles());
item.setDescription(app.getSelectedGpxHelper().getGpxDescription());
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);

View file

@ -0,0 +1,7 @@
package net.osmand.plus.quickaction.actions;
import net.osmand.plus.quickaction.QuickAction;
public class ShowHideGPXTracksAction extends QuickAction {
}

View file

@ -6,7 +6,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit