Remove unnecessary api version checks in WindowUtil (#1163)

This commit is contained in:
Andrew Gallasch 2023-04-26 14:26:00 +09:30 committed by GitHub
parent 716fc1f4fa
commit 5d552a7f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,14 +38,10 @@ public final class WindowUtil {
} }
public static void setNavigationBarColor(@NonNull Window window, @ColorInt int color) { public static void setNavigationBarColor(@NonNull Window window, @ColorInt int color) {
if (Build.VERSION.SDK_INT < 21) return;
window.setNavigationBarColor(color); window.setNavigationBarColor(color);
} }
public static void setLightStatusBarFromTheme(@NonNull Activity activity) { public static void setLightStatusBarFromTheme(@NonNull Activity activity) {
if (Build.VERSION.SDK_INT < 23) return;
final boolean isLightStatusBar = ThemeUtil.getThemedBoolean(activity, android.R.attr.windowLightStatusBar); final boolean isLightStatusBar = ThemeUtil.getThemedBoolean(activity, android.R.attr.windowLightStatusBar);
if (isLightStatusBar) setLightStatusBar(activity.getWindow()); if (isLightStatusBar) setLightStatusBar(activity.getWindow());
@ -53,20 +49,14 @@ public final class WindowUtil {
} }
public static void clearLightStatusBar(@NonNull Window window) { public static void clearLightStatusBar(@NonNull Window window) {
if (Build.VERSION.SDK_INT < 23) return;
clearSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); clearSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} }
public static void setLightStatusBar(@NonNull Window window) { public static void setLightStatusBar(@NonNull Window window) {
if (Build.VERSION.SDK_INT < 23) return;
setSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); setSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} }
public static void setStatusBarColor(@NonNull Window window, @ColorInt int color) { public static void setStatusBarColor(@NonNull Window window, @ColorInt int color) {
if (Build.VERSION.SDK_INT < 21) return;
window.setStatusBarColor(color); window.setStatusBarColor(color);
} }