setup Light theme instead of System default when importing a profile for devices with android less than 10

This commit is contained in:
Nazar-Kutz 2020-08-21 15:39:59 +03:00
parent dc59603f9b
commit be01ba260f
2 changed files with 12 additions and 2 deletions

View file

@ -3909,7 +3909,16 @@ public class OsmandSettings {
new IntPreference("FAVORITES_TAB", 0).makeGlobal().cache();
public final CommonPreference<Integer> OSMAND_THEME =
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeProfile().cache();
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME) {
@Override
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
Integer theme = parseString(json.getString(getId()));
if (theme == SYSTEM_DEFAULT_THEME && !isSupportSystemDefaultTheme()) {
theme = OSMAND_LIGHT_THEME;
}
setModeValue(appMode, theme);
}
}.makeProfile().cache();
public final OsmandPreference<Boolean> OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED =
new BooleanPreference("open_only_header_route_calculated", false).makeProfile();

View file

@ -119,7 +119,8 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
private Drawable getOsmandThemeIcon() {
int iconId;
if (settings.isSystemDefaultThemeUsed()) {
ApplicationMode mode = getSelectedAppMode();
if (settings.isSystemDefaultThemeUsedForMode(mode)) {
iconId = R.drawable.ic_action_android;
} else {
iconId = settings.isLightContent() ? R.drawable.ic_action_sun : R.drawable.ic_action_moon;