QuickAction Show/hide selected gpx tracks
This commit is contained in:
parent
d9bf5ca746
commit
92b3e2142e
4 changed files with 24 additions and 2 deletions
|
@ -42,6 +42,7 @@ public class GpxSelectionHelper {
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
@NonNull
|
@NonNull
|
||||||
private List<SelectedGpxFile> selectedGPXFiles = new java.util.ArrayList<>();
|
private List<SelectedGpxFile> selectedGPXFiles = new java.util.ArrayList<>();
|
||||||
|
private List<SelectedGpxFile> selectedGpxFilesBackUp = new java.util.ArrayList<>();
|
||||||
private SavingTrackHelper savingTrackHelper;
|
private SavingTrackHelper savingTrackHelper;
|
||||||
|
|
||||||
public GpxSelectionHelper(OsmandApplication osmandApplication, SavingTrackHelper trackHelper) {
|
public GpxSelectionHelper(OsmandApplication osmandApplication, SavingTrackHelper trackHelper) {
|
||||||
|
@ -50,14 +51,27 @@ public class GpxSelectionHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearAllGpxFileToShow() {
|
public void clearAllGpxFileToShow() {
|
||||||
|
selectedGpxFilesBackUp.clear();
|
||||||
|
selectedGpxFilesBackUp.addAll(selectedGPXFiles);
|
||||||
selectedGPXFiles.clear();
|
selectedGPXFiles.clear();
|
||||||
saveCurrentSelections();
|
saveCurrentSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void restoreSelectedGpxFiles() {
|
||||||
|
if (!selectedGpxFilesBackUp.isEmpty()) {
|
||||||
|
selectedGPXFiles.addAll(selectedGpxFilesBackUp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSelectedGpxFilesBackUp() {
|
||||||
|
return !selectedGpxFilesBackUp.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShowingAnyGpxFiles() {
|
public boolean isShowingAnyGpxFiles() {
|
||||||
return !selectedGPXFiles.isEmpty();
|
return !selectedGPXFiles.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<SelectedGpxFile> getSelectedGPXFiles() {
|
public List<SelectedGpxFile> getSelectedGPXFiles() {
|
||||||
return selectedGPXFiles;
|
return selectedGPXFiles;
|
||||||
|
|
|
@ -153,6 +153,7 @@ public class ConfigureMapMenu {
|
||||||
|
|
||||||
private List<String> getAlreadySelectedGpx() {
|
private List<String> getAlreadySelectedGpx() {
|
||||||
GpxSelectionHelper selectedGpxHelper = ma.getMyApplication().getSelectedGpxHelper();
|
GpxSelectionHelper selectedGpxHelper = ma.getMyApplication().getSelectedGpxHelper();
|
||||||
|
selectedGpxHelper.restoreSelectedGpxFiles();
|
||||||
List<GpxSelectionHelper.SelectedGpxFile> selectedGpxFiles = selectedGpxHelper.getSelectedGPXFiles();
|
List<GpxSelectionHelper.SelectedGpxFile> selectedGpxFiles = selectedGpxHelper.getSelectedGPXFiles();
|
||||||
List<String> files = new ArrayList<>();
|
List<String> files = new ArrayList<>();
|
||||||
for (GpxSelectionHelper.SelectedGpxFile file : selectedGpxFiles) {
|
for (GpxSelectionHelper.SelectedGpxFile file : selectedGpxFiles) {
|
||||||
|
@ -235,7 +236,7 @@ public class ConfigureMapMenu {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
OsmandApplication app = ma.getMyApplication();
|
OsmandApplication app = ma.getMyApplication();
|
||||||
boolean selected = app.getSelectedGpxHelper().isShowingAnyGpxFiles();
|
boolean selected = app.getSelectedGpxHelper().isShowingAnyGpxFiles() || app.getSelectedGpxHelper().isSelectedGpxFilesBackUp();
|
||||||
item.setSelected(app.getSelectedGpxHelper().isShowingAnyGpxFiles());
|
item.setSelected(app.getSelectedGpxHelper().isShowingAnyGpxFiles());
|
||||||
item.setDescription(app.getSelectedGpxHelper().getGpxDescription());
|
item.setDescription(app.getSelectedGpxHelper().getGpxDescription());
|
||||||
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.osmand.plus.quickaction.actions;
|
||||||
|
|
||||||
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
|
|
||||||
|
public class ShowHideGPXTracksAction extends QuickAction {
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
# 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.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
|
Loading…
Reference in a new issue