diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java index 522d05208..88cf95b9c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java @@ -42,7 +42,7 @@ import android.view.MenuItem; import android.widget.ImageView; import com.getkeepsafe.taptargetview.TapTarget; -import com.getkeepsafe.taptargetview.TapTargetSequence; +import com.getkeepsafe.taptargetview.TapTargetView; import com.kunzisoft.keepass.R; import com.kunzisoft.keepass.adapters.NodeAdapter; import com.kunzisoft.keepass.app.App; @@ -263,57 +263,102 @@ public class GroupActivity extends ListNodesActivity addNodeButtonView.showButton(); } - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - boolean parentOnPrepareOptionMenu = super.onPrepareOptionsMenu(menu); + private void checkAndPerformedEducation(Menu menu) { - // Launch education screen - new Handler().post(this::checkAndPerformedEducation); + // If no node, show education to add new one + if (mAdapter.getItemCount() <= 0) { + if (!PreferencesUtil.isEducationNewNodePerformed(this)) { - return parentOnPrepareOptionMenu; - } + TapTargetView.showFor(this, + TapTarget.forView(findViewById(R.id.add_button), + getString(R.string.education_new_node_title), + getString(R.string.education_new_node_summary)) + .tintTarget(false) + .cancelable(true), + new TapTargetView.Listener() { + @Override + public void onTargetClick(TapTargetView view) { + super.onTargetClick(view); + addNodeButtonView.openButtonIfClose(); + } + }); + PreferencesUtil.saveEducationPreference(this, + R.string.education_new_node_key); - private void checkAndPerformedEducation() { - // For the first time show the tuto - if (!PreferencesUtil.isEducationGroupPerformed(this)) { + } - new TapTargetSequence(this) - .targets( - TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search, - getString(R.string.education_search_title), - getString(R.string.education_search_summary)), - //TapTarget.forToolbarMenuItem(toolbar, R.id.menu_lock, - // getString(R.string.education_lock_title), - // getString(R.string.education_lock_summary)), - //TapTarget.forToolbarMenuItem(toolbar, R.id.menu_sort, - // getString(R.string.education_sort_title), - // getString(R.string.education_sort_summary)), - TapTarget.forView(findViewById(R.id.add_button), - getString(R.string.education_new_node_title), - getString(R.string.education_new_node_summary)) - .tintTarget(false) - ).listener(new TapTargetSequence.Listener() { - @Override - public void onSequenceFinish() { - saveEducationPreference(); - } + // Else show the search education + } else if (!PreferencesUtil.isEducationSearchPerformed(this)) { - @Override - public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) {} + TapTargetView.showFor(this, + TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search, + getString(R.string.education_search_title), + getString(R.string.education_search_summary)) + .tintTarget(true) + .cancelable(true), + new TapTargetView.Listener() { + @Override + public void onTargetClick(TapTargetView view) { + super.onTargetClick(view); + MenuItem searchItem = menu.findItem(R.id.menu_search); + searchItem.expandActionView(); + } + }); + PreferencesUtil.saveEducationPreference(this, + R.string.education_search_key); - @Override - public void onSequenceCanceled(TapTarget lastTarget) {} - }).continueOnCancel(true).start(); + // Else show the sort education + } else if (!PreferencesUtil.isEducationSortPerformed(this)) { + + try { + TapTargetView.showFor(this, + TapTarget.forToolbarMenuItem(toolbar, R.id.menu_sort, + getString(R.string.education_sort_title), + getString(R.string.education_sort_summary)) + .tintTarget(true) + .cancelable(true), + new TapTargetView.Listener() { + @Override + public void onTargetClick(TapTargetView view) { + super.onTargetClick(view); + MenuItem sortItem = menu.findItem(R.id.menu_sort); + onOptionsItemSelected(sortItem); + } + }); + PreferencesUtil.saveEducationPreference(this, + R.string.education_sort_key); + } catch (Exception e) { + // If icon not visible + Log.w(TAG, "Can't performed education for sort"); + } + + // Else show the lock education + } else if (!PreferencesUtil.isEducationLockPerformed(this)) { + + try { + TapTargetView.showFor(this, + TapTarget.forToolbarMenuItem(toolbar, R.id.menu_lock, + getString(R.string.education_lock_title), + getString(R.string.education_lock_summary)) + .tintTarget(true) + .cancelable(true), + new TapTargetView.Listener() { + @Override + public void onTargetClick(TapTargetView view) { + super.onTargetClick(view); + MenuItem lockItem = menu.findItem(R.id.menu_lock); + onOptionsItemSelected(lockItem); + } + }); + PreferencesUtil.saveEducationPreference(this, + R.string.education_lock_key); + } catch (Exception e) { + // If icon not visible + Log.w(TAG, "Can't performed education for lock"); + } } } - private void saveEducationPreference() { - SharedPreferences sharedPreferences = PreferencesUtil.getEducationSharedPreferences(this); - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putBoolean(getString(R.string.education_group_key), true); - editor.apply(); - } - @Override protected void onStop() { super.onStop(); @@ -377,6 +422,9 @@ public class GroupActivity extends ListNodesActivity super.onCreateOptionsMenu(menu); + // Launch education screen + new Handler().post(() -> checkAndPerformedEducation(menu)); + return true; } 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 4fe1438f9..d1917f55d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java @@ -345,6 +345,7 @@ public class PasswordActivity extends StylishActivity .tintTarget(false); targets.add(fingerprintTapTarget); } + // TODO make a period for donation if (!targets.isEmpty()) { new TapTargetSequence(this) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java index 6c9a85ee9..c423d1e7f 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java @@ -153,7 +153,10 @@ public class PreferencesUtil { R.string.education_create_db_key, R.string.education_select_db_key, R.string.education_open_link_db_key, - R.string.education_group_key, + R.string.education_search_key, + R.string.education_new_node_key, + R.string.education_sort_key, + R.string.education_lock_key, R.string.education_entry_key, R.string.education_password_key, R.string.education_entry_edit_key @@ -186,10 +189,28 @@ public class PreferencesUtil { context.getResources().getBoolean(R.bool.education_open_link_db_default)); } - public static boolean isEducationGroupPerformed(Context context) { + public static boolean isEducationSearchPerformed(Context context) { SharedPreferences prefs = getEducationSharedPreferences(context); - return prefs.getBoolean(context.getString(R.string.education_group_key), - context.getResources().getBoolean(R.bool.education_group_default)); + return prefs.getBoolean(context.getString(R.string.education_search_key), + context.getResources().getBoolean(R.bool.education_search_default)); + } + + public static boolean isEducationNewNodePerformed(Context context) { + SharedPreferences prefs = getEducationSharedPreferences(context); + return prefs.getBoolean(context.getString(R.string.education_new_node_key), + context.getResources().getBoolean(R.bool.education_new_node_default)); + } + + public static boolean isEducationSortPerformed(Context context) { + SharedPreferences prefs = getEducationSharedPreferences(context); + return prefs.getBoolean(context.getString(R.string.education_sort_key), + context.getResources().getBoolean(R.bool.education_sort_default)); + } + + public static boolean isEducationLockPerformed(Context context) { + SharedPreferences prefs = getEducationSharedPreferences(context); + return prefs.getBoolean(context.getString(R.string.education_lock_key), + context.getResources().getBoolean(R.bool.education_lock_default)); } public static boolean isEducationEntryPerformed(Context context) { diff --git a/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java index 05d8d8328..53cc692aa 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java @@ -148,6 +148,15 @@ public class AddNodeButtonView extends RelativeLayout { addButtonView.hide(onAddButtonVisibilityChangedListener); } + /** + * Start the animation to close the button + */ + public void openButtonIfClose() { + if(state.equals(State.CLOSE)) { + startGlobalAnimation(); + } + } + /** * Start the animation to close the button */ diff --git a/app/src/main/res/menu/search.xml b/app/src/main/res/menu/search.xml index c7a33cc77..419422db1 100644 --- a/app/src/main/res/menu/search.xml +++ b/app/src/main/res/menu/search.xml @@ -24,5 +24,6 @@ android:title="@string/menu_search" app:showAsAction="always|collapseActionView" android:orderInCategory="31" + android:iconifiedByDefault="true" app:actionViewClass="android.support.v7.widget.SearchView" /> \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c5c4a3c9a..23a755fee 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -261,9 +261,9 @@ Un lien vers l\'emplacement de votre fichier suffit Vous pouvez aussi ouvrir votre base avec un lien physique. (Avec file:// et content:// par exemple). Ajoutez de nouveaux éléments à votre base - Ajoutez des entrées pour gérer vos identités numériques.\nAjoutez des groupes (l\'équivalent des dossiers) pour organiser vos entrées et votre base. + Ajoutez des entrées pour gérer vos identités numériques.\n\nAjoutez des groupes (l\'équivalent des dossiers) pour organiser vos entrées et votre base. Recherchez facilement vos entrées - Recherchez des entrées par titre, nom d\'utilisateur ou d\'autres champs pour récupérer facilement vos mots de passes. + Recherchez des entrées par titre, nom d\'utilisateur ou par d\'autres champs pour récupérer facilement vos mots de passes. Débloquez votre base de données avec votre empreinte digitale Faites le lien entre votre mot de passe et votre empreinte digitale pour facilement dévérouiller votre base de données. Editez l\'entrée @@ -279,7 +279,7 @@ Copiez un champ Copiez un champ facilement dans le presse-papiers pour le coller où vous voulez. Vérouillez la base de données - Verrouillez votre base de données rapidement, vous pouvez paramétrer l\'application pour qu\'elle se verrouille après un certain temps et lorsqu'un écran est éteint. + Verrouillez votre base de données rapidement, vous pouvez paramétrer l\'application pour qu\'elle se verrouille après un certain temps et lorsqu\'un écran est éteint. Triez les éléments Triez les entrées et les groupes en fonction de paramètres spécifiques. Participez diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 05a9db756..0a6ed054a 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -76,7 +76,10 @@ education_create_db_key education_select_db_key education_open_link_db_key - education_group_key + education_search_key + education_new_node_key + education_sort_key + education_lock_key education_entry_key education_password_key education_entry_edit_key @@ -100,7 +103,10 @@ false false false - false + false + false + false + false false false false diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 80b3a33b5..dbd2e0727 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -265,7 +265,7 @@ A link to the location of your file is sufficient You can also open your base with a physical link (With file:// and content:// for example). Add new items to your base - Add entries to manage your digital identities.\nAdd groups (the equivalent of folders) to organize your entries and your database. + Add entries to manage your digital identities.\n\nAdd groups (the equivalent of folders) to organize your entries and your database. Easily search your entries Search for entries by title, username or other fields to easily retrieve your passwords. Unlock your database with your fingerprint