mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Add basic pinned message support.
This commit is contained in:
committed by
jeffrey-signal
parent
22701da765
commit
80598d42cc
@@ -55,6 +55,7 @@ public class ConversationItemFooter extends ConstraintLayout {
|
||||
private ExpirationTimerView timerView;
|
||||
private ImageView insecureIndicatorView;
|
||||
private DeliveryStatusView deliveryStatusView;
|
||||
private ImageView pinnedView;
|
||||
private boolean onlyShowSendingStatus;
|
||||
private TextView audioDuration;
|
||||
private LottieAnimationView revealDot;
|
||||
@@ -98,6 +99,7 @@ public class ConversationItemFooter extends ConstraintLayout {
|
||||
timerView = findViewById(R.id.footer_expiration_timer);
|
||||
insecureIndicatorView = findViewById(R.id.footer_insecure_indicator);
|
||||
deliveryStatusView = findViewById(R.id.footer_delivery_status);
|
||||
pinnedView = findViewById(R.id.footer_pinned);
|
||||
audioDuration = findViewById(R.id.footer_audio_duration);
|
||||
revealDot = findViewById(R.id.footer_revealed_dot);
|
||||
playbackSpeedToggleTextView = findViewById(R.id.footer_audio_playback_speed_toggle);
|
||||
@@ -143,6 +145,7 @@ public class ConversationItemFooter extends ConstraintLayout {
|
||||
presentInsecureIndicator(messageRecord);
|
||||
presentDeliveryStatus(messageRecord);
|
||||
presentAudioDuration(messageRecord);
|
||||
presentPinnedIcon(messageRecord);
|
||||
}
|
||||
|
||||
public void setAudioDuration(long totalDurationMillis, long currentPostionMillis) {
|
||||
@@ -174,6 +177,7 @@ public class ConversationItemFooter extends ConstraintLayout {
|
||||
timerView.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
insecureIndicatorView.setColorFilter(color);
|
||||
deliveryStatusView.setTint(color);
|
||||
pinnedView.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
public void setRevealDotColor(int color) {
|
||||
@@ -428,6 +432,14 @@ public class ConversationItemFooter extends ConstraintLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private void presentPinnedIcon(@NonNull MessageRecord messageRecord) {
|
||||
if (messageRecord.getPinnedUntil() > 0) {
|
||||
pinnedView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
pinnedView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showAudioDurationViews() {
|
||||
audioDuration.setVisibility(View.VISIBLE);
|
||||
revealDot.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -472,7 +472,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
}
|
||||
}
|
||||
|
||||
private void ellipsizeEmojiTextForMaxLines() {
|
||||
public void ellipsizeEmojiTextForMaxLines() {
|
||||
Runnable ellipsize = () -> {
|
||||
int maxLines = TextViewCompat.getMaxLines(EmojiTextView.this);
|
||||
if (maxLines <= 0 && maxLength < 0) {
|
||||
@@ -611,6 +611,13 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
}
|
||||
}
|
||||
|
||||
public void enableRenderSpoilers() {
|
||||
if (spoilerRendererDelegate == null) {
|
||||
renderSpoilers = true;
|
||||
spoilerRendererDelegate = new SpoilerRendererDelegate(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Due to some peculiarities in how TextView deals with touch events, it's really easy to accidentally trigger
|
||||
* a click (say, when you try to scroll but you're at the bottom of a view.) Because of this, we handle these
|
||||
|
||||
Reference in New Issue
Block a user