Tweak private story reaction UI.

This commit is contained in:
Cody Henthorne
2022-04-07 19:51:35 -04:00
parent a894ba7a51
commit ff26922afb
8 changed files with 72 additions and 47 deletions

View File

@@ -181,7 +181,7 @@ public class InputPanel extends LinearLayout
@NonNull CharSequence body,
@NonNull SlideDeck attachments)
{
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments, null);
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments, null, false);
int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight()
: 0;

View File

@@ -24,6 +24,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.components.emoji.EmojiImageView;
import org.thoughtcrime.securesms.components.mention.MentionAnnotation;
import org.thoughtcrime.securesms.conversation.colors.ChatColors;
import org.thoughtcrime.securesms.database.model.Mention;
@@ -71,16 +72,18 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
}
}
private ViewGroup mainView;
private ViewGroup footerView;
private TextView authorView;
private TextView bodyView;
private View quoteBarView;
private ImageView thumbnailView;
private View attachmentVideoOverlayView;
private ViewGroup attachmentContainerView;
private TextView attachmentNameView;
private ImageView dismissView;
private ViewGroup mainView;
private ViewGroup footerView;
private TextView authorView;
private TextView bodyView;
private View quoteBarView;
private ImageView thumbnailView;
private View attachmentVideoOverlayView;
private ViewGroup attachmentContainerView;
private TextView attachmentNameView;
private ImageView dismissView;
private EmojiImageView missingStoryReaction;
private EmojiImageView storyReactionEmoji;
private long id;
private LiveRecipient author;
@@ -132,6 +135,8 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
this.dismissView = findViewById(R.id.quote_dismiss);
this.mediaDescriptionText = findViewById(R.id.media_type);
this.missingLinkText = findViewById(R.id.quote_missing_text);
this.missingStoryReaction = findViewById(R.id.quote_missing_story_reaction_emoji);
this.storyReactionEmoji = findViewById(R.id.quote_story_reaction_emoji);
this.largeCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_large);
this.smallCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_bottom);
@@ -198,7 +203,8 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
@Nullable CharSequence body,
boolean originalMissing,
@NonNull SlideDeck attachments,
@Nullable ChatColors chatColors)
@Nullable ChatColors chatColors,
boolean isStoryReaction)
{
if (this.author != null) this.author.removeForeverObserver(this);
@@ -209,7 +215,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
this.author.observeForever(this);
setQuoteAuthor(author);
setQuoteText(body, attachments, originalMissing);
setQuoteText(body, attachments, originalMissing, isStoryReaction);
setQuoteAttachment(glideRequests, body, attachments, originalMissing);
setQuoteMissingFooter(originalMissing);
@@ -280,15 +286,32 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
messageType == MessageType.STORY_REPLY_PREVIEW;
}
private void setQuoteText(@Nullable CharSequence body, @NonNull SlideDeck attachments, boolean originalMissing) {
private void setQuoteText(@Nullable CharSequence body, @NonNull SlideDeck attachments, boolean originalMissing, boolean isStoryReaction) {
if (originalMissing && isStoryReply()) {
bodyView.setVisibility(GONE);
storyReactionEmoji.setVisibility(View.GONE);
mediaDescriptionText.setVisibility(VISIBLE);
mediaDescriptionText.setText(R.string.QuoteView_no_longer_available);
if (isStoryReaction) {
missingStoryReaction.setVisibility(View.VISIBLE);
missingStoryReaction.setImageEmoji(body);
} else {
missingStoryReaction.setVisibility(View.GONE);
}
return;
}
if (isStoryReaction) {
storyReactionEmoji.setImageEmoji(body);
storyReactionEmoji.setVisibility(View.VISIBLE);
missingStoryReaction.setVisibility(View.INVISIBLE);
return;
} else {
storyReactionEmoji.setVisibility(View.GONE);
missingStoryReaction.setVisibility(View.GONE);
}
boolean isTextStory = !attachments.containsMediaSlide() && isStoryReply();
if (!TextUtils.isEmpty(body) || !attachments.containsMediaSlide()) {

View File

@@ -63,6 +63,7 @@ import com.annimon.stream.Stream;
import com.google.android.exoplayer2.MediaItem;
import com.google.common.collect.Sets;
import org.signal.core.util.DimensionUnit;
import org.signal.core.util.StringUtil;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.BindableConversationItem;
@@ -82,7 +83,6 @@ import org.thoughtcrime.securesms.components.Outliner;
import org.thoughtcrime.securesms.components.PlaybackSpeedToggleTextView;
import org.thoughtcrime.securesms.components.QuoteView;
import org.thoughtcrime.securesms.components.SharedContactView;
import org.thoughtcrime.securesms.components.emoji.EmojiImageView;
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
import org.thoughtcrime.securesms.components.mention.MentionAnnotation;
import org.thoughtcrime.securesms.contactshare.Contact;
@@ -193,7 +193,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
protected BadgeImageView badgeImageView;
private View storyReactionLabelWrapper;
private TextView storyReactionLabel;
private EmojiImageView storyReactionEmoji;
private @NonNull Set<MultiselectPart> batchSelected = new HashSet<>();
private @NonNull Outliner outliner = new Outliner();
@@ -299,7 +298,6 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
this.badgeImageView = findViewById(R.id.badge);
this.storyReactionLabelWrapper = findViewById(R.id.story_reacted_label_holder);
this.storyReactionLabel = findViewById(R.id.story_reacted_label);
this.storyReactionEmoji = findViewById(R.id.story_reaction_emoji);
setOnClickListener(new ClickListener(null));
@@ -1432,7 +1430,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
}
//noinspection ConstantConditions
quoteView.setQuote(glideRequests, quote.getId(), Recipient.live(quote.getAuthor()).get(), quote.getDisplayText(), quote.isOriginalMissing(), quote.getAttachment(), chatColors);
CharSequence body = isStoryReaction(current) ? current.getBody() : quote.getDisplayText();
//noinspection ConstantConditions
quoteView.setQuote(glideRequests, quote.getId(), Recipient.live(quote.getAuthor()).get(), body, quote.isOriginalMissing(), quote.getAttachment(), chatColors, isStoryReaction(current));
quoteView.setVisibility(View.VISIBLE);
quoteView.setTextSize(TypedValue.COMPLEX_UNIT_SP, SignalStore.settings().getMessageFontSize());
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
@@ -1463,6 +1463,12 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
}
}
if (!isFooterVisible(current, next, isGroupThread) && isStoryReaction(current)) {
ViewUtil.setBottomMargin(quoteView, (int) DimensionUnit.DP.toPixels(8));
} else {
ViewUtil.setBottomMargin(quoteView, 0);
}
if (mediaThumbnailStub.resolved()) {
ViewUtil.setTopMargin(mediaThumbnailStub.require(), readDimen(R.dimen.message_bubble_top_padding));
}
@@ -1553,11 +1559,8 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
storyReactionLabelWrapper.setVisibility(View.VISIBLE);
storyReactionLabel.setTextColor(record.isOutgoing() ? colorizer.getOutgoingBodyTextColor(context) : ContextCompat.getColor(context, R.color.signal_text_primary));
storyReactionLabel.setText(getStoryReactionLabelText(messageRecord));
storyReactionEmoji.setImageEmoji(record.getBody());
storyReactionEmoji.setVisibility(View.VISIBLE);
} else if (storyReactionLabelWrapper != null) {
storyReactionLabelWrapper.setVisibility(View.GONE);
storyReactionEmoji.setVisibility(View.GONE);
}
}

View File

@@ -105,7 +105,8 @@ class StoryReplyComposer @JvmOverloads constructor(
messageRecord.body,
false,
messageRecord.slideDeck,
null
null,
false
)
quoteView.visible = true