mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add badges to Avatars in a variety of places.
This commit is contained in:
@@ -1031,6 +1031,14 @@ public class Recipient {
|
||||
return badges;
|
||||
}
|
||||
|
||||
public @Nullable Badge getFeaturedBadge() {
|
||||
if (badges.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return badges.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable String getCombinedAboutAndEmoji() {
|
||||
if (!Util.isEmpty(aboutEmoji)) {
|
||||
if (!Util.isEmpty(about)) {
|
||||
|
||||
@@ -24,6 +24,8 @@ import androidx.lifecycle.ViewModelProviders;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView;
|
||||
import org.thoughtcrime.securesms.badges.view.ViewBadgeBottomSheetDialogFragment;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsIcon;
|
||||
import org.thoughtcrime.securesms.components.settings.conversation.preferences.ButtonStripPreference;
|
||||
@@ -75,6 +77,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
private View noteToSelfDescription;
|
||||
private View buttonStrip;
|
||||
private View interactionsContainer;
|
||||
private BadgeImageView badgeImageView;
|
||||
|
||||
public static BottomSheetDialogFragment create(@NonNull RecipientId recipientId,
|
||||
@Nullable GroupId groupId)
|
||||
@@ -122,6 +125,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
noteToSelfDescription = view.findViewById(R.id.rbs_note_to_self_description);
|
||||
buttonStrip = view.findViewById(R.id.button_strip);
|
||||
interactionsContainer = view.findViewById(R.id.interactions_container);
|
||||
badgeImageView = view.findViewById(R.id.rbs_badge);
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -148,6 +152,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
}
|
||||
});
|
||||
avatar.setAvatar(recipient);
|
||||
badgeImageView.setBadgeFromRecipient(recipient);
|
||||
if (recipient.isSelf()) {
|
||||
avatar.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
@@ -279,6 +284,11 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
viewModel.onAvatarClicked(requireActivity());
|
||||
});
|
||||
|
||||
badgeImageView.setOnClickListener(view -> {
|
||||
dismiss();
|
||||
ViewBadgeBottomSheetDialogFragment.show(getParentFragmentManager(), recipientId, null);
|
||||
});
|
||||
|
||||
blockButton.setOnClickListener(view -> viewModel.onBlockClicked(requireActivity()));
|
||||
unblockButton.setOnClickListener(view -> viewModel.onUnblockClicked(requireActivity()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user