File tree Expand file tree Collapse file tree 1 file changed +9
-20
lines changed
pythonforandroid/recipes/android/src/android Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -80,23 +80,12 @@ def get_heights_of_both_bars():
8080
8181def get_cutout_mode ():
8282 " Return mode for cutout supported applications "
83- mode = 'never'
84-
85- try :
86- LayoutParams = autoclass ('android.view.WindowManager$LayoutParams' )
87- window = mActivity .getWindow ()
88- layout_params = window .getAttributes ()
89- cutout_mode = layout_params .layoutInDisplayCutoutMode
90-
91- if cutout_mode == LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS :
92- mode = 'always'
93- elif cutout_mode == LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT :
94- mode = 'default'
95- elif cutout_mode == LayoutParams .LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :
96- mode = 'shortEdges'
97-
98- except Exception :
99- # Something went wrong
100- pass
101-
102- return mode
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' )
You can’t perform that action at this time.
0 commit comments