Add outline around sent gift reply thumb.
This commit is contained in:
parent
425a13e68c
commit
ff4311d114
3 changed files with 50 additions and 15 deletions
|
@ -17,11 +17,14 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.google.android.material.imageview.ShapeableImageView;
|
||||||
|
import com.google.android.material.shape.CornerFamily;
|
||||||
|
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||||
|
|
||||||
|
import org.signal.core.util.DimensionUnit;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||||
|
@ -76,18 +79,18 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ViewGroup mainView;
|
private ViewGroup mainView;
|
||||||
private ViewGroup footerView;
|
private ViewGroup footerView;
|
||||||
private TextView authorView;
|
private TextView authorView;
|
||||||
private TextView bodyView;
|
private TextView bodyView;
|
||||||
private View quoteBarView;
|
private View quoteBarView;
|
||||||
private ImageView thumbnailView;
|
private ShapeableImageView thumbnailView;
|
||||||
private View attachmentVideoOverlayView;
|
private View attachmentVideoOverlayView;
|
||||||
private ViewGroup attachmentContainerView;
|
private ViewGroup attachmentContainerView;
|
||||||
private TextView attachmentNameView;
|
private TextView attachmentNameView;
|
||||||
private ImageView dismissView;
|
private ImageView dismissView;
|
||||||
private EmojiImageView missingStoryReaction;
|
private EmojiImageView missingStoryReaction;
|
||||||
private EmojiImageView storyReactionEmoji;
|
private EmojiImageView storyReactionEmoji;
|
||||||
|
|
||||||
private long id;
|
private long id;
|
||||||
private LiveRecipient author;
|
private LiveRecipient author;
|
||||||
|
@ -380,7 +383,11 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setQuoteAttachment(@NonNull GlideRequests glideRequests, @NonNull CharSequence body, @NonNull SlideDeck slideDeck, boolean originalMissing) {
|
private void setQuoteAttachment(@NonNull GlideRequests glideRequests, @NonNull CharSequence body, @NonNull SlideDeck slideDeck, boolean originalMissing) {
|
||||||
|
boolean outgoing = messageType != MessageType.INCOMING && messageType != MessageType.STORY_REPLY_INCOMING;
|
||||||
|
boolean preview = messageType == MessageType.PREVIEW || messageType == MessageType.STORY_REPLY_PREVIEW;
|
||||||
|
|
||||||
mainView.setMinimumHeight(isStoryReply() && originalMissing ? 0 : thumbHeight);
|
mainView.setMinimumHeight(isStoryReply() && originalMissing ? 0 : thumbHeight);
|
||||||
|
thumbnailView.setPadding(0, 0, 0, 0);
|
||||||
|
|
||||||
if (!attachments.containsMediaSlide() && isStoryReply()) {
|
if (!attachments.containsMediaSlide() && isStoryReply()) {
|
||||||
StoryTextPostModel model = getStoryTextPost(body);
|
StoryTextPostModel model = getStoryTextPost(body);
|
||||||
|
@ -396,6 +403,12 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quoteType == QuoteModel.Type.GIFT_BADGE) {
|
if (quoteType == QuoteModel.Type.GIFT_BADGE) {
|
||||||
|
if (outgoing && !preview) {
|
||||||
|
int oneDp = (int) DimensionUnit.DP.toPixels(1);
|
||||||
|
thumbnailView.setPadding(oneDp, oneDp, oneDp, oneDp);
|
||||||
|
thumbnailView.setShapeAppearanceModel(buildShapeAppearanceForLayoutDirection());
|
||||||
|
}
|
||||||
|
|
||||||
attachmentVideoOverlayView.setVisibility(GONE);
|
attachmentVideoOverlayView.setVisibility(GONE);
|
||||||
attachmentContainerView.setVisibility(GONE);
|
attachmentContainerView.setVisibility(GONE);
|
||||||
thumbnailView.setVisibility(VISIBLE);
|
thumbnailView.setVisibility(VISIBLE);
|
||||||
|
@ -487,4 +500,19 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
public @NonNull List<Mention> getMentions() {
|
public @NonNull List<Mention> getMentions() {
|
||||||
return MentionAnnotation.getMentionsFromAnnotations(body);
|
return MentionAnnotation.getMentionsFromAnnotations(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private @NonNull ShapeAppearanceModel buildShapeAppearanceForLayoutDirection() {
|
||||||
|
int fourDp = (int) DimensionUnit.DP.toPixels(4);
|
||||||
|
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||||
|
return ShapeAppearanceModel.builder()
|
||||||
|
.setTopRightCorner(CornerFamily.ROUNDED, fourDp)
|
||||||
|
.setBottomRightCorner(CornerFamily.ROUNDED, fourDp)
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
return ShapeAppearanceModel.builder()
|
||||||
|
.setTopLeftCorner(CornerFamily.ROUNDED, fourDp)
|
||||||
|
.setBottomLeftCorner(CornerFamily.ROUNDED, fourDp)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,13 @@ public final class ConversationListItem extends ConstraintLayout
|
||||||
super.onLayout(changed, left, top, right, bottom);
|
super.onLayout(changed, left, top, right, bottom);
|
||||||
|
|
||||||
contactPhotoImage.getHitRect(newConversationAvatarTouchDelegateBounds);
|
contactPhotoImage.getHitRect(newConversationAvatarTouchDelegateBounds);
|
||||||
newConversationAvatarTouchDelegateBounds.left = left;
|
|
||||||
|
if (getLayoutDirection() == LAYOUT_DIRECTION_LTR) {
|
||||||
|
newConversationAvatarTouchDelegateBounds.left = left;
|
||||||
|
} else {
|
||||||
|
newConversationAvatarTouchDelegateBounds.right = right;
|
||||||
|
}
|
||||||
|
|
||||||
newConversationAvatarTouchDelegateBounds.top = top;
|
newConversationAvatarTouchDelegateBounds.top = top;
|
||||||
newConversationAvatarTouchDelegateBounds.bottom = bottom;
|
newConversationAvatarTouchDelegateBounds.bottom = bottom;
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,11 @@
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:background="@color/white"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
android:id="@+id/quote_thumbnail"
|
android:id="@+id/quote_thumbnail"
|
||||||
android:layout_width="@dimen/quote_thumb_size"
|
android:layout_width="@dimen/quote_thumb_size"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
Loading…
Add table
Reference in a new issue