Improve strings for ui for displaying existing social backup

This commit is contained in:
ameba23
2021-05-18 12:06:09 +02:00
parent 71e63fb6f1
commit 4db1c4cc6b
2 changed files with 13 additions and 9 deletions

View File

@@ -30,15 +30,16 @@ public class ExistingBackupFragment extends BaseFragment {
Bundle bundle = new Bundle();
List<Author> custodians = backupMetadata.getCustodians();
ArrayList custodianNames = new ArrayList();
for (Author custodian : custodians) {
custodianNames.add(custodian.getName());
}
bundle.putStringArrayList(CUSTODIANS, custodianNames);
for (Author custodian : custodians) {
custodianNames.add(custodian.getName());
}
bundle.putStringArrayList(CUSTODIANS, custodianNames);
bundle.putInt(THRESHOLD, backupMetadata.getThreshold());
ExistingBackupFragment fragment = new ExistingBackupFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -53,7 +54,7 @@ public class ExistingBackupFragment extends BaseFragment {
View view = inflater.inflate(R.layout.fragment_existing_backup,
container, false);
Bundle args = requireArguments();
ArrayList<String> custodianNames = args.getStringArrayList(CUSTODIANS);
ArrayList<String> custodianNames = args.getStringArrayList(CUSTODIANS);
StringBuilder custodianNamesString = new StringBuilder();
for (String custodianName : custodianNames) {
@@ -63,10 +64,12 @@ public class ExistingBackupFragment extends BaseFragment {
.append("\n");
}
TextView textViewThreshold = view.findViewById(R.id.textViewThreshold);
textViewThreshold.setText(String.format("%d of %d contacts needed to restore account", args.getInt(THRESHOLD), custodianNames.size()));
TextView textViewCustodians = view.findViewById(R.id.textViewCustodians);
textViewCustodians.setText(custodianNamesString);
TextView textViewThreshold = view.findViewById(R.id.textViewThreshold);
textViewThreshold.setText(getString(R.string.existing_backup_explain,
args.getInt(THRESHOLD)));
TextView textViewCustodians =
view.findViewById(R.id.textViewCustodians);
textViewCustodians.setText(custodianNamesString);
return view;
}

View File

@@ -729,4 +729,5 @@
<string name="activity_name_new_or_recover_account">Create new account or recover existing account</string>
<string name="activity_name_recovery">Recover Account</string>
<string name="activity_name_custodian_help_recovery">Help recover account</string>
<string name="existing_backup_explain">%d of the following contacts are needed to restore your account:</string>
</resources>