From ab3b489422cfc7a148ed6228f23fc9771939607b Mon Sep 17 00:00:00 2001 From: Nazar Date: Wed, 30 Oct 2019 12:03:11 +0200 Subject: [PATCH] Fix #7606 --- OsmAnd/res/layout/list_menu_item_native.xml | 2 +- .../plus/activities/MapActivityLayers.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/OsmAnd/res/layout/list_menu_item_native.xml b/OsmAnd/res/layout/list_menu_item_native.xml index d4f9ba98ff..79a9ca5a7a 100644 --- a/OsmAnd/res/layout/list_menu_item_native.xml +++ b/OsmAnd/res/layout/list_menu_item_native.xml @@ -27,7 +27,7 @@ android:layout_weight="1" android:gravity="center_vertical" android:text="@string/layer_poi" - android:textColor="?android:textColorSecondary" + android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size"/> transparencyListener; public MapActivityLayers(MapActivity activity) { this.activity = activity; this.mapWidgetRegistry = new MapWidgetRegistry(activity.getMyApplication()); this.quickActionRegistry = new QuickActionRegistry(activity.getMyApplication().getSettings()); - this.nightMode = activity.getMyApplication().getDaynightHelper().isNightModeForMapControls(); - this.themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; } public QuickActionRegistry getQuickActionRegistry() { @@ -272,7 +267,7 @@ public class MapActivityLayers { return true; } }; - return GpxUiHelper.selectGPXFiles(files, activity, callbackWithObject, themeRes); + return GpxUiHelper.selectGPXFiles(files, activity, callbackWithObject, getThemeRes(getApplication())); } @@ -289,8 +284,8 @@ public class MapActivityLayers { } list.add(poiFilters.getCustomPOIFilter()); - final ArrayAdapter listAdapter = adapter.createListAdapter(activity, !nightMode); - AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, themeRes)); + final ArrayAdapter listAdapter = adapter.createListAdapter(activity, !isNightMode(app)); + AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, getThemeRes(app))); final ListView listView = new ListView(activity); listView.setDivider(null); listView.setClickable(true); @@ -367,8 +362,8 @@ public class MapActivityLayers { addFilterToList(adapter, list, f, false); } - final ArrayAdapter listAdapter = adapter.createListAdapter(activity, !nightMode); - AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, themeRes)); + final ArrayAdapter listAdapter = adapter.createListAdapter(activity, !isNightMode(app)); + AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, getThemeRes(app))); builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -583,6 +578,16 @@ public class MapActivityLayers { } } + private boolean isNightMode(OsmandApplication app) { + if (app == null) { + return false; + } + return app.getDaynightHelper().isNightModeForMapControls(); + } + + private int getThemeRes(OsmandApplication app) { + return isNightMode(app) ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; + } private String getString(int resId) { return activity.getString(resId);