mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Add reset education screens preference
This commit is contained in:
1 parent
761d9a1883
commit
cd0d712f56
7 files changed
+44
-3
No files matched your search
@@ -70,6 +70,8 @@ public class GroupActivity extends ListNodesActivity
|
||||
|
||||
private static final String GROUP_ID_KEY = "GROUP_ID_KEY";
|
||||
|
||||
private Toolbar toolbar;
|
||||
|
||||
private AddNodeButtonView addNodeButtonView;
|
||||
|
||||
protected boolean addGroupEnabled = false;
|
||||
@@ -145,7 +147,7 @@ public class GroupActivity extends ListNodesActivity
|
||||
RecyclerView recyclerView = findViewById(R.id.nodes_list);
|
||||
recyclerView.addOnScrollListener(addNodeButtonView.hideButtonOnScrollListener());
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
toolbar.setTitle("");
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@@ -169,8 +171,6 @@ public class GroupActivity extends ListNodesActivity
|
||||
if (isRoot) {
|
||||
showWarnings();
|
||||
}
|
||||
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
protected PwGroup initCurrentGroup() {
|
||||
@@ -261,6 +261,8 @@ public class GroupActivity extends ListNodesActivity
|
||||
super.onResume();
|
||||
// Show button on resume
|
||||
addNodeButtonView.showButton();
|
||||
|
||||
checkAndPerformedEducation();
|
||||
}
|
||||
|
||||
private void checkAndPerformedEducation() {
|
||||
@@ -272,6 +274,11 @@ public class GroupActivity extends ListNodesActivity
|
||||
getString(R.string.education_new_node_title),
|
||||
getString(R.string.education_new_node_summary))
|
||||
.tintTarget(false)
|
||||
/* TODO Search education
|
||||
TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search,
|
||||
getString(R.string.education_search_title),
|
||||
getString(R.string.education_search_summary))
|
||||
*/
|
||||
).listener(new TapTargetSequence.Listener() {
|
||||
@Override
|
||||
public void onSequenceFinish() {
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.keepassdroid.settings;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@@ -200,6 +201,19 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
Preference resetEducationScreens = findPreference(getString(R.string.reset_education_screens_key));
|
||||
resetEducationScreens.setOnPreferenceClickListener(preference -> {
|
||||
SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(getContext());
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
for (int resourceId : PreferencesUtil.educationResourceKeys) {
|
||||
editor.putBoolean(getString(resourceId), false);
|
||||
}
|
||||
editor.apply();
|
||||
Toast.makeText(getContext(), R.string.reset_education_screens_text, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case NESTED_SCREEN_FORM_FILLING_KEY:
|
||||
|
||||
@@ -145,6 +145,9 @@ public class PreferencesUtil {
|
||||
ctx.getResources().getBoolean(R.bool.allow_copy_password_default));
|
||||
}
|
||||
|
||||
public static int[] educationResourceKeys = new int[] {
|
||||
R.string.education_select_db_key, R.string.education_group_key};
|
||||
|
||||
public static boolean isEducationSelectDatabasePerformed(Context context) {
|
||||
SharedPreferences prefs = getEducationSharedPreferences(context);
|
||||
return prefs.getBoolean(context.getString(R.string.education_select_db_key),
|
||||
|
||||
Reference in new issue
Block a user