Disable screen lock setting instead of hiding it when not available

parent fc86319e
......@@ -205,12 +205,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
enableBluetooth.setOnPreferenceChangeListener(this);
torNetwork.setOnPreferenceChangeListener(this);
torBlocked.setOnPreferenceChangeListener(this);
if (getActivity() != null && hasScreenLock(getActivity())) {
screenLock.setVisible(FEATURE_FLAG_PIN_LOCK);
screenLock.setOnPreferenceChangeListener(this);
} else {
screenLock.setVisible(false);
}
screenLock.setOnPreferenceChangeListener(this);
if (SDK_INT >= 21) {
notifyLockscreen.setVisible(true);
notifyLockscreen.setOnPreferenceChangeListener(this);
......@@ -231,6 +226,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
} else {
theme.setVisible(FEATURE_FLAG_DARK_THEME);
notifySignIn.setVisible(FEATURE_FLAG_SIGN_IN_REMINDER);
screenLock.setVisible(FEATURE_FLAG_PIN_LOCK);
findPreference("pref_key_explode").setVisible(false);
findPreference("pref_key_test_data").setVisible(false);
......@@ -428,7 +424,12 @@ public class SettingsFragment extends PreferenceFragmentCompat
enableBluetooth.setEnabled(enabled);
torNetwork.setEnabled(enabled);
torBlocked.setEnabled(enabled);
screenLock.setEnabled(enabled);
if (enabled && getActivity() != null && hasScreenLock(getActivity())) {
screenLock.setEnabled(true);
} else {
screenLock.setEnabled(false);
screenLock.setSummary(getString(R.string.lock_disabled));
}
notifyPrivateMessages.setEnabled(enabled);
notifyGroupMessages.setEnabled(enabled);
notifyForumPosts.setEnabled(enabled);
......
......@@ -452,5 +452,6 @@
<string name="lock_unlock">Unlock Briar</string>
<string name="lock_is_locked">Briar is locked</string>
<string name="lock_tap_to_unlock">Tap to unlock</string>
<string name="lock_disabled">Only available on Android 5 or newer and when a system screen lock is set</string>
</resources>
......@@ -61,7 +61,7 @@
android:persistent="false"
android:summary="@string/pref_lock_summary"
android:title="@string/pref_lock_title"
android:visibility="gone"/>
android:enabled="false"/>
<Preference
android:key="pref_key_change_password"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment