Merge pull request #7844 from osmandapp/theme_change_fixes
Quick action theme change fixes
This commit is contained in:
commit
9fec5bddad
7 changed files with 41 additions and 25 deletions
|
@ -53,7 +53,7 @@ public class AddQuickActionDialog extends DialogFragment {
|
||||||
.getQuickActionRegistry()
|
.getQuickActionRegistry()
|
||||||
.getQuickActions();
|
.getQuickActions();
|
||||||
|
|
||||||
View root = inflater.inflate(R.layout.quick_action_add_dialog, container, false);
|
View root = UiUtilities.getInflater(getActivity(), !isLightContent).inflate(R.layout.quick_action_add_dialog, container, false);
|
||||||
Adapter adapter = new Adapter(QuickActionFactory.produceTypeActionsListWithHeaders(active));
|
Adapter adapter = new Adapter(QuickActionFactory.produceTypeActionsListWithHeaders(active));
|
||||||
|
|
||||||
TextView tvTitle = root.findViewById(R.id.tvTitle);
|
TextView tvTitle = root.findViewById(R.id.tvTitle);
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
LayoutInflater inflater = UiUtilities.getInflater(parent.getContext(), isLightContent);
|
LayoutInflater inflater = UiUtilities.getInflater(parent.getContext(), !isLightContent);
|
||||||
if (viewType == SCREEN_ITEM_TYPE)
|
if (viewType == SCREEN_ITEM_TYPE)
|
||||||
return new QuickActionItemVH(inflater.inflate(R.layout.quick_action_list_item, parent, false));
|
return new QuickActionItemVH(inflater.inflate(R.layout.quick_action_list_item, parent, false));
|
||||||
else
|
else
|
||||||
|
|
|
@ -12,10 +12,12 @@ import android.widget.Toast;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
|
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.quickaction.QuickAction;
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
import net.osmand.plus.quickaction.SwitchableAction;
|
import net.osmand.plus.quickaction.SwitchableAction;
|
||||||
|
@ -172,11 +174,12 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
OsmandApplication app = activity.getMyApplication();
|
||||||
final OsmandSettings settings = activity.getMyApplication().getSettings();
|
Map<String, String> entriesMap = app.getSettings().getTileSourceEntries();
|
||||||
Map<String, String> entriesMap = settings.getTileSourceEntries();
|
|
||||||
entriesMap.put(KEY_NO_OVERLAY, activity.getString(R.string.no_overlay));
|
entriesMap.put(KEY_NO_OVERLAY, activity.getString(R.string.no_overlay));
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
|
||||||
final ArrayList<String> keys = new ArrayList<>(entriesMap.keySet());
|
final ArrayList<String> keys = new ArrayList<>(entriesMap.keySet());
|
||||||
final String[] items = new String[entriesMap.size()];
|
final String[] items = new String[entriesMap.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -185,7 +188,7 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
||||||
items[i++] = it;
|
items[i++] = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, R.layout.dialog_text_item);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(themedContext, R.layout.dialog_text_item);
|
||||||
arrayAdapter.addAll(items);
|
arrayAdapter.addAll(items);
|
||||||
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,9 +12,11 @@ import android.widget.Toast;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.quickaction.QuickAction;
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
import net.osmand.plus.quickaction.SwitchableAction;
|
import net.osmand.plus.quickaction.SwitchableAction;
|
||||||
|
@ -148,16 +150,18 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
OsmandApplication app = activity.getMyApplication();
|
||||||
|
|
||||||
final OsmandSettings settings = activity.getMyApplication().getSettings();
|
|
||||||
final LinkedHashMap<String, String> entriesMap = new LinkedHashMap<>();
|
final LinkedHashMap<String, String> entriesMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
entriesMap.put(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data));
|
entriesMap.put(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data));
|
||||||
entriesMap.putAll(settings.getTileSourceEntries());
|
entriesMap.putAll(app.getSettings().getTileSourceEntries());
|
||||||
|
|
||||||
final List<Map.Entry<String, String>> entriesMapList = new ArrayList<>(entriesMap.entrySet());
|
final List<Map.Entry<String, String>> entriesMapList = new ArrayList<>(entriesMap.entrySet());
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
|
||||||
|
|
||||||
final String[] items = new String[entriesMapList.size()];
|
final String[] items = new String[entriesMapList.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -166,7 +170,7 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
||||||
items[i++] = entry.getValue();
|
items[i++] = entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, R.layout.dialog_text_item);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(themedContext, R.layout.dialog_text_item);
|
||||||
|
|
||||||
arrayAdapter.addAll(items);
|
arrayAdapter.addAll(items);
|
||||||
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.Toast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
|
@ -20,12 +21,12 @@ import net.osmand.plus.quickaction.SwitchableAction;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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> {
|
||||||
|
|
||||||
|
@ -134,11 +135,13 @@ public class MapStyleAction extends SwitchableAction<String> {
|
||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
final OsmandApplication app = activity.getMyApplication();
|
||||||
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||||
|
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
AlertDialog.Builder bld = new AlertDialog.Builder(themedContext);
|
||||||
bld.setTitle(R.string.renderers);
|
bld.setTitle(R.string.renderers);
|
||||||
|
|
||||||
final OsmandApplication app = activity.getMyApplication();
|
|
||||||
final List<String> visibleNamesList = new ArrayList<>();
|
final List<String> visibleNamesList = new ArrayList<>();
|
||||||
final ArrayList<String> items = new ArrayList<>(app.getRendererRegistry().getRendererNames());
|
final ArrayList<String> items = new ArrayList<>(app.getRendererRegistry().getRendererNames());
|
||||||
final boolean nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
final boolean nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
||||||
|
@ -155,7 +158,7 @@ public class MapStyleAction extends SwitchableAction<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, R.layout.dialog_text_item);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(themedContext, R.layout.dialog_text_item);
|
||||||
|
|
||||||
arrayAdapter.addAll(visibleNamesList);
|
arrayAdapter.addAll(visibleNamesList);
|
||||||
bld.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
bld.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||||
|
|
|
@ -12,10 +12,12 @@ import android.widget.Toast;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
|
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.quickaction.QuickAction;
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
import net.osmand.plus.quickaction.SwitchableAction;
|
import net.osmand.plus.quickaction.SwitchableAction;
|
||||||
|
@ -176,11 +178,15 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
OsmandApplication app = activity.getMyApplication();
|
||||||
|
|
||||||
final OsmandSettings settings = activity.getMyApplication().getSettings();
|
Map<String, String> entriesMap = app.getSettings().getTileSourceEntries();
|
||||||
Map<String, String> entriesMap = settings.getTileSourceEntries();
|
|
||||||
entriesMap.put(KEY_NO_UNDERLAY, activity.getString(R.string.no_underlay));
|
entriesMap.put(KEY_NO_UNDERLAY, activity.getString(R.string.no_underlay));
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
||||||
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
|
||||||
final ArrayList<String> keys = new ArrayList<>(entriesMap.keySet());
|
final ArrayList<String> keys = new ArrayList<>(entriesMap.keySet());
|
||||||
final String[] items = new String[entriesMap.size()];
|
final String[] items = new String[entriesMap.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -189,7 +195,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
||||||
items[i++] = it;
|
items[i++] = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, R.layout.dialog_text_item);
|
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(themedContext, R.layout.dialog_text_item);
|
||||||
arrayAdapter.addAll(items);
|
arrayAdapter.addAll(items);
|
||||||
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
builder.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
|
@ -135,9 +136,8 @@ public class ShowHidePoiAction extends QuickAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawUI(ViewGroup parent, final MapActivity activity) {
|
public void drawUI(ViewGroup parent, final MapActivity activity) {
|
||||||
|
boolean nightMode = activity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
View view = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.quick_action_show_hide_poi, parent, false);
|
||||||
.inflate(R.layout.quick_action_show_hide_poi, parent, false);
|
|
||||||
|
|
||||||
RecyclerView list = (RecyclerView) view.findViewById(R.id.list);
|
RecyclerView list = (RecyclerView) view.findViewById(R.id.list);
|
||||||
Button addFilter = (Button) view.findViewById(R.id.btnAddCategory);
|
Button addFilter = (Button) view.findViewById(R.id.btnAddCategory);
|
||||||
|
@ -288,9 +288,9 @@ public class ShowHidePoiAction extends QuickAction {
|
||||||
addFilterToList(adapter, list, f);
|
addFilterToList(adapter, list, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<ContextMenuItem> listAdapter =
|
boolean nightMode = activity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
adapter.createListAdapter(activity, app.getSettings().isLightContent());
|
final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(activity, !nightMode);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||||
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
Loading…
Reference in a new issue