Display badge on Payment Details.

This commit is contained in:
Cody Henthorne 2021-11-24 12:47:02 -05:00 committed by Greyson Parrelli
parent c5d7188dcb
commit 5b2ca6a1d3
2 changed files with 14 additions and 0 deletions

View file

@ -23,6 +23,7 @@ import androidx.navigation.Navigation;
import org.signal.core.util.logging.Log; import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.LoggingFragment; import org.thoughtcrime.securesms.LoggingFragment;
import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.badges.BadgeImageView;
import org.thoughtcrime.securesms.components.AvatarImageView; import org.thoughtcrime.securesms.components.AvatarImageView;
import org.thoughtcrime.securesms.database.PaymentDatabase; import org.thoughtcrime.securesms.database.PaymentDatabase;
import org.thoughtcrime.securesms.payments.Direction; import org.thoughtcrime.securesms.payments.Direction;
@ -57,6 +58,7 @@ public final class PaymentDetailsFragment extends LoggingFragment {
PaymentDetailsParcelable details = PaymentDetailsFragmentArgs.fromBundle(requireArguments()).getPaymentDetails(); PaymentDetailsParcelable details = PaymentDetailsFragmentArgs.fromBundle(requireArguments()).getPaymentDetails();
AvatarImageView avatar = view.findViewById(R.id.payments_details_avatar); AvatarImageView avatar = view.findViewById(R.id.payments_details_avatar);
BadgeImageView badge = view.findViewById(R.id.payments_details_badge);
TextView contactFromTo = view.findViewById(R.id.payments_details_contact_to_from); TextView contactFromTo = view.findViewById(R.id.payments_details_contact_to_from);
MoneyView amount = view.findViewById(R.id.payments_details_amount); MoneyView amount = view.findViewById(R.id.payments_details_amount);
TextView note = view.findViewById(R.id.payments_details_note); TextView note = view.findViewById(R.id.payments_details_note);
@ -106,6 +108,7 @@ public final class PaymentDetailsFragment extends LoggingFragment {
avatar.setImageResource(R.drawable.ic_mobilecoin_avatar_24); avatar.setImageResource(R.drawable.ic_mobilecoin_avatar_24);
} else { } else {
avatar.setRecipient(state.getRecipient(), true); avatar.setRecipient(state.getRecipient(), true);
badge.setBadgeFromRecipient(state.getRecipient());
} }
contactFromTo.setText(describeToOrFrom(state)); contactFromTo.setText(describeToOrFrom(state));

View file

@ -38,6 +38,17 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<org.thoughtcrime.securesms.badges.BadgeImageView
android:id="@+id/payments_details_badge"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="32dp"
android:layout_marginTop="34dp"
android:contentDescription="@string/ImageView__badge"
app:badge_size="medium"
app:layout_constraintStart_toStartOf="@id/payments_details_avatar"
app:layout_constraintTop_toTopOf="@id/payments_details_avatar" />
<TextView <TextView
android:id="@+id/payments_details_contact_to_from" android:id="@+id/payments_details_contact_to_from"
style="@style/TextAppearance.Signal.Body2" style="@style/TextAppearance.Signal.Body2"