Skip to content

Commit

Permalink
Clipboard auto-clear timeout setting
Browse files Browse the repository at this point in the history
  • Loading branch information
secrecyflag committed Apr 3, 2023
1 parent 38a0b70 commit 38dd4d2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions res/values/strings_ext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
<string name="privileged_euicc_management_title">Enable privileged eSIM management</string>
<string name="privileged_euicc_management_summary">Requires sandboxed Google Play installation</string>

<string name="clipboard_auto_clear_title">Clipboard auto clear</string>
<string name="clipboard_auto_clear_summary">Automatically clear the clipboard after a selected duration of time</string>

</resources>
7 changes: 7 additions & 0 deletions res/xml/privacy_dashboard_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
android:summary="@string/screenshot_timestamp_exif_summary"
settings:boolSettingField="android.ext.settings.ExtSettings SCREENSHOT_TIMESTAMP_EXIF"/>

<!-- Clipboard auto clear -->
<ListPreference
android:key="clipboard_auto_clear_timeout"
android:title="@string/clipboard_auto_clear_title"
android:summary="@string/clipboard_auto_clear_summary"
settings:controller="com.android.settings.privacy.ClipboardTimeoutController"/>

<!-- Show passwords -->
<SwitchPreference
android:key="show_password"
Expand Down
33 changes: 33 additions & 0 deletions src/com/android/settings/privacy/ClipboardTimeoutController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.android.settings.privacy;

import android.content.Context;
import android.ext.settings.ExtSettings;

import com.android.settings.ext.IntSettingPrefController;
import com.android.settings.R;

import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;

public class ClipboardTimeoutController extends IntSettingPrefController {

public ClipboardTimeoutController(Context ctx, String key) {
super(ctx, key, ExtSettings.CLIPBOARD_AUTO_CLEAR_TIMEOUT);
}

@Override
protected void getEntries(Entries entries) {
entries.add(R.string.switch_off_text, 0);
entries.add(10, SECONDS);
entries.add(30, SECONDS);
entries.add(1, MINUTES);
entries.add(5, MINUTES);
entries.add(10, MINUTES);
entries.add(30, MINUTES);
entries.add(1, HOURS);
entries.add(2, HOURS);
entries.add(4, HOURS);
entries.add(8, HOURS);
}
}

0 comments on commit 38dd4d2

Please sign in to comment.