support for profile theme

This commit is contained in:
veliymolfar 2020-04-24 12:11:57 +03:00
parent 26840d90ab
commit 892d3e78c6
3 changed files with 6 additions and 5 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -53,11 +53,11 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
public RearrangeMenuItemsAdapter(OsmandApplication app,
List<RearrangeMenuAdapterItem> items) {
List<RearrangeMenuAdapterItem> 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;