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 8cd20ef3..448567b7 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 @@ -390,7 +390,8 @@ public class MainActivity extends BaseActivity if (key.equals(getString(R.string.settings_key_label_size)) || key.equals(getString(R.string.settings_key_label_scroll)) || key.equals(getString(R.string.settings_key_split_group_size)) || - key.equals(getString(R.string.settings_key_thumbnail_size))) { + key.equals(getString(R.string.settings_key_thumbnail_size)) || + key.equals(getString(R.string.settings_key_minimize_on_copy))) { adapter.notifyDataSetChanged(); } else if (key.equals(getString(R.string.settings_key_search_includes))) { adapter.clearFilter(); 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 bd38964c..586c062c 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 @@ -546,7 +546,11 @@ public class Settings { public boolean getIsAppendingDateTimeToBackups() { return getBoolean(R.string.settings_key_backup_append_date_time, false); } - + + public boolean isMinimizeAppOnCopyEnabled() { + return getBoolean(R.string.settings_key_minimize_on_copy, false); + } + private Constants.AutoBackup getAutoBackupEncryptedSetting() { String stringValue = getString(R.string.settings_key_auto_backup_password_enc, R.string.settings_default_auto_backup_password_enc); return Constants.AutoBackup.valueOf(stringValue.toUpperCase(Locale.ENGLISH)); diff --git a/app/src/main/java/org/shadowice/flocke/andotp/View/EntriesCardAdapter.java b/app/src/main/java/org/shadowice/flocke/andotp/View/EntriesCardAdapter.java index 27070b80..502f86c7 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/View/EntriesCardAdapter.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/View/EntriesCardAdapter.java @@ -49,6 +49,7 @@ import android.widget.GridView; import android.widget.LinearLayout; import android.widget.Toast; +import org.shadowice.flocke.andotp.Activities.MainActivity; import org.shadowice.flocke.andotp.Database.Entry; import org.shadowice.flocke.andotp.Dialogs.TagsDialog; import org.shadowice.flocke.andotp.R; @@ -270,6 +271,9 @@ public class EntriesCardAdapter extends RecyclerView.Adapter public void onCopyButtonClicked(String text, int position) { copyToClipboard(text); updateLastUsed(position, getRealIndex(position)); + if(context != null && settings.isMinimizeAppOnCopyEnabled()) { + ((MainActivity)context).moveTaskToBack(true); + } } @Override diff --git a/app/src/main/res/values/settings.xml b/app/src/main/res/values/settings.xml index 6b41b545..54fbfdb9 100644 --- a/app/src/main/res/values/settings.xml +++ b/app/src/main/res/values/settings.xml @@ -24,12 +24,14 @@ pref_label_size_sp pref_card_layout pref_label_scroll + pref_minimize_on_copy pref_thumbnail_size pref_split_group_size pref_tag_functionality pref_search_includes pref_label_highlight_token + pref_backup_append_date_time pref_backup_ask pref_backup_directory diff --git a/app/src/main/res/values/strings_settings.xml b/app/src/main/res/values/strings_settings.xml index 309f3152..78c3eeb2 100644 --- a/app/src/main/res/values/strings_settings.xml +++ b/app/src/main/res/values/strings_settings.xml @@ -26,6 +26,7 @@ Thumbnail size Split Token with space Tag selection behavior + Minimize app after copying OTP Search behavior Highlight expiring tokens @@ -58,6 +59,7 @@ services. DO NOT enable this if you rely on the accessibility services! Scroll overlong labels instead of truncating them + App will be minimized when you copy the OTP to clipboard Specify which values should be included when searching Highlights token in red if it\'s expiring in 8 seconds diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 4d67e9f9..c4e8151d 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -119,6 +119,12 @@ android:entryValues="@array/settings_values_tag_functionality" android:defaultValue="@string/settings_default_tag_functionality" /> + + -