From 093bd842f60c2aa8ce395e6b7caec6c8f4043de3 Mon Sep 17 00:00:00 2001 From: Ullas-Aithal Date: Sat, 6 Feb 2021 19:34:01 +0530 Subject: [PATCH] Added option to hide issuer label #678 --- .../shadowice/flocke/andotp/Activities/MainActivity.java | 3 ++- .../org/shadowice/flocke/andotp/Utilities/Settings.java | 4 ++++ .../org/shadowice/flocke/andotp/View/EntryViewHolder.java | 4 ++-- app/src/main/res/values/settings.xml | 1 + app/src/main/res/values/strings_settings.xml | 2 ++ app/src/main/res/xml/preferences.xml | 6 ++++++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java index 82e1ff7a..abb55307 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java @@ -482,7 +482,8 @@ public class MainActivity extends BaseActivity key.equals(getString(R.string.settings_key_tag_functionality)) || key.equals(getString(R.string.settings_key_label_highlight_token)) || key.equals(getString(R.string.settings_key_card_layout)) || - key.equals(getString(R.string.settings_key_hide_global_timeout))) { + key.equals(getString(R.string.settings_key_hide_global_timeout)) || + key.equals(getString(R.string.settings_key_hide_issuer))) { recreateActivity = true; } } diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java index c8853c3e..2afa1de2 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java @@ -580,6 +580,10 @@ public class Settings { return getBoolean(R.string.settings_key_focus_search_on_start, false); } + public boolean isHideIssuerEnabled() { + return getBoolean(R.string.settings_key_hide_issuer, false); + } + public Constants.TapMode getTapSingle() { String singleTap = getString(R.string.settings_key_tap_single, R.string.settings_default_tap_single); return Constants.TapMode.valueOf(singleTap.toUpperCase(Locale.ENGLISH)); diff --git a/app/src/main/java/org/shadowice/flocke/andotp/View/EntryViewHolder.java b/app/src/main/java/org/shadowice/flocke/andotp/View/EntryViewHolder.java index 23c7c715..e277258c 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/View/EntryViewHolder.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/View/EntryViewHolder.java @@ -180,7 +180,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder String contentHint = ""; String issuerText = entry.getIssuer(); - if (!TextUtils.isEmpty(issuerText)) { + if (!TextUtils.isEmpty(issuerText) && !settings.isHideIssuerEnabled()) { issuer.setText(issuerText); issuer.setVisibility(View.VISIBLE); @@ -199,7 +199,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder label.setVisibility(View.GONE); } - if (!TextUtils.isEmpty(issuerText) && !TextUtils.isEmpty(labelText)) { + if (!TextUtils.isEmpty(issuerText) && !TextUtils.isEmpty(labelText) && !settings.isHideIssuerEnabled()) { separator.setVisibility(View.VISIBLE); contentHint = issuerText + " - " + labelText; diff --git a/app/src/main/res/values/settings.xml b/app/src/main/res/values/settings.xml index 8b251cb1..8aa97d00 100644 --- a/app/src/main/res/values/settings.xml +++ b/app/src/main/res/values/settings.xml @@ -39,6 +39,7 @@ pref_hide_global_timeout pref_show_individual_timeouts pref_focus_search_on_start + pref_hide_issuer pref_backup_append_date_time pref_backup_ask diff --git a/app/src/main/res/values/strings_settings.xml b/app/src/main/res/values/strings_settings.xml index 0c5e2912..07310b33 100644 --- a/app/src/main/res/values/strings_settings.xml +++ b/app/src/main/res/values/strings_settings.xml @@ -38,6 +38,7 @@ Hide global timeout bar Show individual timeouts Focus search on app start + Hide Issuer Append date to filename Ask for filename @@ -85,6 +86,7 @@ Show an individual timeout bar for every entry. This can slow down the app, only enable if really necessary. Focus the search immediately after opening the app. + Hides issuer label on each card Append the current date and time to the suggested backup filename diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 5c6d87eb..6ef5efcb 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -182,6 +182,12 @@ android:summary="@string/settings_desc_hide_global_timeout" android:defaultValue="false" /> + +