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

Commit 3ed2b907 authored by Michael Bestas's avatar Michael Bestas Committed by Michael Bestas
Browse files

Forward port pattern visibility settings (2/2)

Change-Id: Ic627953c5df854c442671a98b5da539b994da18b
parent 25121d47
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,14 @@
        android:key="visiblepattern"
        android:title="@string/lockpattern_settings_enable_visible_pattern_title" />

    <SwitchPreference
        android:key="visible_error_pattern"
        android:title="@string/lockpattern_settings_enable_error_path_title"/>

    <SwitchPreference
        android:key="visibledots"
        android:title="@string/lockpattern_settings_enable_dots_title"/>

    <com.android.settings.TimeoutListPreference
        android:key="lock_after_timeout"
        android:title="@string/lock_after_timeout"
+23 −3
Original line number Diff line number Diff line
@@ -995,16 +995,21 @@ public class SecuritySettings extends SettingsPreferenceFragment
            implements OnPreferenceChangeListener, OwnerInfoPreferenceController.OwnerInfoCallback {

        private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
        private static final String KEY_VISIBLE_ERROR_PATTERN = "visible_error_pattern";
        private static final String KEY_VISIBLE_DOTS = "visibledots";
        private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
        private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks";
        private static final String KEY_DIRECTLY_SHOW_LOCK = "directly_show_lock";

        // These switch preferences need special handling since they're not all stored in Settings.
        private static final String SWITCH_PREFERENCE_KEYS[] = { KEY_LOCK_AFTER_TIMEOUT,
                KEY_VISIBLE_PATTERN, KEY_POWER_INSTANTLY_LOCKS, KEY_DIRECTLY_SHOW_LOCK };
                KEY_VISIBLE_PATTERN, KEY_VISIBLE_ERROR_PATTERN, KEY_VISIBLE_DOTS,
                KEY_POWER_INSTANTLY_LOCKS, KEY_DIRECTLY_SHOW_LOCK };

        private TimeoutListPreference mLockAfter;
        private SwitchPreference mVisiblePattern;
        private SwitchPreference mVisibleErrorPattern;
        private SwitchPreference mVisibleDots;
        private SwitchPreference mPowerButtonInstantlyLocks;
        private SwitchPreference mDirectlyShowLock;

@@ -1040,8 +1045,13 @@ public class SecuritySettings extends SettingsPreferenceFragment
            createPreferenceHierarchy();

            if (mVisiblePattern != null) {
                mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled(
                        MY_USER_ID));
                mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled(MY_USER_ID));
            }
            if (mVisibleErrorPattern != null) {
                mVisibleErrorPattern.setChecked(mLockPatternUtils.isShowErrorPath(MY_USER_ID));
            }
            if (mVisibleDots != null) {
                mVisibleDots.setChecked(mLockPatternUtils.isVisibleDotsEnabled(MY_USER_ID));
            }
            if (mPowerButtonInstantlyLocks != null) {
                mPowerButtonInstantlyLocks.setChecked(
@@ -1087,6 +1097,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
            // visible pattern
            mVisiblePattern = (SwitchPreference) findPreference(KEY_VISIBLE_PATTERN);

            // visible error pattern
            mVisibleErrorPattern = (SwitchPreference) findPreference(KEY_VISIBLE_ERROR_PATTERN);

            // visible dots
            mVisibleDots = (SwitchPreference) findPreference(KEY_VISIBLE_DOTS);

            // lock instantly on power key press
            mPowerButtonInstantlyLocks = (SwitchPreference) findPreference(
                    KEY_POWER_INSTANTLY_LOCKS);
@@ -1212,6 +1228,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
                updateLockAfterPreferenceSummary();
            } else if (KEY_VISIBLE_PATTERN.equals(key)) {
                mLockPatternUtils.setVisiblePatternEnabled((Boolean) value, MY_USER_ID);
            } else if (KEY_VISIBLE_ERROR_PATTERN.equals(key)) {
                mLockPatternUtils.setShowErrorPath((Boolean) value, MY_USER_ID);
            } else if (KEY_VISIBLE_DOTS.equals(key)) {
                mLockPatternUtils.setVisibleDotsEnabled((Boolean) value, MY_USER_ID);
            }
            return true;
        }