commit
b915e8db6d
2 changed files with 20 additions and 14 deletions
|
@ -3164,5 +3164,6 @@
|
||||||
<string name="run_full_osmand_header">Launch OsmAnd?</string>
|
<string name="run_full_osmand_header">Launch OsmAnd?</string>
|
||||||
<string name="routing_attr_avoid_sett_name">Avoid cobblestone and sett</string>
|
<string name="routing_attr_avoid_sett_name">Avoid cobblestone and sett</string>
|
||||||
<string name="routing_attr_avoid_sett_description">Avoid cobblestone and sett</string>
|
<string name="routing_attr_avoid_sett_description">Avoid cobblestone and sett</string>
|
||||||
|
<string name="quick_action_need_to_add_item_to_list">You need to add at least one Item to list in Quick Action\' Settings</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public class MapStyleAction extends SwitchableAction<String> {
|
public class MapStyleAction extends SwitchableAction<String> {
|
||||||
|
|
||||||
|
@ -42,21 +43,26 @@ public class MapStyleAction extends SwitchableAction<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(MapActivity activity) {
|
public void execute(MapActivity activity) {
|
||||||
|
|
||||||
List<String> mapStyles = getFilteredStyles();
|
List<String> mapStyles = getFilteredStyles();
|
||||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
if (!Algorithms.isEmpty(mapStyles)) {
|
||||||
if (showBottomSheetStyles) {
|
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||||
showChooseDialog(activity.getSupportFragmentManager());
|
if (showBottomSheetStyles) {
|
||||||
return;
|
showChooseDialog(activity.getSupportFragmentManager());
|
||||||
}
|
return;
|
||||||
String curStyle = activity.getMyApplication().getSettings().RENDERER.get();
|
}
|
||||||
int index = mapStyles.indexOf(curStyle);
|
String curStyle = activity.getMyApplication().getSettings().RENDERER.get();
|
||||||
String nextStyle = mapStyles.get(0);
|
int index = mapStyles.indexOf(curStyle);
|
||||||
|
String nextStyle = mapStyles.get(0);
|
||||||
|
|
||||||
if (index >= 0 && index + 1 < mapStyles.size()) {
|
if (index >= 0 && index + 1 < mapStyles.size()) {
|
||||||
nextStyle = mapStyles.get(index + 1);
|
nextStyle = mapStyles.get(index + 1);
|
||||||
|
}
|
||||||
|
executeWithParams(activity, nextStyle);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(activity, R.string.quick_action_need_to_add_item_to_list,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
executeWithParams(activity, nextStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,9 +187,8 @@ public class MapStyleAction extends SwitchableAction<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fillParams(View root, MapActivity activity) {
|
public boolean fillParams(View root, MapActivity activity) {
|
||||||
super.fillParams(root, activity);
|
|
||||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||||
return true;
|
return super.fillParams(root, activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue