mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-27 07:24:13 +01:00
Use switch preference for enabling app lock
This commit is contained in:
parent
0544fe4620
commit
fe8cb18c54
5 changed files with 9 additions and 20 deletions
|
@ -708,7 +708,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
// Check if lock is set
|
||||
if (getBooleanPreference("app_is_locked", R.bool.app_is_locked)) {
|
||||
if (getBooleanPreference("app_lock_enabled", R.bool.app_lock_enabled)) {
|
||||
Intent intent = new Intent(this, UnlockActivity.class);
|
||||
startActivityForResult(intent, REQUEST_CODE_ULOCK);
|
||||
}
|
||||
|
|
|
@ -948,19 +948,6 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
|
|||
});
|
||||
}
|
||||
|
||||
final Preference appUnLockPreference = mSettingsFragment.findPreference("app_lock_disabled");
|
||||
if (appUnLockPreference != null) {
|
||||
appUnLockPreference.setOnPreferenceClickListener(preference -> {
|
||||
try {
|
||||
SharedPreferences preferences = this.getPreferences();
|
||||
preferences.edit().putBoolean(APP_IS_LOCKED, false).apply();
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Toast.makeText(this, R.string.can_not_remove_lock, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
final Preference prefereXmppAvatarPreference = mSettingsFragment.findPreference(PREFER_XMPP_AVATAR);
|
||||
if (prefereXmppAvatarPreference != null) {
|
||||
prefereXmppAvatarPreference.setOnPreferenceClickListener(preference -> {
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
<bool name="hide_donation_snackbar">false</bool>
|
||||
<bool name="send_link_previews">true</bool>
|
||||
<bool name="app_is_locked">false</bool>
|
||||
<bool name="app_lock_enabled">false</bool>
|
||||
</resources>
|
|
@ -1417,6 +1417,6 @@
|
|||
<string name="pref_app_lock_summary">Lock the app with a pin or fingerprint. Monocles chat will be locked after closed and can only be opened with the right pin or fingerprint again</string>
|
||||
<string name="can_not_create_lock">Can\'t create pin or fingerprint</string>
|
||||
<string name="can_not_remove_lock">Can not remove lock</string>
|
||||
<string name="pref_app_lock_disable_title">Disable app lock</string>
|
||||
<string name="pref_app_lock_disable_summary">Disable the app lock</string>
|
||||
<string name="pref_app_lock_enable_title">Enable app lock</string>
|
||||
<string name="pref_app_lock_enable_summary">Enable the app lock. Be aware you can\'t open the app anymore when you forgot the PIN.</string>
|
||||
</resources>
|
||||
|
|
|
@ -710,10 +710,11 @@
|
|||
android:key="app_lock"
|
||||
android:summary="@string/pref_app_lock_summary"
|
||||
android:title="@string/pref_app_lock_title" />
|
||||
<Preference
|
||||
android:key="app_lock_disabled"
|
||||
android:summary="@string/pref_app_lock_disable_summary"
|
||||
android:title="@string/pref_app_lock_disable_title" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="@bool/app_lock_enabled"
|
||||
android:key="app_lock_enabled"
|
||||
android:summary="@string/pref_app_lock_enable_summary"
|
||||
android:title="@string/pref_app_lock_enable_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="connection_options"
|
||||
|
|
Loading…
Add table
Reference in a new issue