mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Add option for back lock
This commit is contained in:
@@ -1214,7 +1214,19 @@ public class GroupActivity extends LockingActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
super.onBackPressed();
|
|
||||||
|
// Normal way when we are not in root
|
||||||
|
if (!rootGroup.equals(mCurrentGroup))
|
||||||
|
super.onBackPressed();
|
||||||
|
// Else lock if needed
|
||||||
|
else {
|
||||||
|
if (PreferencesUtil.isLockDatabaseWhenBackButtonOnRootClicked(this)) {
|
||||||
|
App.getDB().clear(getApplicationContext());
|
||||||
|
super.onBackPressed();
|
||||||
|
} else {
|
||||||
|
moveTaskToBack(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
listNodesFragment = (ListNodesFragment) getSupportFragmentManager().findFragmentByTag(LIST_NODES_FRAGMENT_TAG);
|
listNodesFragment = (ListNodesFragment) getSupportFragmentManager().findFragmentByTag(LIST_NODES_FRAGMENT_TAG);
|
||||||
// to refresh fragment
|
// to refresh fragment
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package com.kunzisoft.keepass.settings;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.TypedValue;
|
|
||||||
|
|
||||||
import com.kunzisoft.keepass.R;
|
import com.kunzisoft.keepass.R;
|
||||||
import com.kunzisoft.keepass.database.SortNodeEnum;
|
import com.kunzisoft.keepass.database.SortNodeEnum;
|
||||||
@@ -99,6 +98,12 @@ public class PreferencesUtil {
|
|||||||
ctx.getResources().getBoolean(R.bool.lock_database_screen_off_default));
|
ctx.getResources().getBoolean(R.bool.lock_database_screen_off_default));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLockDatabaseWhenBackButtonOnRootClicked(Context ctx) {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
|
return prefs.getBoolean(ctx.getString(R.string.lock_database_back_root_key),
|
||||||
|
ctx.getResources().getBoolean(R.bool.lock_database_back_root_default));
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFingerprintEnable(Context ctx) {
|
public static boolean isFingerprintEnable(Context ctx) {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
return prefs.getBoolean(ctx.getString(R.string.fingerprint_enable_key),
|
return prefs.getBoolean(ctx.getString(R.string.fingerprint_enable_key),
|
||||||
|
|||||||
@@ -76,6 +76,8 @@
|
|||||||
<string name="app_timeout_key" translatable="false">app_timeout_key</string>
|
<string name="app_timeout_key" translatable="false">app_timeout_key</string>
|
||||||
<string name="lock_database_screen_off_key" translatable="false">lock_database_screen_off_key</string>
|
<string name="lock_database_screen_off_key" translatable="false">lock_database_screen_off_key</string>
|
||||||
<bool name="lock_database_screen_off_default" translatable="false">true</bool>
|
<bool name="lock_database_screen_off_default" translatable="false">true</bool>
|
||||||
|
<string name="lock_database_back_root_key" translatable="false">lock_database_back_root_key</string>
|
||||||
|
<bool name="lock_database_back_root_default" translatable="false">true</bool>
|
||||||
<string name="password_length_key" translatable="false">password_length_key</string>
|
<string name="password_length_key" translatable="false">password_length_key</string>
|
||||||
<string name="list_password_generator_options_key" translatable="false">list_password_generator_options_key</string>
|
<string name="list_password_generator_options_key" translatable="false">list_password_generator_options_key</string>
|
||||||
<string name="maskpass_key" translatable="false">maskpass</string>
|
<string name="maskpass_key" translatable="false">maskpass</string>
|
||||||
|
|||||||
@@ -230,6 +230,8 @@
|
|||||||
<string name="lock">Lock</string>
|
<string name="lock">Lock</string>
|
||||||
<string name="lock_database_screen_off_title">Screen lock</string>
|
<string name="lock_database_screen_off_title">Screen lock</string>
|
||||||
<string name="lock_database_screen_off_summary">Lock the database when the screen is off</string>
|
<string name="lock_database_screen_off_summary">Lock the database when the screen is off</string>
|
||||||
|
<string name="lock_database_back_root_title">Back lock</string>
|
||||||
|
<string name="lock_database_back_root_summary">Lock the database when the user clicks the back button on the root screen</string>
|
||||||
<string name="fingerprint_quick_unlock_title">How to set up fingerprint scanning for quick unlocking?</string>
|
<string name="fingerprint_quick_unlock_title">How to set up fingerprint scanning for quick unlocking?</string>
|
||||||
<string name="fingerprint_setting_text">Save your scanned fingerprint for your device in </string>
|
<string name="fingerprint_setting_text">Save your scanned fingerprint for your device in </string>
|
||||||
<!-- Use ← for LTR languages -->
|
<!-- Use ← for LTR languages -->
|
||||||
|
|||||||
@@ -63,6 +63,11 @@
|
|||||||
android:title="@string/lock_database_screen_off_title"
|
android:title="@string/lock_database_screen_off_title"
|
||||||
android:summary="@string/lock_database_screen_off_summary"
|
android:summary="@string/lock_database_screen_off_summary"
|
||||||
android:defaultValue="@bool/lock_database_screen_off_default"/>
|
android:defaultValue="@bool/lock_database_screen_off_default"/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="@string/lock_database_back_root_key"
|
||||||
|
android:title="@string/lock_database_back_root_title"
|
||||||
|
android:summary="@string/lock_database_back_root_summary"
|
||||||
|
android:defaultValue="@bool/lock_database_back_root_default"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user