diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 86bdadc494..672c27fdda 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -346,7 +346,7 @@
android:screenOrientation="fullUser"/>
+ android:parentActivityName="app.organicmaps.MwmActivity"
+ android:theme="@style/MwmTheme.CardBg"/>
+ android:name="app.organicmaps.MapPlaceholderActivity" />
getFragmentClass()
{
diff --git a/android/app/src/main/java/app/organicmaps/bookmarks/BookmarkListActivity.java b/android/app/src/main/java/app/organicmaps/bookmarks/BookmarkListActivity.java
index 353df29639..63c7dc3713 100644
--- a/android/app/src/main/java/app/organicmaps/bookmarks/BookmarkListActivity.java
+++ b/android/app/src/main/java/app/organicmaps/bookmarks/BookmarkListActivity.java
@@ -38,14 +38,6 @@ public class BookmarkListActivity extends BaseToolbarActivity
super.onPause();
}
-
- @Override
- @StyleRes
- public int getThemeResourceId(@NonNull String theme)
- {
- return ThemeUtils.getCardBgThemeResourceId(getApplicationContext(), theme);
- }
-
@Override
protected Class extends Fragment> getFragmentClass()
{
diff --git a/android/app/src/main/java/app/organicmaps/car/screens/CategoriesScreen.java b/android/app/src/main/java/app/organicmaps/car/screens/CategoriesScreen.java
index 7598bfbf0c..a15fd8e90a 100644
--- a/android/app/src/main/java/app/organicmaps/car/screens/CategoriesScreen.java
+++ b/android/app/src/main/java/app/organicmaps/car/screens/CategoriesScreen.java
@@ -30,15 +30,15 @@ public class CategoriesScreen extends BaseMapScreen
private record CategoryData(@StringRes int nameResId, @DrawableRes int iconResId, @DrawableRes int iconNightResId)
{
}
-
+ //TODO: previously handled theme by itself, but now icons are dynamic so not needed.
private static final List CATEGORIES = Arrays.asList(
- new CategoryData(R.string.category_fuel, R.drawable.ic_category_fuel, R.drawable.ic_category_fuel_night),
- new CategoryData(R.string.category_parking, R.drawable.ic_category_parking, R.drawable.ic_category_parking_night),
- new CategoryData(R.string.category_eat, R.drawable.ic_category_eat, R.drawable.ic_category_eat_night),
- new CategoryData(R.string.category_food, R.drawable.ic_category_food, R.drawable.ic_category_food_night),
- new CategoryData(R.string.category_hotel, R.drawable.ic_category_hotel, R.drawable.ic_category_hotel_night),
- new CategoryData(R.string.category_toilet, R.drawable.ic_category_toilet, R.drawable.ic_category_toilet_night),
- new CategoryData(R.string.category_rv, R.drawable.ic_category_rv, R.drawable.ic_category_rv_night)
+ new CategoryData(R.string.category_fuel, R.drawable.ic_category_fuel, R.drawable.ic_category_fuel),
+ new CategoryData(R.string.category_parking, R.drawable.ic_category_parking, R.drawable.ic_category_parking),
+ new CategoryData(R.string.category_eat, R.drawable.ic_category_eat, R.drawable.ic_category_eat),
+ new CategoryData(R.string.category_food, R.drawable.ic_category_food, R.drawable.ic_category_food),
+ new CategoryData(R.string.category_hotel, R.drawable.ic_category_hotel, R.drawable.ic_category_hotel),
+ new CategoryData(R.string.category_toilet, R.drawable.ic_category_toilet, R.drawable.ic_category_toilet),
+ new CategoryData(R.string.category_rv, R.drawable.ic_category_rv, R.drawable.ic_category_rv)
);
private final int MAX_CATEGORIES_SIZE;
diff --git a/android/app/src/main/java/app/organicmaps/car/screens/settings/SettingsScreen.java b/android/app/src/main/java/app/organicmaps/car/screens/settings/SettingsScreen.java
index 3c493b2ac6..5bbc6d3f22 100644
--- a/android/app/src/main/java/app/organicmaps/car/screens/settings/SettingsScreen.java
+++ b/android/app/src/main/java/app/organicmaps/car/screens/settings/SettingsScreen.java
@@ -75,7 +75,7 @@ public class SettingsScreen extends BaseMapScreen
private Item createThemeItem()
{
final Row.Builder builder = new Row.Builder();
- builder.setTitle(getCarContext().getString(R.string.pref_map_style_title));
+ builder.setTitle(getCarContext().getString(R.string.pref_appearance_title));
builder.addText(getCarContext().getString(ThemeUtils.getThemeMode(getCarContext()).getTitleId()));
builder.setOnClickListener(() -> getScreenManager().push(new ThemeScreen(getCarContext(), getSurfaceRenderer())));
builder.setBrowsable(true);
diff --git a/android/app/src/main/java/app/organicmaps/car/screens/settings/ThemeScreen.java b/android/app/src/main/java/app/organicmaps/car/screens/settings/ThemeScreen.java
index 530a3259b5..f2a83959e8 100644
--- a/android/app/src/main/java/app/organicmaps/car/screens/settings/ThemeScreen.java
+++ b/android/app/src/main/java/app/organicmaps/car/screens/settings/ThemeScreen.java
@@ -47,7 +47,7 @@ public class ThemeScreen extends BaseMapScreen
{
final Header.Builder builder = new Header.Builder();
builder.setStartHeaderAction(Action.BACK);
- builder.setTitle(getCarContext().getString(R.string.pref_map_style_title));
+ builder.setTitle(getCarContext().getString(R.string.pref_appearance_title));
return builder.build();
}
@@ -56,7 +56,7 @@ public class ThemeScreen extends BaseMapScreen
{
final ItemList.Builder builder = new ItemList.Builder();
final ThemeUtils.ThemeMode currentThemeMode = ThemeUtils.getThemeMode(getCarContext());
- builder.addItem(createRadioButton(ThemeUtils.ThemeMode.AUTO, currentThemeMode));
+ builder.addItem(createRadioButton(ThemeUtils.ThemeMode.FOLLOW_SYSTEM, currentThemeMode));
builder.addItem(createRadioButton(ThemeUtils.ThemeMode.NIGHT, currentThemeMode));
builder.addItem(createRadioButton(ThemeUtils.ThemeMode.LIGHT, currentThemeMode));
return new ListTemplate.Builder().setHeader(createHeader()).setSingleList(builder.build()).build();
diff --git a/android/app/src/main/java/app/organicmaps/car/util/ThemeUtils.java b/android/app/src/main/java/app/organicmaps/car/util/ThemeUtils.java
index cb6806cfd5..f38dc77add 100644
--- a/android/app/src/main/java/app/organicmaps/car/util/ThemeUtils.java
+++ b/android/app/src/main/java/app/organicmaps/car/util/ThemeUtils.java
@@ -17,9 +17,9 @@ public final class ThemeUtils
{
public enum ThemeMode
{
- AUTO(R.string.auto, R.string.theme_auto),
- LIGHT(R.string.off, R.string.theme_default),
- NIGHT(R.string.on, R.string.theme_night);
+ LIGHT(R.string.light, R.string.theme_default),
+ NIGHT(R.string.dark, R.string.theme_night),
+ FOLLOW_SYSTEM(R.string.follow_system, R.string.theme_follow_system);
ThemeMode(@StringRes int titleId, @StringRes int prefsKeyId)
{
@@ -58,7 +58,7 @@ public final class ThemeUtils
@UiThread
public static void update(@NonNull CarContext context, @NonNull ThemeMode oldThemeMode)
{
- final ThemeMode newThemeMode = oldThemeMode == ThemeMode.AUTO ? (context.isDarkMode() ? ThemeMode.NIGHT : ThemeMode.LIGHT) : oldThemeMode;
+ final ThemeMode newThemeMode = oldThemeMode == ThemeMode.FOLLOW_SYSTEM ? (context.isDarkMode() ? ThemeMode.NIGHT : ThemeMode.LIGHT) : oldThemeMode;
@Framework.MapStyle
int newMapStyle;
@@ -74,7 +74,7 @@ public final class ThemeUtils
public static boolean isNightMode(@NonNull CarContext context)
{
final ThemeMode themeMode = getThemeMode(context);
- return themeMode == ThemeMode.NIGHT || (themeMode == ThemeMode.AUTO && context.isDarkMode());
+ return themeMode == ThemeMode.NIGHT || (themeMode == ThemeMode.FOLLOW_SYSTEM && context.isDarkMode());
}
@SuppressLint("ApplySharedPref")
@@ -88,13 +88,13 @@ public final class ThemeUtils
@NonNull
public static ThemeMode getThemeMode(@NonNull CarContext context)
{
- final String autoTheme = context.getString(R.string.theme_auto);
+ final String followSystemTheme = context.getString(R.string.theme_follow_system);
final String lightTheme = context.getString(R.string.theme_default);
final String nightTheme = context.getString(R.string.theme_night);
- final String themeMode = getSharedPreferences(context).getString(THEME_KEY, autoTheme);
+ final String themeMode = getSharedPreferences(context).getString(THEME_KEY, followSystemTheme);
- if (themeMode.equals(autoTheme))
- return ThemeMode.AUTO;
+ if (themeMode.equals(followSystemTheme))
+ return ThemeMode.FOLLOW_SYSTEM;
else if (themeMode.equals(lightTheme))
return ThemeMode.LIGHT;
else if (themeMode.equals(nightTheme))
diff --git a/android/app/src/main/java/app/organicmaps/editor/HoursMinutesPickerFragment.java b/android/app/src/main/java/app/organicmaps/editor/HoursMinutesPickerFragment.java
index 3708921150..f7c3480220 100644
--- a/android/app/src/main/java/app/organicmaps/editor/HoursMinutesPickerFragment.java
+++ b/android/app/src/main/java/app/organicmaps/editor/HoursMinutesPickerFragment.java
@@ -79,10 +79,7 @@ public class HoursMinutesPickerFragment extends BaseMwmDialogFragment
//noinspection ConstantConditions
mTabs.getTabAt(mSelectedTab).select();
- @StyleRes final int theme = ThemeUtils.isNightTheme(requireContext()) ?
- R.style.MwmMain_DialogFragment_TimePicker_Night :
- R.style.MwmMain_DialogFragment_TimePicker;
- final AlertDialog dialog = new MaterialAlertDialogBuilder(requireActivity(), theme)
+ final AlertDialog dialog = new MaterialAlertDialogBuilder(requireActivity())
.setView(root)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok, null)
@@ -141,14 +138,9 @@ public class HoursMinutesPickerFragment extends BaseMwmDialogFragment
mTabs = root.findViewById(R.id.tabs);
TextView tabView = (TextView) inflater.inflate(R.layout.tab_timepicker, mTabs, false);
tabView.setText(getResources().getString(R.string.editor_time_from));
- final ColorStateList textColor = AppCompatResources.getColorStateList(requireContext(),
- ThemeUtils.isNightTheme(requireContext()) ? R.color.accent_color_selector_night
- : R.color.accent_color_selector);
- tabView.setTextColor(textColor);
mTabs.addTab(mTabs.newTab().setCustomView(tabView), true);
tabView = (TextView) inflater.inflate(R.layout.tab_timepicker, mTabs, false);
tabView.setText(getResources().getString(R.string.editor_time_to));
- tabView.setTextColor(textColor);
mTabs.addTab(mTabs.newTab().setCustomView(tabView), true);
mTabs.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener()
{
diff --git a/android/app/src/main/java/app/organicmaps/maplayer/MapButtonsController.java b/android/app/src/main/java/app/organicmaps/maplayer/MapButtonsController.java
index e1d4c125b7..5bd7965c37 100644
--- a/android/app/src/main/java/app/organicmaps/maplayer/MapButtonsController.java
+++ b/android/app/src/main/java/app/organicmaps/maplayer/MapButtonsController.java
@@ -106,9 +106,6 @@ public class MapButtonsController extends Fragment
helpButton.setImageResource(R.drawable.ic_christmas_tree);
else
helpButton.setImageResource(R.drawable.logo);
- // Keep this button colorful in normal theme.
- if (!ThemeUtils.isNightTheme(requireContext()))
- helpButton.getDrawable().setTintList(null);
}
final View zoomFrame = mFrame.findViewById(R.id.zoom_buttons_container);
diff --git a/android/app/src/main/java/app/organicmaps/maplayer/traffic/widget/TrafficButton.java b/android/app/src/main/java/app/organicmaps/maplayer/traffic/widget/TrafficButton.java
index edfd31a185..db803ddfc1 100644
--- a/android/app/src/main/java/app/organicmaps/maplayer/traffic/widget/TrafficButton.java
+++ b/android/app/src/main/java/app/organicmaps/maplayer/traffic/widget/TrafficButton.java
@@ -39,29 +39,32 @@ public class TrafficButton
{
Context context = trafficBtn.getContext();
Resources res = context.getResources();
- final int animResId = ThemeUtils.getResource(context, R.attr.trafficLoadingAnimation);
+ final int animResId = R.drawable.anim_traffic_loading;
return (AnimationDrawable) Objects.requireNonNull(ResourcesCompat.getDrawable(res, animResId, context.getTheme()));
}
void turnOff()
{
stopWaitingAnimation();
- mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_on_night
- : R.drawable.ic_traffic_on);
+// TODO: Don't set theme programatically - use an xml with a night variant instead. Also convert to svg.
+// mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_on_night
+// : R.drawable.ic_traffic_on);
}
void turnOn()
{
stopWaitingAnimation();
- mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_on_night
- : R.drawable.ic_traffic_on);
+// TODO: Don't set theme programatically - use an xml with a night variant instead. Also convert to svg.
+// mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_on_night
+// : R.drawable.ic_traffic_on);
}
void markAsOutdated()
{
stopWaitingAnimation();
- mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_outdated_night
- : R.drawable.ic_traffic_outdated);
+// TODO: Don't set theme programatically - use an xml with a night variant instead. Also convert to svg.
+// mButton.setImageResource(ThemeUtils.isNightTheme(mButton.getContext()) ? R.drawable.ic_traffic_outdated_night
+// : R.drawable.ic_traffic_outdated);
}
void startWaitingAnimation()
diff --git a/android/app/src/main/java/app/organicmaps/routing/RoutingBottomMenuController.java b/android/app/src/main/java/app/organicmaps/routing/RoutingBottomMenuController.java
index e9745a52b5..a15a423cce 100644
--- a/android/app/src/main/java/app/organicmaps/routing/RoutingBottomMenuController.java
+++ b/android/app/src/main/java/app/organicmaps/routing/RoutingBottomMenuController.java
@@ -146,7 +146,7 @@ final class RoutingBottomMenuController implements View.OnClickListener
mActionIcon = mActionButton.findViewById(R.id.iv__icon);
UiUtils.hide(mAltitudeChartFrame, mActionFrame);
mListener = listener;
- int dividerRes = ThemeUtils.getResource(mContext, R.attr.transitStepDivider);
+ int dividerRes = R.drawable.dot_divider;
Drawable dividerDrawable = ContextCompat.getDrawable(mContext, dividerRes);
Resources res = mContext.getResources();
mTransitViewDecorator = new DotDividerItemDecoration(dividerDrawable, res.getDimensionPixelSize(R.dimen.margin_base),
diff --git a/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java b/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java
index 9f4a965c10..f24709beee 100644
--- a/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java
+++ b/android/app/src/main/java/app/organicmaps/routing/TransitStepView.java
@@ -89,7 +89,8 @@ public class TransitStepView extends View implements MultilineLayoutManager.Sque
{
mDrawable = null;
mText = info.getDistance() + " " + info.getDistanceUnits();
- mTextPaint.setColor(ThemeUtils.isDefaultTheme(getContext()) ? Color.BLACK : Color.WHITE);
+ //TODO @RedAuburn: set this with themed resource defs
+ //mTextPaint.setColor(ThemeUtils.isDefaultTheme(getContext()) ? Color.BLACK : Color.WHITE);
}
else
{
diff --git a/android/app/src/main/java/app/organicmaps/search/CategoriesAdapter.java b/android/app/src/main/java/app/organicmaps/search/CategoriesAdapter.java
index ea8bf7504b..aacaaf0671 100644
--- a/android/app/src/main/java/app/organicmaps/search/CategoriesAdapter.java
+++ b/android/app/src/main/java/app/organicmaps/search/CategoriesAdapter.java
@@ -110,10 +110,7 @@ class CategoriesAdapter extends RecyclerView.Adapter getFragmentClass()
diff --git a/android/app/src/main/java/app/organicmaps/settings/BaseXmlSettingsFragment.java b/android/app/src/main/java/app/organicmaps/settings/BaseXmlSettingsFragment.java
index 2371877ae9..e4037dd1f0 100644
--- a/android/app/src/main/java/app/organicmaps/settings/BaseXmlSettingsFragment.java
+++ b/android/app/src/main/java/app/organicmaps/settings/BaseXmlSettingsFragment.java
@@ -50,13 +50,6 @@ abstract class BaseXmlSettingsFragment extends PreferenceFragmentCompat
{
super.onViewCreated(view, savedInstanceState);
- int color;
- if (ThemeUtils.isDefaultTheme(requireContext()))
- color = ContextCompat.getColor(requireContext(), R.color.bg_cards);
- else
- color = ContextCompat.getColor(requireContext(), R.color.bg_cards_night);
- view.setBackgroundColor(color);
-
RecyclerView recyclerView = getListView();
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, new ScrollableContentInsetsListener(recyclerView));
}
diff --git a/android/app/src/main/java/app/organicmaps/settings/SettingsPrefsFragment.java b/android/app/src/main/java/app/organicmaps/settings/SettingsPrefsFragment.java
index b7d8e35f69..a23ed9e57d 100644
--- a/android/app/src/main/java/app/organicmaps/settings/SettingsPrefsFragment.java
+++ b/android/app/src/main/java/app/organicmaps/settings/SettingsPrefsFragment.java
@@ -395,19 +395,17 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment implements La
{
final ListPreference pref = getPreference(getString(R.string.pref_map_style));
- String curTheme = Config.getUiThemeSettings(requireContext());
+ String curTheme = Config.getThemeSettings(requireContext());
pref.setValue(curTheme);
pref.setSummary(pref.getEntry());
pref.setOnPreferenceChangeListener((preference, newValue) -> {
final String themeName = (String) newValue;
- if (!Config.setUiThemeSettings(requireContext(), themeName))
+ pref.setValue(themeName);
+ pref.setSummary(pref.getEntry());
+ if (!Config.setThemeSettings(requireContext(), themeName))
return true;
ThemeSwitcher.INSTANCE.restart(false);
-
- ThemeMode mode = ThemeMode.getInstance(requireContext().getApplicationContext(), themeName);
- CharSequence summary = pref.getEntries()[mode.ordinal()];
- pref.setSummary(summary);
return true;
});
}
@@ -505,32 +503,6 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment implements La
getSettingsActivity().onBackPressed();
}
- enum ThemeMode
- {
- DEFAULT(R.string.theme_default),
- NIGHT(R.string.theme_night),
- AUTO(R.string.theme_auto),
- NAV_AUTO(R.string.theme_nav_auto);
-
- private final int mModeStringId;
-
- ThemeMode(@StringRes int modeStringId)
- {
- mModeStringId = modeStringId;
- }
-
- @NonNull
- public static ThemeMode getInstance(@NonNull Context context, @NonNull String src)
- {
- for (ThemeMode each : values())
- {
- if (context.getResources().getString(each.mModeStringId).equals(src))
- return each;
- }
- return AUTO;
- }
- }
-
public enum SpeedCameraMode
{
AUTO,
diff --git a/android/app/src/main/java/app/organicmaps/util/Config.java b/android/app/src/main/java/app/organicmaps/util/Config.java
index 2f9cdbf882..068a39b9c9 100644
--- a/android/app/src/main/java/app/organicmaps/util/Config.java
+++ b/android/app/src/main/java/app/organicmaps/util/Config.java
@@ -24,7 +24,6 @@ public final class Config
private static final String KEY_MISC_KAYAK_ACCEPTED = "IsKayakApproved";
private static final String KEY_MISC_LOCATION_REQUESTED = "LocationRequested";
private static final String KEY_MISC_UI_THEME = "UiTheme";
- private static final String KEY_MISC_UI_THEME_SETTINGS = "UiThemeSettings";
private static final String KEY_MISC_USE_MOBILE_DATA = "UseMobileData";
private static final String KEY_MISC_USE_MOBILE_DATA_TIMESTAMP = "UseMobileDataTimestamp";
private static final String KEY_MISC_USE_MOBILE_DATA_ROAMING = "UseMobileDataRoaming";
@@ -253,42 +252,23 @@ public final class Config
}
@NonNull
- public static String getCurrentUiTheme(@NonNull Context context)
+ public static String getThemeSettings(@NonNull Context context)
{
- String defaultTheme = MwmApplication.from(context).getString(R.string.theme_default);
- String res = getString(KEY_MISC_UI_THEME, defaultTheme);
-
- if (ThemeUtils.isValidTheme(context, res))
+ // Fallback & default theme
+ String fallbackTheme = MwmApplication.from(context).getString(R.string.theme_follow_system);
+ String res = getString(KEY_MISC_UI_THEME, fallbackTheme);
+ if (ThemeUtils.isValidTheme(context, res) || ThemeUtils.isValidThemeMode(context, res))
return res;
- return defaultTheme;
+ return fallbackTheme;
}
- static void setCurrentUiTheme(@NonNull Context context, @NonNull String theme)
+ public static boolean setThemeSettings(@NonNull Context context, @NonNull String theme)
{
- if (getCurrentUiTheme(context).equals(theme))
- return;
-
- setString(KEY_MISC_UI_THEME, theme);
- }
-
- @NonNull
- public static String getUiThemeSettings(@NonNull Context context)
- {
- String autoTheme = MwmApplication.from(context).getString(R.string.theme_auto);
- String res = getString(KEY_MISC_UI_THEME_SETTINGS, autoTheme);
- if (ThemeUtils.isValidTheme(context, res) || ThemeUtils.isAutoTheme(context, res) || ThemeUtils.isNavAutoTheme(context, res))
- return res;
-
- return autoTheme;
- }
-
- public static boolean setUiThemeSettings(@NonNull Context context, String theme)
- {
- if (getUiThemeSettings(context).equals(theme))
+ if (getThemeSettings(context).equals(theme))
return false;
- setString(KEY_MISC_UI_THEME_SETTINGS, theme);
+ setString(KEY_MISC_UI_THEME, theme);
return true;
}
diff --git a/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java b/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java
index d70055b0f9..ecde801d5e 100644
--- a/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java
+++ b/android/app/src/main/java/app/organicmaps/util/ThemeSwitcher.java
@@ -1,61 +1,28 @@
package app.organicmaps.util;
-import android.app.Activity;
-import android.app.UiModeManager;
import android.content.Context;
+import android.content.res.Configuration;
import android.location.Location;
-import android.os.Build;
import androidx.annotation.NonNull;
+import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatDelegate;
+
+import java.util.Calendar;
+
import app.organicmaps.Framework;
-import app.organicmaps.MwmApplication;
import app.organicmaps.R;
import app.organicmaps.display.DisplayManager;
-import app.organicmaps.downloader.DownloaderStatusIcon;
import app.organicmaps.location.LocationHelper;
import app.organicmaps.routing.RoutingController;
-import app.organicmaps.util.concurrency.UiThread;
+import app.organicmaps.util.log.Logger;
public enum ThemeSwitcher
{
INSTANCE;
- private static final long CHECK_INTERVAL_MS = 30 * 60 * 1000;
private static boolean mRendererActive = false;
- private final Runnable mAutoThemeChecker = new Runnable()
- {
- @Override
- public void run()
- {
- String nightTheme = MwmApplication.from(mContext).getString(R.string.theme_night);
- String defaultTheme = MwmApplication.from(mContext).getString(R.string.theme_default);
- String theme = defaultTheme;
- Location last = LocationHelper.from(mContext).getSavedLocation();
-
- boolean navAuto = RoutingController.get().isNavigating() && ThemeUtils.isNavAutoTheme(mContext);
-
- if (navAuto || ThemeUtils.isAutoTheme(mContext))
- {
- if (last == null)
- theme = Config.getCurrentUiTheme(mContext);
- else
- {
- long currentTime = System.currentTimeMillis() / 1000;
- boolean day = Framework.nativeIsDayTime(currentTime, last.getLatitude(), last.getLongitude());
- theme = (day ? defaultTheme : nightTheme);
- }
- }
-
- setThemeAndMapStyle(theme);
- UiThread.cancelDelayedTasks(mAutoThemeChecker);
-
- if (navAuto || ThemeUtils.isAutoTheme(mContext))
- UiThread.runLater(mAutoThemeChecker, CHECK_INTERVAL_MS);
- }
- };
-
@SuppressWarnings("NotNullFieldNotInitialized")
@NonNull
private Context mContext;
@@ -74,79 +41,35 @@ public enum ThemeSwitcher
* true
only if the map is rendered and visible on the screen
* at this moment, otherwise false
.
*/
- @androidx.annotation.UiThread
+ @UiThread
public void restart(boolean isRendererActive)
{
mRendererActive = isRendererActive;
- String theme = Config.getUiThemeSettings(mContext);
- if (ThemeUtils.isAutoTheme(mContext, theme) || ThemeUtils.isNavAutoTheme(mContext, theme))
- {
- mAutoThemeChecker.run();
- return;
- }
-
- UiThread.cancelDelayedTasks(mAutoThemeChecker);
- setThemeAndMapStyle(theme);
+ String savedTheme = Config.getThemeSettings(mContext);
+ // TODO: Handle debug commands
+ String resolvedTheme = resolveBasicTheme(savedTheme);
+ int resolvedMapStyle = resolveMapStyle(resolvedTheme);
+ setAndroidTheme(resolvedTheme);
+ setMapStyle(resolvedMapStyle);
}
- private void setThemeAndMapStyle(@NonNull String theme)
+ /**
+ * Applies the android theme
+ * @param theme MUST be follow-system/theme_light/dark
+ */
+ private void setAndroidTheme(@NonNull String theme)
{
- UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE);
- String oldTheme = Config.getCurrentUiTheme(mContext);
- @Framework.MapStyle
- int oldStyle = Framework.nativeGetMapStyle();
-
- @Framework.MapStyle
- int style;
- if (ThemeUtils.isNightTheme(mContext, theme))
- {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
- uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_YES);
- else
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
-
- if (RoutingController.get().isVehicleNavigation())
- style = Framework.MAP_STYLE_VEHICLE_DARK;
- else if (Framework.nativeIsOutdoorsLayerEnabled())
- style = Framework.MAP_STYLE_OUTDOORS_DARK;
- else
- style = Framework.MAP_STYLE_DARK;
- }
+ if (ThemeUtils.isSystemTheme(mContext, theme))
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
+ else if (ThemeUtils.isNightTheme(mContext, theme))
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
+ else if (ThemeUtils.isDefaultTheme(mContext, theme))
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
else
- {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
- uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_NO);
- else
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
-
- if (RoutingController.get().isVehicleNavigation())
- style = Framework.MAP_STYLE_VEHICLE_CLEAR;
- else if (Framework.nativeIsOutdoorsLayerEnabled())
- style = Framework.MAP_STYLE_OUTDOORS_CLEAR;
- else
- style = Framework.MAP_STYLE_CLEAR;
- }
-
- if (!theme.equals(oldTheme))
- {
- Config.setCurrentUiTheme(mContext, theme);
- DownloaderStatusIcon.clearCache();
-
- final Activity a = MwmApplication.from(mContext).getTopActivity();
- if (a != null && !a.isFinishing())
- a.recreate();
- }
- else
- {
- // If the UI theme is not changed we just need to change the map style if needed.
- int currentStyle = Framework.nativeGetMapStyle();
- if (currentStyle == style)
- return;
- SetMapStyle(style);
- }
+ throw new IllegalArgumentException(theme+" passed, but only follow-system/theme_light/dark are allowed.");
}
- private void SetMapStyle(@Framework.MapStyle int style)
+ private void setMapStyle(@Framework.MapStyle int style)
{
// Because of the distinct behavior in auto theme, Android Auto employs its own mechanism for theme switching.
// For the Android Auto theme switcher, please consult the app.organicmaps.car.util.ThemeUtils module.
@@ -159,4 +82,90 @@ public enum ThemeSwitcher
else
Framework.nativeMarkMapStyle(style);
}
-}
+
+ /**
+ * resolve custom themes (auto, navauto) to basic ones (light, dark, follow-system)
+ * @return theme handle-able by android theme system.
+ */
+ private String resolveBasicTheme(@NonNull String theme)
+ {
+ if (ThemeUtils.isAutoTheme(mContext, theme))
+ return calcAutoTheme();
+ else if (ThemeUtils.isNavAutoTheme(mContext, theme))
+ {
+ // navauto should always be light, except in nav mode
+ if (RoutingController.get().isVehicleNavigation())
+ return calcAutoTheme();
+ else
+ return mContext.getResources().getString(R.string.theme_default);
+ }
+ else
+ // Passthrough for normal themes
+ return theme;
+ }
+
+ /**
+ * Resolve the map (drape) style from a resolved theme string.
+ * @param theme MUST be theme_light/dark/follow-system
+ * @return drape/core compatible map style
+ */
+ private int resolveMapStyle(@NonNull String theme)
+ {
+ // Resolve systemtheme for map style as android handles
+ // the UI so it's not really a custom theme.
+ if (ThemeUtils.isSystemTheme(mContext, theme))
+ {
+ int uiMode = mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+ theme = uiMode == Configuration.UI_MODE_NIGHT_YES
+ ? mContext.getResources().getString(R.string.theme_night)
+ : mContext.getResources().getString(R.string.theme_default);
+ }
+
+ if (ThemeUtils.isNightTheme(mContext, theme))
+ {
+ if (RoutingController.get().isVehicleNavigation())
+ return Framework.MAP_STYLE_VEHICLE_DARK;
+ else if (Framework.nativeIsOutdoorsLayerEnabled())
+ return Framework.MAP_STYLE_OUTDOORS_DARK;
+ else
+ return Framework.MAP_STYLE_DARK;
+ }
+ else if (ThemeUtils.isDefaultTheme(mContext, theme))
+ {
+ if (RoutingController.get().isVehicleNavigation())
+ return Framework.MAP_STYLE_VEHICLE_CLEAR;
+ else if (Framework.nativeIsOutdoorsLayerEnabled())
+ return Framework.MAP_STYLE_OUTDOORS_CLEAR;
+ else
+ return Framework.MAP_STYLE_CLEAR;
+ }
+ else
+ throw new IllegalArgumentException(theme +" passed, but only theme_light/dark are allowed.");
+ }
+
+ /**
+ * Determine light/dark theme based on time and location,
+ * or fall back to time-based (06:00-18:00) when there's no location fix
+ * @return theme_light/dark string
+ */
+ private String calcAutoTheme()
+ {
+ String defaultTheme = mContext.getResources().getString(R.string.theme_default);
+ String nightTheme = mContext.getResources().getString(R.string.theme_night);
+ Location last = LocationHelper.from(mContext).getSavedLocation();
+ boolean day;
+
+ if (last != null)
+ {
+ long currentTime = System.currentTimeMillis() / 1000;
+ day = Framework.nativeIsDayTime(currentTime, last.getLatitude(), last.getLongitude());
+ }
+ else
+ {
+ int currentHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
+ day = (currentHour < 18 && currentHour > 6);
+ }
+
+ return (day ? defaultTheme : nightTheme);
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java b/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java
index c121c8d313..aa8a86786b 100644
--- a/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java
+++ b/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java
@@ -7,7 +7,6 @@ import android.util.TypedValue;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
-import androidx.annotation.StyleRes;
import app.organicmaps.R;
@@ -45,49 +44,40 @@ public final class ThemeUtils
return VALUE_BUFFER.resourceId;
}
- public static boolean isDefaultTheme(@NonNull Context context)
- {
- return isDefaultTheme(context, Config.getCurrentUiTheme(context));
- }
-
public static boolean isDefaultTheme(@NonNull Context context, String theme)
{
String defaultTheme = context.getString(R.string.theme_default);
return defaultTheme.equals(theme);
}
- public static boolean isNightTheme(@NonNull Context context)
- {
- return isNightTheme(context, Config.getCurrentUiTheme(context));
- }
-
public static boolean isNightTheme(@NonNull Context context, String theme)
{
String nightTheme = context.getString(R.string.theme_night);
return nightTheme.equals(theme);
}
- public static boolean isAutoTheme(@NonNull Context context)
+ public static boolean isSystemTheme(@NonNull Context context, String theme)
{
- return isAutoTheme(context, Config.getUiThemeSettings(context));
- }
-
- public static boolean isAutoTheme(@NonNull Context context, String theme)
- {
- String autoTheme = context.getString(R.string.theme_auto);
- return autoTheme.equals(theme);
- }
-
- public static boolean isNavAutoTheme(@NonNull Context context)
- {
- return isNavAutoTheme(context, Config.getUiThemeSettings(context));
+ String followSystemTheme = context.getString(R.string.theme_follow_system);
+ return followSystemTheme.equals(theme);
}
public static boolean isNavAutoTheme(@NonNull Context context, String theme)
{
String navAutoTheme = context.getString(R.string.theme_nav_auto);
return navAutoTheme.equals(theme);
-}
+ }
+
+ public static boolean isAutoTheme(@NonNull Context context, String theme)
+ {
+ String followSystemTheme = context.getString(R.string.theme_auto);
+ return followSystemTheme.equals(theme);
+ }
+
+ public static boolean isValidThemeMode(@NonNull Context context, String res)
+ {
+ return isSystemTheme(context, res) || isNavAutoTheme(context, res) || isAutoTheme(context, res);
+ }
public static boolean isValidTheme(@NonNull Context context, String theme)
{
@@ -95,28 +85,4 @@ public final class ThemeUtils
String nightTheme = context.getString(R.string.theme_night);
return (defaultTheme.equals(theme) || nightTheme.equals(theme));
}
-
- @StyleRes
- public static int getCardBgThemeResourceId(@NonNull Context context, @NonNull String theme)
- {
- if (isDefaultTheme(context, theme))
- return R.style.MwmTheme_CardBg;
-
- if (isNightTheme(context, theme))
- return R.style.MwmTheme_Night_CardBg;
-
- throw new IllegalArgumentException("Attempt to apply unsupported theme: " + theme);
- }
-
- @StyleRes
- public static int getWindowBgThemeResourceId(@NonNull Context context, @NonNull String theme)
- {
- if (isDefaultTheme(context, theme))
- return R.style.MwmTheme_WindowBg;
-
- if (isNightTheme(context, theme))
- return R.style.MwmTheme_Night_WindowBg;
-
- throw new IllegalArgumentException("Attempt to apply unsupported theme: " + theme);
- }
}
diff --git a/android/app/src/main/java/app/organicmaps/widget/RoutingToolbarButton.java b/android/app/src/main/java/app/organicmaps/widget/RoutingToolbarButton.java
index cfad34db1f..00ba4381f6 100644
--- a/android/app/src/main/java/app/organicmaps/widget/RoutingToolbarButton.java
+++ b/android/app/src/main/java/app/organicmaps/widget/RoutingToolbarButton.java
@@ -37,10 +37,8 @@ public class RoutingToolbarButton extends AppCompatRadioButton
private void initView()
{
- setBackgroundResource(ThemeUtils.isNightTheme(getContext()) ? R.drawable.routing_toolbar_button_night
- : R.drawable.routing_toolbar_button);
- setButtonTintList(ThemeUtils.isNightTheme(getContext()) ? R.color.routing_toolbar_icon_tint_night
- : R.color.routing_toolbar_icon_tint);
+ setBackgroundResource(R.drawable.routing_toolbar_button);
+ setButtonTintList(R.color.routing_toolbar_icon_tint);
}
public void progress()
diff --git a/android/app/src/main/java/app/organicmaps/widget/placepage/EditBookmarkFragment.java b/android/app/src/main/java/app/organicmaps/widget/placepage/EditBookmarkFragment.java
index dd31a18ac1..66e4ffac81 100644
--- a/android/app/src/main/java/app/organicmaps/widget/placepage/EditBookmarkFragment.java
+++ b/android/app/src/main/java/app/organicmaps/widget/placepage/EditBookmarkFragment.java
@@ -106,7 +106,7 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
@Override
protected int getCustomTheme()
{
- return getFullscreenTheme();
+ return R.style.MwmTheme_DialogFragment_Fullscreen;
}
@Nullable
diff --git a/android/app/src/main/res/color/routing_toolbar_icon_tint.xml b/android/app/src/main/res/color/routing_toolbar_icon_tint.xml
index c324c3fdc0..0eb6cc00f4 100644
--- a/android/app/src/main/res/color/routing_toolbar_icon_tint.xml
+++ b/android/app/src/main/res/color/routing_toolbar_icon_tint.xml
@@ -2,7 +2,7 @@
+ android:color="?routingToolbarButtonIconActive"/>
diff --git a/android/app/src/main/res/color/routing_toolbar_icon_tint_night.xml b/android/app/src/main/res/color/routing_toolbar_icon_tint_night.xml
deleted file mode 100644
index 883a8200a2..0000000000
--- a/android/app/src/main/res/color/routing_toolbar_icon_tint_night.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
diff --git a/android/app/src/main/res/drawable/anim_traffic_loading_night.xml b/android/app/src/main/res/drawable-night/anim_traffic_loading.xml
similarity index 100%
rename from android/app/src/main/res/drawable/anim_traffic_loading_night.xml
rename to android/app/src/main/res/drawable-night/anim_traffic_loading.xml
diff --git a/android/app/src/main/res/drawable/bg_altitude_night.xml b/android/app/src/main/res/drawable-night/bg_altitude.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_altitude_night.xml
rename to android/app/src/main/res/drawable-night/bg_altitude.xml
diff --git a/android/app/src/main/res/drawable/bg_nav_next_next_turn_night.xml b/android/app/src/main/res/drawable-night/bg_nav_next_next_turn.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_nav_next_next_turn_night.xml
rename to android/app/src/main/res/drawable-night/bg_nav_next_next_turn.xml
diff --git a/android/app/src/main/res/drawable/bg_nav_next_turn_night.xml b/android/app/src/main/res/drawable-night/bg_nav_next_turn.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_nav_next_turn_night.xml
rename to android/app/src/main/res/drawable-night/bg_nav_next_turn.xml
diff --git a/android/app/src/main/res/drawable/bg_point_desc_night.xml b/android/app/src/main/res/drawable-night/bg_point_desc.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_point_desc_night.xml
rename to android/app/src/main/res/drawable-night/bg_point_desc.xml
diff --git a/android/app/src/main/res/drawable/bg_rounded_rect_night.xml b/android/app/src/main/res/drawable-night/bg_rounded_rect.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_rounded_rect_night.xml
rename to android/app/src/main/res/drawable-night/bg_rounded_rect.xml
diff --git a/android/app/src/main/res/drawable/bg_search_wheel_background_rect_night.xml b/android/app/src/main/res/drawable-night/bg_search_wheel_background_rect.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_search_wheel_background_rect_night.xml
rename to android/app/src/main/res/drawable-night/bg_search_wheel_background_rect.xml
diff --git a/android/app/src/main/res/drawable/bg_search_wheel_background_round_night.xml b/android/app/src/main/res/drawable-night/bg_search_wheel_background_round.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_search_wheel_background_round_night.xml
rename to android/app/src/main/res/drawable-night/bg_search_wheel_background_round.xml
diff --git a/android/app/src/main/res/drawable/bg_your_location_pin_night.xml b/android/app/src/main/res/drawable-night/bg_your_location_pin.xml
similarity index 100%
rename from android/app/src/main/res/drawable/bg_your_location_pin_night.xml
rename to android/app/src/main/res/drawable-night/bg_your_location_pin.xml
diff --git a/android/app/src/main/res/drawable/button_night.xml b/android/app/src/main/res/drawable-night/button.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_night.xml
rename to android/app/src/main/res/drawable-night/button.xml
diff --git a/android/app/src/main/res/drawable/button_accent_night.xml b/android/app/src/main/res/drawable-night/button_accent.xml
similarity index 75%
rename from android/app/src/main/res/drawable/button_accent_night.xml
rename to android/app/src/main/res/drawable-night/button_accent.xml
index 192a6af3ec..102a72b2a8 100644
--- a/android/app/src/main/res/drawable/button_accent_night.xml
+++ b/android/app/src/main/res/drawable-night/button_accent.xml
@@ -3,5 +3,5 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorBtnHighlight">
-
+
diff --git a/android/app/src/main/res/drawable/button_accent_disabled_night.xml b/android/app/src/main/res/drawable-night/button_accent_disabled.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_accent_disabled_night.xml
rename to android/app/src/main/res/drawable-night/button_accent_disabled.xml
diff --git a/android/app/src/main/res/drawable/button_accent_night_internal.xml b/android/app/src/main/res/drawable-night/button_accent_internal.xml
similarity index 50%
rename from android/app/src/main/res/drawable/button_accent_night_internal.xml
rename to android/app/src/main/res/drawable-night/button_accent_internal.xml
index 67c7755d24..d2aa33222d 100644
--- a/android/app/src/main/res/drawable/button_accent_night_internal.xml
+++ b/android/app/src/main/res/drawable-night/button_accent_internal.xml
@@ -1,9 +1,9 @@
-
-
-
+
diff --git a/android/app/src/main/res/drawable/button_accent_normal_night.xml b/android/app/src/main/res/drawable-night/button_accent_normal.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_accent_normal_night.xml
rename to android/app/src/main/res/drawable-night/button_accent_normal.xml
diff --git a/android/app/src/main/res/drawable/button_accent_pressed_night.xml b/android/app/src/main/res/drawable-night/button_accent_pressed.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_accent_pressed_night.xml
rename to android/app/src/main/res/drawable-night/button_accent_pressed.xml
diff --git a/android/app/src/main/res/drawable/button_disabled_night.xml b/android/app/src/main/res/drawable-night/button_disabled.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_disabled_night.xml
rename to android/app/src/main/res/drawable-night/button_disabled.xml
diff --git a/android/app/src/main/res/drawable/button_normal_night.xml b/android/app/src/main/res/drawable-night/button_normal.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_normal_night.xml
rename to android/app/src/main/res/drawable-night/button_normal.xml
diff --git a/android/app/src/main/res/drawable/button_pressed_night.xml b/android/app/src/main/res/drawable-night/button_pressed.xml
similarity index 100%
rename from android/app/src/main/res/drawable/button_pressed_night.xml
rename to android/app/src/main/res/drawable-night/button_pressed.xml
diff --git a/android/app/src/main/res/drawable/dot_divider_night.xml b/android/app/src/main/res/drawable-night/dot_divider.xml
similarity index 100%
rename from android/app/src/main/res/drawable/dot_divider_night.xml
rename to android/app/src/main/res/drawable-night/dot_divider.xml
diff --git a/android/app/src/main/res/drawable/ic_category_atm_night.xml b/android/app/src/main/res/drawable-night/ic_category_atm.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_atm_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_atm.xml
diff --git a/android/app/src/main/res/drawable/ic_category_bank_night.xml b/android/app/src/main/res/drawable-night/ic_category_bank.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_bank_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_bank.xml
diff --git a/android/app/src/main/res/drawable/ic_category_children_night.xml b/android/app/src/main/res/drawable-night/ic_category_children.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_children_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_children.xml
diff --git a/android/app/src/main/res/drawable/ic_category_eat_night.xml b/android/app/src/main/res/drawable-night/ic_category_eat.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_eat_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_eat.xml
diff --git a/android/app/src/main/res/drawable/ic_category_entertainment_night.xml b/android/app/src/main/res/drawable-night/ic_category_entertainment.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_entertainment_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_entertainment.xml
diff --git a/android/app/src/main/res/drawable/ic_category_food_night.xml b/android/app/src/main/res/drawable-night/ic_category_food.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_food_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_food.xml
diff --git a/android/app/src/main/res/drawable/ic_category_fuel_night.xml b/android/app/src/main/res/drawable-night/ic_category_fuel.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_fuel_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_fuel.xml
diff --git a/android/app/src/main/res/drawable/ic_category_hospital_night.xml b/android/app/src/main/res/drawable-night/ic_category_hospital.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_hospital_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_hospital.xml
diff --git a/android/app/src/main/res/drawable/ic_category_hotel_night.xml b/android/app/src/main/res/drawable-night/ic_category_hotel.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_hotel_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_hotel.xml
diff --git a/android/app/src/main/res/drawable/ic_category_luggagehero_night.xml b/android/app/src/main/res/drawable-night/ic_category_luggagehero.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_luggagehero_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_luggagehero.xml
diff --git a/android/app/src/main/res/drawable/ic_category_nightlife_night.xml b/android/app/src/main/res/drawable-night/ic_category_nightlife.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_nightlife_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_nightlife.xml
diff --git a/android/app/src/main/res/drawable/ic_category_parking_night.xml b/android/app/src/main/res/drawable-night/ic_category_parking.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_parking_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_parking.xml
diff --git a/android/app/src/main/res/drawable/ic_category_pharmacy_night.xml b/android/app/src/main/res/drawable-night/ic_category_pharmacy.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_pharmacy_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_pharmacy.xml
diff --git a/android/app/src/main/res/drawable/ic_category_police_night.xml b/android/app/src/main/res/drawable-night/ic_category_police.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_police_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_police.xml
diff --git a/android/app/src/main/res/drawable/ic_category_post_night.xml b/android/app/src/main/res/drawable-night/ic_category_post.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_post_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_post.xml
diff --git a/android/app/src/main/res/drawable/ic_category_recycling_night.xml b/android/app/src/main/res/drawable-night/ic_category_recycling.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_recycling_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_recycling.xml
diff --git a/android/app/src/main/res/drawable/ic_category_rv_night.xml b/android/app/src/main/res/drawable-night/ic_category_rv.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_rv_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_rv.xml
diff --git a/android/app/src/main/res/drawable/ic_category_secondhand_night.xml b/android/app/src/main/res/drawable-night/ic_category_secondhand.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_secondhand_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_secondhand.xml
diff --git a/android/app/src/main/res/drawable/ic_category_shopping_night.xml b/android/app/src/main/res/drawable-night/ic_category_shopping.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_shopping_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_shopping.xml
diff --git a/android/app/src/main/res/drawable/ic_category_toilet_night.xml b/android/app/src/main/res/drawable-night/ic_category_toilet.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_toilet_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_toilet.xml
diff --git a/android/app/src/main/res/drawable/ic_category_tourism_night.xml b/android/app/src/main/res/drawable-night/ic_category_tourism.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_tourism_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_tourism.xml
diff --git a/android/app/src/main/res/drawable/ic_category_transport_night.xml b/android/app/src/main/res/drawable-night/ic_category_transport.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_transport_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_transport.xml
diff --git a/android/app/src/main/res/drawable/ic_category_water_night.xml b/android/app/src/main/res/drawable-night/ic_category_water.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_water_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_water.xml
diff --git a/android/app/src/main/res/drawable/ic_category_wifi_night.xml b/android/app/src/main/res/drawable-night/ic_category_wifi.xml
similarity index 100%
rename from android/app/src/main/res/drawable/ic_category_wifi_night.xml
rename to android/app/src/main/res/drawable-night/ic_category_wifi.xml
diff --git a/android/app/src/main/res/drawable/ic_menu_location_pending_night.png b/android/app/src/main/res/drawable-night/ic_menu_location_pending.png
similarity index 100%
rename from android/app/src/main/res/drawable/ic_menu_location_pending_night.png
rename to android/app/src/main/res/drawable-night/ic_menu_location_pending.png
diff --git a/android/app/src/main/res/drawable/list_divider_night.xml b/android/app/src/main/res/drawable-night/list_divider.xml
similarity index 100%
rename from android/app/src/main/res/drawable/list_divider_night.xml
rename to android/app/src/main/res/drawable-night/list_divider.xml
diff --git a/android/app/src/main/res/drawable/routing_toolbar_button_active.xml b/android/app/src/main/res/drawable/routing_toolbar_button_active.xml
index 1d422d4e2f..93f5580705 100644
--- a/android/app/src/main/res/drawable/routing_toolbar_button_active.xml
+++ b/android/app/src/main/res/drawable/routing_toolbar_button_active.xml
@@ -3,5 +3,5 @@
android:shape="oval"
android:height="40dp"
android:width="40dp">
-
+
diff --git a/android/app/src/main/res/drawable/routing_toolbar_button_night.xml b/android/app/src/main/res/drawable/routing_toolbar_button_night.xml
deleted file mode 100644
index 0be952a4b4..0000000000
--- a/android/app/src/main/res/drawable/routing_toolbar_button_night.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- -
-
-
-
-
-
-
diff --git a/android/app/src/main/res/drawable/routing_toolbar_button_normal.xml b/android/app/src/main/res/drawable/routing_toolbar_button_normal.xml
index ebfa6cbb6a..35a47fc6a0 100644
--- a/android/app/src/main/res/drawable/routing_toolbar_button_normal.xml
+++ b/android/app/src/main/res/drawable/routing_toolbar_button_normal.xml
@@ -3,5 +3,5 @@
android:shape="oval"
android:height="40dp"
android:width="40dp">
-
+
diff --git a/android/app/src/main/res/drawable/routing_toolbar_button_normal_night.xml b/android/app/src/main/res/drawable/routing_toolbar_button_normal_night.xml
deleted file mode 100644
index 47906aacb4..0000000000
--- a/android/app/src/main/res/drawable/routing_toolbar_button_normal_night.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/android/app/src/main/res/drawable/splash.xml b/android/app/src/main/res/drawable/splash.xml
deleted file mode 100644
index 13c05b365f..0000000000
--- a/android/app/src/main/res/drawable/splash.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
diff --git a/android/app/src/main/res/layout-land/layout_nav_top.xml b/android/app/src/main/res/layout-land/layout_nav_top.xml
index 3ed8acfe81..c6cc284af4 100644
--- a/android/app/src/main/res/layout-land/layout_nav_top.xml
+++ b/android/app/src/main/res/layout-land/layout_nav_top.xml
@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_half"
android:orientation="vertical"
- android:background="?navNextTurnFrame"
+ android:background="@drawable/bg_nav_next_turn"
android:elevation="@dimen/nav_elevation">
diff --git a/android/app/src/main/res/layout/activity_splash.xml b/android/app/src/main/res/layout/activity_splash.xml
index 94da3281a2..e43bf0ab82 100644
--- a/android/app/src/main/res/layout/activity_splash.xml
+++ b/android/app/src/main/res/layout/activity_splash.xml
@@ -5,14 +5,15 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
- android:gravity="center">
+ android:gravity="center"
+ android:theme="@style/MwmTheme.Splash">
diff --git a/android/app/src/main/res/layout/current_location_marker.xml b/android/app/src/main/res/layout/current_location_marker.xml
index 50ec2a1c59..7741c329b3 100644
--- a/android/app/src/main/res/layout/current_location_marker.xml
+++ b/android/app/src/main/res/layout/current_location_marker.xml
@@ -11,7 +11,7 @@
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="?elevationProfileYourLocationPinBg"
+ android:background="@drawable/bg_your_location_pin"
android:ellipsize="end"
android:paddingStart="@dimen/margin_quarter"
android:paddingEnd="@dimen/margin_quarter"
diff --git a/android/app/src/main/res/layout/elevation_profile.xml b/android/app/src/main/res/layout/elevation_profile.xml
index e8caa071ef..59623905aa 100644
--- a/android/app/src/main/res/layout/elevation_profile.xml
+++ b/android/app/src/main/res/layout/elevation_profile.xml
@@ -23,7 +23,7 @@
android:layout_marginStart="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_quarter"
android:layout_marginEnd="@dimen/margin_base_plus"
- android:background="?altitudeBg"
+ android:background="@drawable/bg_altitude"
android:paddingStart="@dimen/margin_quarter_plus"
android:paddingTop="@dimen/margin_eighth"
android:paddingEnd="@dimen/margin_quarter_plus"
@@ -39,7 +39,7 @@
android:layout_marginStart="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_base_plus"
android:layout_marginBottom="@dimen/margin_base_plus"
- android:background="?altitudeBg"
+ android:background="@drawable/bg_altitude"
android:paddingStart="@dimen/margin_quarter_plus"
android:paddingTop="@dimen/margin_eighth"
android:paddingEnd="@dimen/margin_quarter_plus"
diff --git a/android/app/src/main/res/layout/elevation_profile_internal.xml b/android/app/src/main/res/layout/elevation_profile_internal.xml
index 564b3ade8f..993fafc75b 100644
--- a/android/app/src/main/res/layout/elevation_profile_internal.xml
+++ b/android/app/src/main/res/layout/elevation_profile_internal.xml
@@ -43,7 +43,7 @@
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/margin_quarter"
android:layout_weight="1"
- android:background="?elevationProfilePropertyBg"
+ android:background="@drawable/bg_rounded_rect"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/margin_quarter_plus">
@@ -73,7 +73,7 @@
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/margin_quarter"
android:layout_weight="1"
- android:background="?elevationProfilePropertyBg"
+ android:background="@drawable/bg_rounded_rect"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/margin_quarter_plus">
@@ -103,7 +103,7 @@
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/margin_quarter"
android:layout_weight="1"
- android:background="?elevationProfilePropertyBg"
+ android:background="@drawable/bg_rounded_rect"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/margin_quarter_plus">
@@ -132,7 +132,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
- android:background="?elevationProfilePropertyBg"
+ android:background="@drawable/bg_rounded_rect"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/margin_quarter_plus">
diff --git a/android/app/src/main/res/layout/floating_marker_view.xml b/android/app/src/main/res/layout/floating_marker_view.xml
index 6cee6ebd65..169678c9aa 100644
--- a/android/app/src/main/res/layout/floating_marker_view.xml
+++ b/android/app/src/main/res/layout/floating_marker_view.xml
@@ -38,7 +38,7 @@
android:layout_marginTop="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half"
android:layout_toEndOf="@id/floating_triangle"
- android:background="?elevationProfileSelectedPointBg"
+ android:background="@drawable/bg_point_desc"
android:elevation="@dimen/margin_eighth"
android:maxWidth="@dimen/dialog_min_height"
android:padding="@dimen/margin_quarter_plus"
diff --git a/android/app/src/main/res/layout/layout_nav_top.xml b/android/app/src/main/res/layout/layout_nav_top.xml
index 93ea3b9771..a3adf0d6d9 100644
--- a/android/app/src/main/res/layout/layout_nav_top.xml
+++ b/android/app/src/main/res/layout/layout_nav_top.xml
@@ -48,7 +48,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_half"
android:orientation="vertical"
- android:background="?navNextTurnFrame"
+ android:background="@drawable/bg_nav_next_turn"
android:elevation="@dimen/nav_elevation">
diff --git a/android/app/src/main/res/layout/map_buttons_help.xml b/android/app/src/main/res/layout/map_buttons_help.xml
index 563961dd5d..f7edc00fc7 100644
--- a/android/app/src/main/res/layout/map_buttons_help.xml
+++ b/android/app/src/main/res/layout/map_buttons_help.xml
@@ -6,4 +6,5 @@
style="@style/MwmWidget.MapButton.Square"
android:contentDescription="@string/help"
app:shapeAppearanceOverlay="@style/MwmWidget.MapButton.Square"
- app:srcCompat="@drawable/ic_question_mark" />
\ No newline at end of file
+ app:srcCompat="@drawable/logo"
+ android:tint="?helpIconTint"/>
\ No newline at end of file
diff --git a/android/app/src/main/res/values-night/themes-base.xml b/android/app/src/main/res/values-night/themes-base.xml
new file mode 100644
index 0000000000..e1753b7809
--- /dev/null
+++ b/android/app/src/main/res/values-night/themes-base.xml
@@ -0,0 +1,125 @@
+
+
+
+
diff --git a/android/app/src/main/res/values-night/themes.xml b/android/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000000..d489133669
--- /dev/null
+++ b/android/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values-v27/themes.xml b/android/app/src/main/res/values-v27/themes.xml
index 49e90150ec..e4528b86ff 100644
--- a/android/app/src/main/res/values-v27/themes.xml
+++ b/android/app/src/main/res/values-v27/themes.xml
@@ -8,11 +8,4 @@
- shortEdges
-
\ No newline at end of file
diff --git a/android/app/src/main/res/values/donottranslate.xml b/android/app/src/main/res/values/donottranslate.xml
index 976c1ecd7c..79c9be7f89 100644
--- a/android/app/src/main/res/values/donottranslate.xml
+++ b/android/app/src/main/res/values/donottranslate.xml
@@ -53,6 +53,7 @@
night
auto
nav-auto
+ follow-system
collapse
diff --git a/android/app/src/main/res/values/string-arrays.xml b/android/app/src/main/res/values/string-arrays.xml
index ee0e6210fd..1a1b7fdca7 100644
--- a/android/app/src/main/res/values/string-arrays.xml
+++ b/android/app/src/main/res/values/string-arrays.xml
@@ -24,19 +24,20 @@
- 1
-
- - @string/off
- - @string/on
- - @string/auto
+
+ - @string/follow_system
- @string/nav_auto
+ - @string/auto
+ - @string/light
+ - @string/dark
-
+
+ - @string/theme_follow_system
+ - @string/theme_nav_auto
+ - @string/theme_auto
- @string/theme_default
- @string/theme_night
- - @string/theme_auto
- - @string/theme_nav_auto
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index c6058a9554..4921bd8dd9 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -235,6 +235,14 @@
Display on the map
Night Mode
+
+ Appearance
+
+ Light
+
+ Dark
+
+ Follow System
Off
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index 2442db2747..08f0d57134 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -49,7 +49,7 @@
diff --git a/android/app/src/main/res/values/themes-attrs.xml b/android/app/src/main/res/values/themes-attrs.xml
index 75a651c16c..513dbe7ef9 100644
--- a/android/app/src/main/res/values/themes-attrs.xml
+++ b/android/app/src/main/res/values/themes-attrs.xml
@@ -5,7 +5,7 @@
-
+
@@ -15,18 +15,15 @@
+
-
-
-
-
@@ -34,19 +31,19 @@
-
-
+
+
+
-
@@ -62,12 +59,8 @@
-
-
-
-
diff --git a/android/app/src/main/res/values/themes-base.xml b/android/app/src/main/res/values/themes-base.xml
index 8aa30d5793..f438d877d0 100644
--- a/android/app/src/main/res/values/themes-base.xml
+++ b/android/app/src/main/res/values/themes-base.xml
@@ -1,6 +1,5 @@
-
-
-
-
diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml
index 47a97a0165..72ce003c8a 100644
--- a/android/app/src/main/res/values/themes.xml
+++ b/android/app/src/main/res/values/themes.xml
@@ -1,22 +1,14 @@
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
@@ -110,26 +72,6 @@
- @color/bg_dialog_translucent
-
-
-
-
-
-
@@ -166,37 +100,18 @@
- @drawable/ic_downloader_folder_done
-
-
-
-
-
-
-
-
diff --git a/android/app/src/main/res/xml/prefs_main.xml b/android/app/src/main/res/xml/prefs_main.xml
index e162e025d6..6f278ca16c 100644
--- a/android/app/src/main/res/xml/prefs_main.xml
+++ b/android/app/src/main/res/xml/prefs_main.xml
@@ -14,6 +14,13 @@
android:key="@string/pref_settings_general"
android:title="@string/prefs_group_general"
android:order="2">
+
+ android:order="2"/>
+ android:order="3"/>
+ android:order="4"/>
+ android:order="5"/>
+ android:order="9"/>
+ android:order="10"/>
+ android:order="11"/>
+ android:order="12"/>
+ android:order="13"/>
+ android:order="14"/>
+ android:key="@string/pref_map_locale"
+ android:title="@string/change_map_locale"
+ app:singleLineTitle="false"
+ android:persistent="false"
+ android:order="15"/>
-
+ android:order="1" />
+ android:order="2" />
+ android:order="3">