From 2c44a4d7609999c3db56a6f735c0a05301391a3c Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Tue, 10 Apr 2018 12:44:49 +0200 Subject: [PATCH] Change education for password screen --- .../keepass/password/PasswordActivity.java | 50 +++---------------- app/src/main/res/values-fr/strings.xml | 4 +- app/src/main/res/values/strings.xml | 4 +- 3 files changed, 9 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java index 86f42518f..4fe1438f9 100644 --- a/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java @@ -299,6 +299,8 @@ public class PasswordActivity extends StylishActivity autofillHelper = new AutofillHelper(); autofillHelper.retrieveAssistStructure(getIntent()); } + + checkAndPerformedEducation(savedInstanceState); } @Override @@ -324,22 +326,12 @@ public class PasswordActivity extends StylishActivity .execute(getIntent()); } - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - - boolean parentOnPrepareOptionMenu = super.onPrepareOptionsMenu(menu); - // Launch education screen - new Handler().post(this::checkAndPerformedEducation); - - return parentOnPrepareOptionMenu; - } - - private void checkAndPerformedEducation() { + private void checkAndPerformedEducation(Bundle savedInstanceState) { if (!PreferencesUtil.isEducationPasswordPerformed(this)) { List targets = new ArrayList<>(); - targets.add(TapTarget.forView(findViewById(R.id.unlock_container), + targets.add(TapTarget.forView(findViewById(R.id.password_input_container), getString(R.string.education_unlock_title), getString(R.string.education_unlock_summary)) .dimColor(R.color.green) @@ -354,41 +346,13 @@ public class PasswordActivity extends StylishActivity targets.add(fingerprintTapTarget); } - /* - // TODO crash - MenuUtil.addDonationTapTargetIfAllowed(targets, toolbar, - getString(R.string.education_donation_title), - getString(R.string.education_donation_summary)); - */ - - targets.add(TapTarget.forView(confirmButtonView, - getString(R.string.education_open_and_save_database_title), - getString(R.string.education_open_and_save_database_summary)) - .tintTarget(false)); - if (!targets.isEmpty()) { new TapTargetSequence(this) - .targets(targets).listener(new TapTargetSequence.Listener() { - @Override - public void onSequenceFinish() { - saveEducationPreference(); - } - - @Override - public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) {} - - @Override - public void onSequenceCanceled(TapTarget lastTarget) {} - }).continueOnCancel(true).start(); + .targets(targets).continueOnCancel(true).start(); } - } - } - private void saveEducationPreference() { - SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(this); - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putBoolean(getString(R.string.education_password_key), true); - editor.apply(); + PreferencesUtil.saveEducationPreference(PasswordActivity.this, R.string.education_password_key); + } } @Override diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 088a2004e..c5c4a3c9a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -275,9 +275,7 @@ Sauvegardez votre entrée Sauvegardez votre entrée ici une fois que tous les champs voulus sont remplis. Débloquez votre base de données - Entrez un mot de passe et/ou un fichier de clé pour ouvrir la base de données. - Ouvrez votre base de données - Ouvrez votre base de données une fois les éléments de déblocage renseignés.\nPensez à sauvegarder une copie de votre fichier en lieu sûr après chaque modification. + Entrez un mot de passe et/ou un fichier de clé pour ouvrir la base de données.\n\nPensez à sauvegarder une copie de votre fichier en lieu sûr après chaque modification. Copiez un champ Copiez un champ facilement dans le presse-papiers pour le coller où vous voulez. Vérouillez la base de données diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c43a4cd12..80b3a33b5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -279,9 +279,7 @@ Save you entry Save your entry here once all the desired fields are filled. Unlock your database - Enter a password and/or a key file to unlock your database. - Open your database - Open your database once the unlock items are filled.\nRemember to save a copy of your file in a safe place after each modification. + Enter a password and/or a key file to unlock your database.\n\nRemember to save a copy of your file in a safe place after each modification. Copy a field Copy a field easily into the clipboard to paste it where you want. Lock the database