mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add badges to Avatars in a variety of places.
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||
@@ -29,6 +30,7 @@ public class ConversationBannerView extends ConstraintLayout {
|
||||
private TextView contactSubtitle;
|
||||
private EmojiTextView contactDescription;
|
||||
private View tapToView;
|
||||
private BadgeImageView contactBadge;
|
||||
|
||||
public ConversationBannerView(Context context) {
|
||||
this(context, null);
|
||||
@@ -44,6 +46,7 @@ public class ConversationBannerView extends ConstraintLayout {
|
||||
inflate(getContext(), R.layout.conversation_banner_view, this);
|
||||
|
||||
contactAvatar = findViewById(R.id.message_request_avatar);
|
||||
contactBadge = findViewById(R.id.message_request_badge);
|
||||
contactTitle = findViewById(R.id.message_request_title);
|
||||
contactAbout = findViewById(R.id.message_request_about);
|
||||
contactSubtitle = findViewById(R.id.message_request_subtitle);
|
||||
@@ -53,6 +56,10 @@ public class ConversationBannerView extends ConstraintLayout {
|
||||
contactAvatar.setFallbackPhotoProvider(new FallbackPhotoProvider());
|
||||
}
|
||||
|
||||
public void setBadge(@Nullable Recipient recipient) {
|
||||
contactBadge.setBadgeFromRecipient(recipient);
|
||||
}
|
||||
|
||||
public void setAvatar(@NonNull GlideRequests requests, @Nullable Recipient recipient) {
|
||||
contactAvatar.setAvatar(requests, recipient, false);
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
@@ -579,6 +580,8 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
int pendingMemberCount = recipientInfo.getGroupPendingMemberCount();
|
||||
List<String> groups = recipientInfo.getSharedGroups();
|
||||
|
||||
conversationBanner.setBadge(recipient);
|
||||
|
||||
if (recipient != null) {
|
||||
conversationBanner.setAvatar(GlideApp.with(context), recipient);
|
||||
conversationBanner.showBackgroundBubble(recipient.hasWallpaper());
|
||||
@@ -1510,6 +1513,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
@Override
|
||||
public void onSharedContactDetailsClicked(@NonNull Contact contact, @NonNull View avatarTransitionView) {
|
||||
if (getContext() != null && getActivity() != null) {
|
||||
ViewCompat.setTransitionName(avatarTransitionView, "avatar");
|
||||
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), avatarTransitionView, "avatar").toBundle();
|
||||
ActivityCompat.startActivity(getActivity(), SharedContactDetailsActivity.getIntent(getContext(), contact), bundle);
|
||||
}
|
||||
|
||||
@@ -1788,7 +1788,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (eventListener != null && batchSelected.isEmpty() && messageRecord.isMms() && !((MmsMessageRecord) messageRecord).getSharedContacts().isEmpty()) {
|
||||
eventListener.onSharedContactDetailsClicked(((MmsMessageRecord) messageRecord).getSharedContacts().get(0), sharedContactStub.get().getAvatarView());
|
||||
eventListener.onSharedContactDetailsClicked(((MmsMessageRecord) messageRecord).getSharedContacts().get(0), (View) sharedContactStub.get().getAvatarView().getParent());
|
||||
} else {
|
||||
passthroughClickListener.onClick(view);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView;
|
||||
import org.thoughtcrime.securesms.badges.models.Badge;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||
@@ -31,6 +33,7 @@ import java.util.Objects;
|
||||
public class ConversationTitleView extends RelativeLayout {
|
||||
|
||||
private AvatarImageView avatar;
|
||||
private BadgeImageView badge;
|
||||
private TextView title;
|
||||
private TextView subtitle;
|
||||
private ImageView verified;
|
||||
@@ -52,6 +55,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
super.onFinishInflate();
|
||||
|
||||
this.title = findViewById(R.id.title);
|
||||
this.badge = findViewById(R.id.badge);
|
||||
this.subtitle = findViewById(R.id.subtitle);
|
||||
this.verified = findViewById(R.id.verified_indicator);
|
||||
this.subtitleContainer = findViewById(R.id.subtitle_container);
|
||||
@@ -102,6 +106,8 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
this.avatar.setAvatar(glideRequests, recipient, false);
|
||||
}
|
||||
|
||||
badge.setBadgeFromRecipient(recipient);
|
||||
|
||||
updateVerifiedSubtitleVisibility();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user