fix window insets after granting permissions
This commit is contained in:
parent
815287b9b2
commit
5085a1388d
|
@ -82,7 +82,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
|
||||||
|
|
||||||
initVariables()
|
initVariables()
|
||||||
tryInitCamera()
|
tryInitCamera()
|
||||||
|
@ -298,6 +297,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
defaultScene = Scene(top_options, default_icons)
|
defaultScene = Scene(top_options, default_icons)
|
||||||
flashModeScene = Scene(top_options, flash_toggle_group)
|
flashModeScene = Scene(top_options, flash_toggle_group)
|
||||||
|
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(view_holder) { _, windowInsets ->
|
ViewCompat.setOnApplyWindowInsetsListener(view_holder) { _, windowInsets ->
|
||||||
val safeInsetBottom = windowInsets.displayCutout?.safeInsetBottom ?: 0
|
val safeInsetBottom = windowInsets.displayCutout?.safeInsetBottom ?: 0
|
||||||
val safeInsetTop = windowInsets.displayCutout?.safeInsetTop ?: 0
|
val safeInsetTop = windowInsets.displayCutout?.safeInsetTop ?: 0
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:background="@android:color/black"
|
android:background="@android:color/black">
|
||||||
android:fitsSystemWindows="true">
|
|
||||||
|
|
||||||
<androidx.camera.view.PreviewView
|
<androidx.camera.view.PreviewView
|
||||||
android:id="@+id/preview_view"
|
android:id="@+id/preview_view"
|
||||||
|
|
Loading…
Reference in New Issue