From 6135c19079f51a38220e25e7d108db10606af5cc Mon Sep 17 00:00:00 2001 From: Harry Bond Date: Thu, 19 Dec 2024 20:58:23 +0000 Subject: [PATCH] remove superfluous theme setting code --- .../base/BaseMwmDialogFragment.java | 35 ------------------- .../editor/HoursMinutesPickerFragment.java | 5 +-- .../java/app/organicmaps/util/ThemeUtils.java | 24 ------------- .../widget/placepage/DirectionFragment.java | 7 ---- .../placepage/EditBookmarkFragment.java | 6 ---- 5 files changed, 1 insertion(+), 76 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/base/BaseMwmDialogFragment.java b/android/app/src/main/java/app/organicmaps/base/BaseMwmDialogFragment.java index dd6a9f5777..aebb8d757e 100644 --- a/android/app/src/main/java/app/organicmaps/base/BaseMwmDialogFragment.java +++ b/android/app/src/main/java/app/organicmaps/base/BaseMwmDialogFragment.java @@ -14,46 +14,11 @@ import app.organicmaps.util.ThemeUtils; public class BaseMwmDialogFragment extends DialogFragment { - @StyleRes - protected final int getFullscreenTheme() - { - return ThemeUtils.isNightTheme(requireContext()) ? getFullscreenDarkTheme() : getFullscreenLightTheme(); - } - protected int getStyle() { return STYLE_NORMAL; } - protected @StyleRes int getCustomTheme() - { - return 0; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - int style = getStyle(); - int theme = getCustomTheme(); - if (style != STYLE_NORMAL || theme != 0) - //noinspection WrongConstant - setStyle(style, theme); - } - - @StyleRes - protected int getFullscreenLightTheme() - { - return R.style.MwmTheme_DialogFragment_Fullscreen; - } - - @StyleRes - protected int getFullscreenDarkTheme() - { - return R.style.MwmTheme_DialogFragment_Fullscreen_Night; - } - @NonNull protected Application getAppContextOrThrow() { 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..948327d89c 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) 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 8d66691289..b620518c78 100644 --- a/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java +++ b/android/app/src/main/java/app/organicmaps/util/ThemeUtils.java @@ -130,28 +130,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/placepage/DirectionFragment.java b/android/app/src/main/java/app/organicmaps/widget/placepage/DirectionFragment.java index 28cbf2b032..59cba0d921 100644 --- a/android/app/src/main/java/app/organicmaps/widget/placepage/DirectionFragment.java +++ b/android/app/src/main/java/app/organicmaps/widget/placepage/DirectionFragment.java @@ -35,13 +35,6 @@ public class DirectionFragment extends BaseMwmDialogFragment private TextView mTvDistance; private MapObject mMapObject; - - @Override - protected int getCustomTheme() - { - return R.style.MwmTheme_DialogFragment_Fullscreen_Translucent; - } - @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 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..be1696a5b6 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 @@ -103,12 +103,6 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View. public EditBookmarkFragment() {} - @Override - protected int getCustomTheme() - { - return getFullscreenTheme(); - } - @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)