File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed
lib/java/com/google/android/material/bottomsheet Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -90,38 +90,33 @@ public class BottomSheetDialog extends AppCompatDialog {
9090
9191 public BottomSheetDialog (@ NonNull Context context ) {
9292 this (context , 0 );
93-
94- edgeToEdgeEnabled =
95- getContext ()
96- .getTheme ()
97- .obtainStyledAttributes (new int [] {R .attr .enableEdgeToEdge })
98- .getBoolean (0 , false );
93+ initialize ();
9994 }
10095
10196 public BottomSheetDialog (@ NonNull Context context , @ StyleRes int theme ) {
10297 super (context , getThemeResId (context , theme ));
10398 // We hide the title bar for any style configuration. Otherwise, there will be a gap
10499 // above the bottom sheet when it is expanded.
105100 supportRequestWindowFeature (Window .FEATURE_NO_TITLE );
106-
107- edgeToEdgeEnabled =
108- getContext ()
109- .getTheme ()
110- .obtainStyledAttributes (new int [] {R .attr .enableEdgeToEdge })
111- .getBoolean (0 , false );
101+ initialize ();
112102 }
113103
114104 protected BottomSheetDialog (
115105 @ NonNull Context context , boolean cancelable , OnCancelListener cancelListener ) {
116106 super (context , cancelable , cancelListener );
117107 supportRequestWindowFeature (Window .FEATURE_NO_TITLE );
118108 this .cancelable = cancelable ;
109+ initialize ();
110+ }
111+
112+ private void initialize () {
113+ final TypedArray a = getContext ()
114+ .getTheme ()
115+ .obtainStyledAttributes (new int [] {R .attr .enableEdgeToEdge });
116+
117+ edgeToEdgeEnabled = a .getBoolean (0 , false );
119118
120- edgeToEdgeEnabled =
121- getContext ()
122- .getTheme ()
123- .obtainStyledAttributes (new int [] {R .attr .enableEdgeToEdge })
124- .getBoolean (0 , false );
119+ a .recycle ();
125120 }
126121
127122 @ Override
You can’t perform that action at this time.
0 commit comments