1919import com .google .android .material .R ;
2020
2121import static com .google .android .material .color .MaterialColors .isColorLight ;
22- import static com .google .android .material .internal .EdgeToEdgeUtils .setLightStatusBar ;
2322
2423import android .content .Context ;
2524import android .content .res .ColorStateList ;
2625import android .content .res .TypedArray ;
2726import android .graphics .Color ;
2827import android .graphics .drawable .ColorDrawable ;
28+ import android .os .Build ;
2929import android .os .Build .VERSION ;
3030import android .os .Build .VERSION_CODES ;
3131import android .os .Bundle ;
4949import androidx .core .view .WindowInsetsCompat ;
5050import androidx .core .view .WindowInsetsControllerCompat ;
5151import androidx .core .view .accessibility .AccessibilityNodeInfoCompat ;
52+ import com .google .android .material .internal .EdgeToEdgeUtils ;
5253import 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