Skip to content

Commit 6fe0c8d

Browse files
authored
Merge pull request #4209 from wordpress-mobile/issue/add-passcodelock-switch
Change generic preference to switch for passcode
2 parents a390aaf + e33e9fd commit 6fe0c8d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import android.app.FragmentManager;
44
import android.os.Bundle;
55
import android.preference.Preference;
6+
import android.preference.SwitchPreference;
67
import android.support.v7.app.ActionBar;
78
import android.support.v7.app.AppCompatActivity;
89
import android.view.MenuItem;
910

1011
import org.wordpress.android.ui.ActivityLauncher;
12+
import org.wordpress.passcodelock.AppLockManager;
1113
import org.wordpress.passcodelock.PasscodePreferenceFragment;
1214

1315
public class AppSettingsActivity extends AppCompatActivity {
@@ -56,6 +58,8 @@ public void onStart() {
5658

5759
if (togglePref != null && changePref != null) {
5860
mPasscodePreferenceFragment.setPreferences(togglePref, changePref);
61+
((SwitchPreference) togglePref).setChecked(
62+
AppLockManager.getInstance().getAppLock().isPasswordLocked());
5963
}
6064
}
6165

WordPress/src/main/res/xml/app_settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
android:persistent="false"
3535
android:title="@string/passcode_preference_title">
3636

37-
<Preference
37+
<SwitchPreference
3838
android:key="@string/pref_key_passcode_toggle"
3939
android:layout="@layout/preference_layout"
4040
android:persistent="false"

0 commit comments

Comments
 (0)