Add reset education screens preference

This commit is contained in:
J-Jamet committed 2018-04-01 00:37:30 +02:00
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),
+3
View File
@@ -249,6 +249,9 @@
<string name="warning_disabling_storage_access_framework">ATTENTION : désactiver cette fonctionnalité peut engendrer une impossibilité d\'ouvrir ou sauvegarder les bases de données</string>
<string name="open_link_database">Lien du fichier Kdbx à ouvrir</string>
<string name="reset_education_screens_title">Réinitialise les écrans d\'éducation</string>
<string name="reset_education_screens_summary">Mets en surbrillance les éléments de l\'interface pour apprendre le fonctionnement de l\'application</string>
<string name="reset_education_screens_text">Ecrans d\'éducation réinitialisés</string>
<string name="education_create_database_title">Créez votre fichier de base de données</string>
<string name="education_create_database_summary">Vous ne connaissez pas encore KeePass DX, créer votre premier fichier de gestion de mots de passe.</string>
<string name="education_select_database_title">Ouvrez une base de données existante</string>
@@ -67,6 +67,7 @@
<string name="monospace_font_fields_enable_key" translatable="false">monospace_font_extra_fields_enable_key</string>
<string name="auto_open_file_uri_key" translatable="false">auto_open_file_uri_key</string>
<string name="allow_copy_password_key" translatable="false">allow_copy_password_key</string>
<string name="reset_education_screens_key" translatable="false">relaunch_education_screens_key</string>
<string name="education_select_db_key" translatable="false">education_select_db_key</string>
<string name="education_group_key" translatable="false">education_group_key</string>
+3
View File
@@ -250,6 +250,9 @@
<string name="warning_disabling_storage_access_framework">WARNING : disabling this feature may result in an inability to open or save the databases</string>
<string name="open_link_database">Link of the Kdbx file to open</string>
<string name="reset_education_screens_title">Reset education screens</string>
<string name="reset_education_screens_summary">Highlight the elements of the interface to learn how the application works</string>
<string name="reset_education_screens_text">Education screens reseted</string>
<string name="education_create_database_title">Create your database file</string>
<string name="education_create_database_summary">You don\'t know KeePass DX yet, create your first password management file.</string>
<string name="education_select_database_title">Open an existing database</string>
+10
View File
@@ -166,4 +166,14 @@
android:defaultValue="@bool/full_file_path_enable_default"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/general">
<Preference
android:key="@string/reset_education_screens_key"
android:title="@string/reset_education_screens_title"
android:summary="@string/reset_education_screens_summary"/>
</PreferenceCategory>
</PreferenceScreen>