From 892d3e78c6adccd3aaeab6f8d589a2a984368723 Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Fri, 24 Apr 2020 12:11:57 +0300 Subject: [PATCH] support for profile theme --- .../net/osmand/plus/settings/ConfigureMenuItemsFragment.java | 4 ++-- .../net/osmand/plus/settings/ConfigureMenuRootFragment.java | 3 ++- .../net/osmand/plus/settings/RearrangeMenuItemsAdapter.java | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java index 6777b95add..0c38dd14fd 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java @@ -127,7 +127,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = requireMyApplication(); - nightMode = !app.getSettings().isLightContent(); + nightMode = app.getSettings().OSMAND_THEME.getModeValue(appMode) == OsmandSettings.OSMAND_DARK_THEME; mInflater = UiUtilities.getInflater(app, nightMode); if (savedInstanceState != null) { appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null); @@ -198,7 +198,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment appbar.addView(toolbar); RecyclerView recyclerView = root.findViewById(R.id.profiles_list); recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width)); - rearrangeAdapter = new RearrangeMenuItemsAdapter(app, getAdapterItems()); + rearrangeAdapter = new RearrangeMenuItemsAdapter(app, getAdapterItems(), nightMode); recyclerView.setLayoutManager(new LinearLayoutManager(app)); final ItemTouchHelper touchHelper = new ItemTouchHelper(new ReorderItemTouchHelperCallback(rearrangeAdapter)); touchHelper.attachToRecyclerView(recyclerView); diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java index a45a72dc11..5b6370b6c8 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java @@ -30,6 +30,7 @@ import net.osmand.PlatformUtil; import net.osmand.plus.ApplicationMode; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; @@ -83,7 +84,7 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment { appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null); } app = requireMyApplication(); - nightMode = !app.getSettings().isLightContent(); + nightMode = app.getSettings().OSMAND_THEME.getModeValue(appMode) == OsmandSettings.OSMAND_DARK_THEME; mInflater = UiUtilities.getInflater(app, nightMode); } diff --git a/OsmAnd/src/net/osmand/plus/settings/RearrangeMenuItemsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/RearrangeMenuItemsAdapter.java index 5ad66aa816..960e5d7d82 100644 --- a/OsmAnd/src/net/osmand/plus/settings/RearrangeMenuItemsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/RearrangeMenuItemsAdapter.java @@ -53,11 +53,11 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter items) { + List items, boolean nightMode) { this.app = app; this.items = items; uiUtilities = app.getUIUtilities(); - nightMode = !app.getSettings().isLightContent(); + this.nightMode = nightMode; activeColorRes = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;