diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java index a9015f34a3..d6045edec7 100644 --- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java @@ -311,7 +311,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra return nightMode ? R.drawable.bg_bottom_sheet_sides_landscape_dark : R.drawable.bg_bottom_sheet_sides_landscape_light; } - private boolean isNightMode(@NonNull OsmandApplication app) { + protected boolean isNightMode(@NonNull OsmandApplication app) { if (usedOnMap) { return app.getDaynightHelper().isNightModeForMapControls(); } diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectAppModesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/profiles/SelectAppModesBottomSheetDialogFragment.java index bfc42cc80e..c85e080bdc 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectAppModesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectAppModesBottomSheetDialogFragment.java @@ -41,11 +41,6 @@ public class SelectAppModesBottomSheetDialogFragment extends AppModesBottomSheet if (appMode == null) { appMode = app.getSettings().getApplicationMode(); } - if (usedOnMap) { - nightMode = app.getDaynightHelper().isNightModeForMapControlsForProfile(getAppMode()); - } else { - nightMode = !app.getSettings().isLightContentForMode(getAppMode()); - } } @Override @@ -112,6 +107,15 @@ public class SelectAppModesBottomSheetDialogFragment extends AppModesBottomSheet outState.putBoolean(APP_MODE_CHANGEABLE_KEY, appModeChangeable); } + @Override + protected boolean isNightMode(@NonNull OsmandApplication app) { + if (usedOnMap) { + return app.getDaynightHelper().isNightModeForMapControlsForProfile(getAppMode()); + } else { + return !app.getSettings().isLightContentForMode(getAppMode()); + } + } + public static void showInstance(@NonNull FragmentManager fm, Fragment target, boolean usedOnMap, @Nullable ApplicationMode appMode, boolean appModeChangeable) { try { diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java index cc2b370d18..d38bfae353 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java @@ -8,6 +8,7 @@ import android.support.v7.preference.DialogPreference.TargetFragment; import android.support.v7.preference.Preference; import net.osmand.plus.ApplicationMode; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import java.util.List; @@ -35,11 +36,6 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra if (savedInstanceState != null) { appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null); } - if (usedOnMap) { - nightMode = requiredMyApplication().getDaynightHelper().isNightModeForMapControlsForProfile(getAppMode()); - } else { - nightMode = !requiredMyApplication().getSettings().isLightContentForMode(getAppMode()); - } } @Override @@ -50,6 +46,15 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra } } + @Override + protected boolean isNightMode(@NonNull OsmandApplication app) { + if (usedOnMap) { + return app.getDaynightHelper().isNightModeForMapControlsForProfile(getAppMode()); + } else { + return !app.getSettings().isLightContentForMode(getAppMode()); + } + } + public String getPrefId() { if (prefId == null) { Bundle args = getArguments();