Unify the "last" and "most used" dialogs

This commit is contained in:
Jakob Nixdorf 2020-02-04 07:59:16 +01:00
parent b2b8b582bc
commit 3084596931
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
5 changed files with 15 additions and 46 deletions

View file

@ -16,6 +16,7 @@
* New feature: Move the app to the background after copying a token (Issue #373, PR #392 by @Ullas-Aithal)
* New feature: Re-lock the app after a certain time of inactivity (Issue #28, PR #390 by @LizardWithHat)
* New feature: Re-lock when being send to the background (Issue #216)
* New feature: Sort tokens by "most used" (Issue #443, PR #467 by @Ullas-Aithal)
* Improvement: Hide the token list on screen off (Issue #264, PR #390 by @LizardWithHat)
* Improvement: Scale the font of the default thumbnail with its size
* Improvement: Do not use auto-completion for the account secret (PR #430 by @duchampdev)

View file

@ -610,8 +610,8 @@ public class MainActivity extends BaseActivity
adapter.setSortMode(SortMode.LAST_USED);
touchHelperCallback.setDragEnabled(false);
}
if (! settings.getLastUsedDialogShown())
showLastUsedDialog();
if (! settings.getUsedTokensDialogShown())
showUsedTokensDialog();
} else if (id == R.id.menu_sort_most_used) {
item.setChecked(true);
sortMenu.setIcon(R.drawable.ic_sort_inverted_time_white);
@ -620,8 +620,8 @@ public class MainActivity extends BaseActivity
adapter.setSortMode(SortMode.MOST_USED);
touchHelperCallback.setDragEnabled(false);
}
if (! settings.getMostUsedDialogShown())
showMostUsedDialog();
if (! settings.getUsedTokensDialogShown())
showUsedTokensDialog();
} else if (tagsToggle.onOptionsItemSelected(item)) {
return true;
}
@ -629,31 +629,11 @@ public class MainActivity extends BaseActivity
return super.onOptionsItemSelected(item);
}
private void showLastUsedDialog() {
private void showUsedTokensDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_title_manual_entry)
.setTitle(R.string.dialog_title_last_used)
.setMessage(R.string.dialog_msg_last_used)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
settings.setLastUsedDialogShown(true);
}
})
.create()
.show();
}
private void showMostUsedDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_title_manual_entry)
.setTitle(R.string.dialog_title_most_used)
.setMessage(R.string.dialog_msg_most_used)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
settings.setMostUsedDialogShown(true);
}
})
builder.setTitle(R.string.dialog_title_used_tokens)
.setMessage(R.string.dialog_msg_used_tokens)
.setPositiveButton(android.R.string.ok, (DialogInterface dialogInterface, int i) -> settings.setUsedTokensDialogShown(true))
.create()
.show();
}

View file

@ -523,20 +523,13 @@ public class Settings {
return getBoolean(R.string.settings_key_enable_screenshot, false);
}
public boolean getLastUsedDialogShown() {
public boolean getUsedTokensDialogShown() {
return getBoolean(R.string.settings_key_last_used_dialog_shown, false);
}
public void setLastUsedDialogShown(boolean value) {
public void setUsedTokensDialogShown(boolean value) {
setBoolean(R.string.settings_key_last_used_dialog_shown, value);
}
public boolean getMostUsedDialogShown() {
return getBoolean(R.string.settings_key_most_used_dialog_shown, false);
}
public void setMostUsedDialogShown(boolean value) {
setBoolean(R.string.settings_key_most_used_dialog_shown, value);
}
public boolean getNewBackupFormatDialogShown() {
return getBoolean(R.string.settings_key_new_backup_format_dialog_shown, false);

View file

@ -60,7 +60,6 @@
<string name="settings_key_clear_keystore" translatable="false">pref_clear_keystore</string>
<string name="settings_key_last_used_dialog_shown" translatable="false">pref_last_used_dialog_shown</string>
<string name="settings_key_most_used_dialog_shown" translatable="false">pref_most_used_dialog_shown</string>
<!-- Default values -->
<integer name="settings_default_tap_to_reveal_timeout">30</integer>

View file

@ -77,8 +77,7 @@
<string name="dialog_title_remove">Remove</string>
<string name="dialog_title_rename">Rename</string>
<string name="dialog_title_counter">Counter</string>
<string name="dialog_title_last_used">Last used</string>
<string name="dialog_title_most_used">Most used</string>
<string name="dialog_title_used_tokens">Used tokens</string>
<string name="dialog_title_keystore_error">KeyStore error</string>
<string name="dialog_title_enter_password">Enter password</string>
@ -89,12 +88,9 @@
<string name="dialog_msg_auth">Please enter your device credentials to start andOTP.</string>
<string name="dialog_msg_confirm_delete">Are you sure you want do remove the account \"%1$s\"?</string>
<string name="dialog_msg_last_used">In order for andOTP to recognize which token was used last
you have to have \"tap to reveal\" enabled or use the copy button.\n\nThis message will not
be shown again.</string>
<string name="dialog_msg_most_used">In order for andOTP to recognize which token was used the most
you have to have \"tap to reveal\" enabled or use the copy button.\n\nThis message will not
<string name="dialog_msg_used_tokens">In order for andOTP to recognize which tokens get used you
have to have either \"tap to reveal\" enabled or use the copy button. This applies to the
sorting of the tokens by \"most used\" as well as by \"last used\".\n\nThis message will not
be shown again.</string>
<string name="dialog_msg_keystore_error">Failed to load the encryption key from the KeyStore.