mirror of
				https://github.com/SimpleMobileTools/Simple-Camera.git
				synced 2025-06-27 09:02:59 +02:00 
			
		
		
		
	make preview fill up to the cutoff (notch)
- add theme attribute android:windowLayoutInDisplayCutoutMode to shortEdges in the theme - add flags FLAG_LAYOUT_NO_LIMITS to the window flags - add top margin to the icons on top, set to the statusBarHeight - add bottom margin to the icons at the bottom, set to the navigationBarHeight + view margin
This commit is contained in:
		@@ -64,16 +64,21 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
 | 
			
		||||
            setShowWhenLocked(true)
 | 
			
		||||
            setTurnScreenOn(true)
 | 
			
		||||
            window.insetsController?.hide(WindowInsets.Type.statusBars())
 | 
			
		||||
            window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
 | 
			
		||||
        } else if (isOreoMr1Plus()) {
 | 
			
		||||
            setShowWhenLocked(true)
 | 
			
		||||
            setTurnScreenOn(true)
 | 
			
		||||
            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
 | 
			
		||||
            window.addFlags(
 | 
			
		||||
                WindowManager.LayoutParams.FLAG_FULLSCREEN or
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
 | 
			
		||||
            )
 | 
			
		||||
        } else {
 | 
			
		||||
            window.addFlags(
 | 
			
		||||
                WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_FULLSCREEN
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_FULLSCREEN or
 | 
			
		||||
                    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -214,6 +219,16 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
 | 
			
		||||
        setContentView(R.layout.activity_main)
 | 
			
		||||
        initButtons()
 | 
			
		||||
 | 
			
		||||
        (toggle_photo_video.layoutParams as ConstraintLayout.LayoutParams).setMargins(
 | 
			
		||||
            0,
 | 
			
		||||
            statusBarHeight,
 | 
			
		||||
            0,
 | 
			
		||||
            0,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        val goneMargin = (navigationBarHeight + resources.getDimension(R.dimen.big_margin)).toInt()
 | 
			
		||||
        (shutter.layoutParams as ConstraintLayout.LayoutParams).goneBottomMargin = goneMargin
 | 
			
		||||
 | 
			
		||||
        (video_rec_curr_timer.layoutParams as ConstraintLayout.LayoutParams).setMargins(
 | 
			
		||||
            0,
 | 
			
		||||
            0,
 | 
			
		||||
 
 | 
			
		||||
@@ -30,18 +30,31 @@
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="parent" />
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/settings"
 | 
			
		||||
        android:id="@+id/toggle_photo_video"
 | 
			
		||||
        android:layout_width="@dimen/icon_size"
 | 
			
		||||
        android:layout_height="@dimen/icon_size"
 | 
			
		||||
        android:contentDescription="@string/settings"
 | 
			
		||||
        android:contentDescription="@string/toggle_photo_video"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_settings_cog_vector"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/change_resolution"
 | 
			
		||||
        android:src="@drawable/ic_video_vector"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/toggle_flash"
 | 
			
		||||
        app:layout_constraintHorizontal_chainStyle="spread"
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="parent" />
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/toggle_flash"
 | 
			
		||||
        android:layout_width="@dimen/icon_size"
 | 
			
		||||
        android:layout_height="@dimen/icon_size"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:contentDescription="@string/toggle_flash"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_flash_off_vector"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/change_resolution"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/toggle_photo_video"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/toggle_photo_video" />
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/change_resolution"
 | 
			
		||||
@@ -52,32 +65,20 @@
 | 
			
		||||
        android:contentDescription="@string/resolution"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_resolution_vector"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/toggle_flash"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/settings"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/settings" />
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/toggle_flash"
 | 
			
		||||
        android:layout_width="@dimen/icon_size"
 | 
			
		||||
        android:layout_height="@dimen/icon_size"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:contentDescription="@string/toggle_flash"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_flash_off_vector"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/toggle_photo_video"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/change_resolution"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/settings" />
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/toggle_photo_video"
 | 
			
		||||
        android:layout_width="@dimen/icon_size"
 | 
			
		||||
        android:layout_height="@dimen/icon_size"
 | 
			
		||||
        android:contentDescription="@string/toggle_photo_video"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_video_vector"
 | 
			
		||||
        app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/settings"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/toggle_flash"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/settings" />
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/toggle_photo_video" />
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/settings"
 | 
			
		||||
        android:layout_width="@dimen/icon_size"
 | 
			
		||||
        android:layout_height="@dimen/icon_size"
 | 
			
		||||
        android:contentDescription="@string/settings"
 | 
			
		||||
        android:padding="@dimen/normal_margin"
 | 
			
		||||
        android:src="@drawable/ic_settings_cog_vector"
 | 
			
		||||
        app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/change_resolution"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="@id/toggle_photo_video" />
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <androidx.constraintlayout.widget.Barrier
 | 
			
		||||
@@ -121,7 +122,6 @@
 | 
			
		||||
        app:layout_constraintBottom_toTopOf="@id/video_rec_curr_timer"
 | 
			
		||||
        app:layout_constraintEnd_toStartOf="@id/last_photo_video_preview"
 | 
			
		||||
        app:layout_constraintStart_toEndOf="@id/toggle_camera"
 | 
			
		||||
 | 
			
		||||
        app:layout_constraintVertical_bias="1"
 | 
			
		||||
        app:layout_goneMarginBottom="@dimen/big_margin" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<resources>
 | 
			
		||||
 | 
			
		||||
    <style name="AppTheme" parent="AppTheme.Base"/>
 | 
			
		||||
    <style name="AppTheme" parent="AppTheme.Base" />
 | 
			
		||||
 | 
			
		||||
    <style name="FullScreenTheme" parent="AppTheme">
 | 
			
		||||
        <item name="android:windowContentOverlay">@null</item>
 | 
			
		||||
        <item name="android:windowTranslucentNavigation">true</item>
 | 
			
		||||
        <item name="android:windowTranslucentStatus">true</item>
 | 
			
		||||
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user