improve ExistingBackupFragment

This commit is contained in:
ameba23
2021-03-09 12:36:02 +01:00
parent 28d2697e38
commit b3292f86ab
2 changed files with 19 additions and 11 deletions

View File

@@ -24,8 +24,6 @@ public class ExistingBackupFragment extends BaseFragment {
private static final String THRESHOLD = "threshold";
private static final String CUSTODIANS = "custodians";
public static final String TAG = ExistingBackupFragment.class.getName();
private TextView textViewBackupMetadata;
public static ExistingBackupFragment newInstance(
BackupMetadata backupMetadata) {
@@ -58,10 +56,12 @@ public class ExistingBackupFragment extends BaseFragment {
ArrayList<String> custodianNames = args.getStringArrayList(CUSTODIANS);
String custodianNamesString = "";
for (String custodianName : custodianNames) {
custodianNamesString += custodianName + " ";
custodianNamesString += custodianName + ", ";
}
textViewBackupMetadata = view.findViewById(R.id.textViewBackupMetadata);
textViewBackupMetadata.setText(String.format("Threshold is %d", args.getInt(THRESHOLD)) + custodianNamesString);
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);
return view;
}

View File

@@ -6,22 +6,30 @@
android:layout_width="match_parent"
android:paddingLeft="@dimen/margin_large"
android:paddingTop="@dimen/margin_medium"
android:paddingTop="@dimen/margin_large"
android:paddingRight="@dimen/margin_large"
android:paddingBottom="@dimen/margin_medium"
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewBackupMetadata"
android:id="@+id/textViewThreshold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="placeholder threshold"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewCustodians"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/backup_done_info"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteY="313dp" />
app:layout_constraintTop_toBottomOf="@+id/textViewThreshold" />
</androidx.constraintlayout.widget.ConstraintLayout>