split autotheme into new function

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond 2024-12-28 13:37:44 +00:00
parent 7ecf0ba840
commit db3c88f62f

View file

@ -105,24 +105,22 @@ public enum ThemeSwitcher
}
/**
* Convert custom themes (auto, navauto) to default ones (light, dark, follow-system)
* Process custom themes (auto, navauto) to default ones (light, dark, follow-system)
* @return theme handle-able by android theme system.
*/
private String resolveCustomThemes(@NonNull String theme)
{
if (ThemeUtils.isAutoTheme(mContext, theme))
{
//TODO: Proper behaviour
return mContext.getResources().getString(R.string.theme_night);
}
return calcAutoTheme();
else if (ThemeUtils.isNavAutoTheme(mContext, theme))
{
//TODO: Proper behaviour
return mContext.getResources().getString(R.string.theme_night);
if (RoutingController.get().isVehicleNavigation())
return calcAutoTheme();
else
return mContext.getResources().getString(R.string.theme_default);
}
else
// Passthrough for normal themes
return theme;
// Passthrough for normal themes
return theme;
}
private int resolveMapStyle(@NonNull String theme)
@ -150,4 +148,10 @@ public enum ThemeSwitcher
return style;
}
private String calcAutoTheme()
{
//TODO: Proper behaviour - return light or dark based on time
return mContext.getResources().getString(R.string.theme_night);
}
}