Skip to content

Commit 53086a0

Browse files
drchenafohrman
authored andcommitted
[BottomSheet] Add back accidentally removed setLightStatusBar method and annotate it as deprecated
PiperOrigin-RevId: 450696352
1 parent 66581f2 commit 53086a0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lib/java/com/google/android/material/bottomsheet/BottomSheetDialog.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
import com.google.android.material.R;
2020

2121
import static com.google.android.material.color.MaterialColors.isColorLight;
22-
import static com.google.android.material.internal.EdgeToEdgeUtils.setLightStatusBar;
2322

2423
import android.content.Context;
2524
import android.content.res.ColorStateList;
2625
import android.content.res.TypedArray;
2726
import android.graphics.Color;
2827
import android.graphics.drawable.ColorDrawable;
28+
import android.os.Build;
2929
import android.os.Build.VERSION;
3030
import android.os.Build.VERSION_CODES;
3131
import android.os.Bundle;
@@ -49,6 +49,7 @@
4949
import androidx.core.view.WindowInsetsCompat;
5050
import androidx.core.view.WindowInsetsControllerCompat;
5151
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
52+
import com.google.android.material.internal.EdgeToEdgeUtils;
5253
import com.google.android.material.shape.MaterialShapeDrawable;
5354

5455
/**
@@ -484,7 +485,8 @@ private void setPaddingForPosition(View bottomSheet) {
484485
// If the bottomsheet is light, we should set light status bar so the icons are visible
485486
// since the bottomsheet is now under the status bar.
486487
if (window != null) {
487-
setLightStatusBar(window, lightBottomSheet == null ? lightStatusBar : lightBottomSheet);
488+
EdgeToEdgeUtils.setLightStatusBar(
489+
window, lightBottomSheet == null ? lightStatusBar : lightBottomSheet);
488490
}
489491
// Smooth transition into status bar when drawing edge to edge.
490492
bottomSheet.setPadding(
@@ -496,7 +498,7 @@ private void setPaddingForPosition(View bottomSheet) {
496498
// Reset the status bar icons to the original color because the bottomsheet is not under the
497499
// status bar.
498500
if (window != null) {
499-
setLightStatusBar(window, lightStatusBar);
501+
EdgeToEdgeUtils.setLightStatusBar(window, lightStatusBar);
500502
}
501503
bottomSheet.setPadding(
502504
bottomSheet.getPaddingLeft(),
@@ -506,4 +508,20 @@ private void setPaddingForPosition(View bottomSheet) {
506508
}
507509
}
508510
}
511+
512+
/**
513+
* @deprecated use {@link EdgeToEdgeUtils#setLightStatusBar(Window, boolean)} instead
514+
*/
515+
@Deprecated
516+
public static void setLightStatusBar(@NonNull View view, boolean isLight) {
517+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
518+
int flags = view.getSystemUiVisibility();
519+
if (isLight) {
520+
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
521+
} else {
522+
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
523+
}
524+
view.setSystemUiVisibility(flags);
525+
}
526+
}
509527
}

0 commit comments

Comments
 (0)