File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
pythonforandroid/recipes/android/src/android Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,20 @@ def get_heights_of_both_bars():
80
80
81
81
def get_cutout_mode ():
82
82
"""Return mode for cutout supported applications"""
83
- LayoutParams = autoclass ('android.view.WindowManager$LayoutParams' )
84
- window = mActivity .getWindow ()
85
- layout_params = window .getAttributes ()
86
- cutout_mode = layout_params .layoutInDisplayCutoutMode
87
- cutout_modes = {LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS : 'always' ,
88
- LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT : 'default' ,
89
- LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES : 'shortEdges' }
90
-
91
- return cutout_modes .get (cutout_mode , 'never' )
83
+ BuildVersion = autoclass ('android.os.Build$VERSION' )
84
+ cutout_modes = {}
85
+
86
+ if BuildVersion .SDK_INT >= 28 :
87
+ LayoutParams = autoclass ('android.view.WindowManager$LayoutParams' )
88
+ window = mActivity .getWindow ()
89
+ layout_params = window .getAttributes ()
90
+ cutout_mode = layout_params .layoutInDisplayCutoutMode
91
+ cutout_modes .update ({LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT : 'default' ,
92
+ LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES : 'shortEdges' })
93
+
94
+ if BuildVersion .SDK_INT >= 30 :
95
+ cutout_modes [LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS ] = 'always'
96
+
97
+ return cutout_modes .get (cutout_mode , 'never' )
98
+
99
+ return None
You can’t perform that action at this time.
0 commit comments