remove superfluous theme setting code

This commit is contained in:
Harry Bond 2024-12-19 20:58:23 +00:00
parent e6670730d9
commit 6135c19079
5 changed files with 1 additions and 76 deletions

View file

@ -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()
{

View file

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

View file

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

View file

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

View file

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