Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 21ca0fac authored by maitreya29's avatar maitreya29 Committed by Michael Bestas
Browse files

Screenrecord: Allow to reduce 3 second screen record timer

Change-Id: Ia487395c733ba609f89d84fdf934801174a40505
parent c0034917
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7L11,7v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>
+47 −0
Original line number Diff line number Diff line
@@ -179,4 +179,51 @@
            style="@style/ScreenRecord.Switch"
            android:importantForAccessibility="yes" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/show_skip_time"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_marginTop="@dimen/screenrecord_option_padding">
        <ImageView
            android:layout_width="@dimen/screenrecord_option_icon_size"
            android:layout_height="@dimen/screenrecord_option_icon_size"
            android:src="@drawable/ic_sr_clock"
            android:tint="?android:attr/textColorSecondary"
            android:layout_marginRight="@dimen/screenrecord_option_padding"
            android:importantForAccessibility="no"/>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:minHeight="48dp"
            android:layout_weight="1"
            android:orientation="vertical">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@*android:string/config_bodyFontFamily"
                android:text="@string/screenrecord_skip_time_label"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="?android:attr/textColorPrimary"
                android:contentDescription="@string/screenrecord_skip_time_label"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:importantForAccessibility="no"
                android:fontFamily="@*android:string/config_bodyFontFamily"
                android:text="@string/screenrecord_skip_time_summary"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="?android:textColorSecondary"/>
        </LinearLayout>

        <Switch
            android:layout_width="wrap_content"
            android:minWidth="48dp"
            android:layout_height="48dp"
            android:id="@+id/screenrecord_skip_time_switch"
            android:contentDescription="@string/screenrecord_skip_time_label"
            style="@style/ScreenRecord.Switch"
            android:importantForAccessibility="yes" />
    </LinearLayout>
</LinearLayout>
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -122,4 +122,6 @@
    <string name="screenrecord_lowquality_summary">For smaller file size</string>
    <string name="screenrecord_longer_timeout_switch_label">Larger file size limit</string>
    <string name="screenrecord_longer_timeout_switch_summary">Limit recording size to 15 GB</string>
    <string name="screenrecord_skip_time_label">Skip timer</string>
    <string name="screenrecord_skip_time_summary">Remove the 3 second wait</string>
</resources>
+6 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ class ScreenRecordPermissionContentManager(
    private lateinit var audioSwitch: Switch
    private lateinit var lowQualitySwitch: Switch
    private lateinit var longerDurationSwitch: Switch
    private lateinit var skipTimeSwitch: Switch
    private lateinit var tapsView: View
    private lateinit var options: Spinner

@@ -156,6 +157,7 @@ class ScreenRecordPermissionContentManager(
        tapsSwitch = containerView.requireViewById(R.id.screenrecord_taps_switch)
        lowQualitySwitch = containerView.requireViewById(R.id.screenrecord_lowquality_switch)
        longerDurationSwitch = containerView.requireViewById(R.id.screenrecord_longer_timeout_switch)
        skipTimeSwitch = containerView.requireViewById(R.id.screenrecord_skip_time_switch)

        tapsView = containerView.requireViewById(R.id.show_taps)
        updateTapsViewVisibility()
@@ -166,6 +168,7 @@ class ScreenRecordPermissionContentManager(
        tapsSwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }
        lowQualitySwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }
        longerDurationSwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }
        skipTimeSwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }

        options = containerView.requireViewById(R.id.screen_recording_options)
        val a: ArrayAdapter<*> =
@@ -245,7 +248,8 @@ class ScreenRecordPermissionContentManager(
                RecordingService.getStopIntent(userContext),
                PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
            )
        controller.startCountdown(DELAY_MS, INTERVAL_MS, startIntent, stopIntent)
        controller.startCountdown(if (skipTimeSwitch.isChecked) NO_DELAY else DELAY_MS,
                INTERVAL_MS, startIntent, stopIntent)
    }

    private inner class CaptureTargetResultReceiver :
@@ -273,6 +277,7 @@ class ScreenRecordPermissionContentManager(
            )

        private const val DELAY_MS: Long = 3000
        private const val NO_DELAY: Long = 100
        private const val INTERVAL_MS: Long = 1000

        fun createOptionList(displayManager: DisplayManager): List<ScreenShareOption> {