Refactor with WindowUtil and correct some colors.

This commit is contained in:
Alex Hart
2020-11-13 14:43:58 -04:00
committed by GitHub
parent 96e241ef9c
commit 2a193ef455
16 changed files with 38 additions and 38 deletions

View File

@@ -5,6 +5,7 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
public final class WindowUtil {
@@ -54,6 +55,12 @@ public final class WindowUtil {
setSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
public static void setStatusBarColor(@NonNull Window window, @ColorInt int color) {
if (Build.VERSION.SDK_INT < 21) return;
window.setStatusBarColor(color);
}
private static void clearSystemUiFlags(@NonNull Window window, int flags) {
View view = window.getDecorView();
int uiFlags = view.getSystemUiVisibility();