Issue #6524 - Quick Action crash after selecting empty Overlay/Underlay/Map Style actions - FIXED
This commit is contained in:
parent
d9bf5ca746
commit
bb477d3272
3 changed files with 45 additions and 44 deletions
|
@ -84,23 +84,25 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
settings.MAP_OVERLAY.get(),
|
||||
settings.MAP_OVERLAY.get());
|
||||
if(sources.size()>0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
settings.MAP_OVERLAY.get(),
|
||||
settings.MAP_OVERLAY.get());
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,8 +195,7 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,24 +77,25 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
if(sources.size()>0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = settings.MAP_ONLINE_DATA.get()
|
||||
Pair<String, String> currentSource = settings.MAP_ONLINE_DATA.get()
|
||||
? new Pair<>(settings.MAP_TILE_SOURCES.get(), settings.MAP_TILE_SOURCES.get())
|
||||
: new Pair<>(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data));
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,8 +196,7 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,24 +82,25 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
if(sources.size()>0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
settings.MAP_UNDERLAY.get(),
|
||||
settings.MAP_UNDERLAY.get());
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,8 +197,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue