mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Change the layout of the entry delete dialog and include more info
This commit is contained in:
parent
adfc472a39
commit
c0020684de
25 changed files with 38 additions and 46 deletions
|
@ -71,11 +71,8 @@ public class Dialogs {
|
|||
TextView textMessage = view.findViewById(R.id.text_message);
|
||||
TextView textExplanation = view.findViewById(R.id.text_explanation);
|
||||
String entries = services.stream()
|
||||
.map(entry -> !entry.getIssuer().isEmpty() ? entry.getIssuer()
|
||||
: !entry.getName().isEmpty() ? entry.getName()
|
||||
: activity.getString(R.string.unknown_issuer)
|
||||
)
|
||||
.collect(Collectors.joining(", "));
|
||||
.map(entry -> String.format("• %s", getVaultEntryName(activity, entry)))
|
||||
.collect(Collectors.joining("\n"));
|
||||
textExplanation.setText(activity.getString(R.string.delete_entry_explanation, entries));
|
||||
|
||||
String title, message;
|
||||
|
@ -96,6 +93,18 @@ public class Dialogs {
|
|||
.create());
|
||||
}
|
||||
|
||||
private static String getVaultEntryName(Context context, VaultEntry entry) {
|
||||
if (!entry.getIssuer().isEmpty() && !entry.getName().isEmpty()) {
|
||||
return String.format("%s (%s)", entry.getIssuer(), entry.getName());
|
||||
} else if (entry.getIssuer().isEmpty() && entry.getName().isEmpty()) {
|
||||
return context.getString(R.string.unknown_issuer);
|
||||
} else if (entry.getIssuer().isEmpty()) {
|
||||
return entry.getName();
|
||||
} else {
|
||||
return entry.getIssuer();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showDiscardDialog(Activity activity, DialogInterface.OnClickListener onSave, DialogInterface.OnClickListener onDiscard) {
|
||||
showSecureDialog(new AlertDialog.Builder(activity)
|
||||
.setTitle(activity.getString(R.string.discard_changes))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue