kopia lustrzana https://github.com/ryukoposting/Signal-Android
Adjust timestamp alignment.
rodzic
c65761a034
commit
e7c259b1e9
|
@ -179,7 +179,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
@Nullable private QuoteView quoteView;
|
@Nullable private QuoteView quoteView;
|
||||||
private EmojiTextView bodyText;
|
private EmojiTextView bodyText;
|
||||||
private ConversationItemFooter footer;
|
private ConversationItemFooter footer;
|
||||||
private ConversationItemFooter stickerFooter;
|
@Nullable private ConversationItemFooter stickerFooter;
|
||||||
@Nullable private TextView groupSender;
|
@Nullable private TextView groupSender;
|
||||||
@Nullable private View groupSenderHolder;
|
@Nullable private View groupSenderHolder;
|
||||||
private AvatarImageView contactPhoto;
|
private AvatarImageView contactPhoto;
|
||||||
|
@ -386,7 +386,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int defaultMargin = readDimen(R.dimen.message_bubble_default_footer_bottom_margin);
|
int defaultTopMargin = readDimen(R.dimen.message_bubble_default_footer_bottom_margin);
|
||||||
|
int defaultBottomMargin = readDimen(R.dimen.message_bubble_bottom_padding);
|
||||||
|
int collapsedBottomMargin = readDimen(R.dimen.message_bubble_collapsed_bottom_padding);
|
||||||
if (!updatingFooter &&
|
if (!updatingFooter &&
|
||||||
!isCaptionlessMms(messageRecord) &&
|
!isCaptionlessMms(messageRecord) &&
|
||||||
!isViewOnceMessage(messageRecord) &&
|
!isViewOnceMessage(messageRecord) &&
|
||||||
|
@ -394,36 +396,39 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
isFooterVisible(messageRecord, nextMessageRecord, groupThread) &&
|
isFooterVisible(messageRecord, nextMessageRecord, groupThread) &&
|
||||||
bodyText.getLastLineWidth() > 0)
|
bodyText.getLastLineWidth() > 0)
|
||||||
{
|
{
|
||||||
TextView dateView = footer.getDateView();
|
TextView dateView = footer.getDateView();
|
||||||
int footerWidth = footer.getMeasuredWidth();
|
int footerWidth = footer.getMeasuredWidth();
|
||||||
int availableWidth = getAvailableMessageBubbleWidth(bodyText);
|
int availableWidth = getAvailableMessageBubbleWidth(bodyText);
|
||||||
int bottomDiff = (int) (bodyText.getPaint().getFontMetrics().bottom - dateView.getPaint().getFontMetrics().bottom);
|
int collapsedTopMargin = -1 * (dateView.getMeasuredHeight() + ViewUtil.dpToPx(4));
|
||||||
int topMargin = -1 * (dateView.getMeasuredHeight() + ViewUtil.dpToPx(7) + bottomDiff) + 1;
|
|
||||||
if (bodyText.isSingleLine()) {
|
if (bodyText.isSingleLine()) {
|
||||||
int maxBubbleWidth = hasBigImageLinkPreview(messageRecord) || hasThumbnail(messageRecord) ? readDimen(R.dimen.media_bubble_max_width) : getMaxBubbleWidth();
|
int maxBubbleWidth = hasBigImageLinkPreview(messageRecord) || hasThumbnail(messageRecord) ? readDimen(R.dimen.media_bubble_max_width) : getMaxBubbleWidth();
|
||||||
int bodyMargins = ViewUtil.getLeftMargin(bodyText) + ViewUtil.getRightMargin(bodyText);
|
int bodyMargins = ViewUtil.getLeftMargin(bodyText) + ViewUtil.getRightMargin(bodyText);
|
||||||
int sizeWithMargins = bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins;
|
int sizeWithMargins = bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins;
|
||||||
int minSize = Math.min(maxBubbleWidth, Math.max(bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins, bodyBubble.getMeasuredWidth()));
|
int minSize = Math.min(maxBubbleWidth, Math.max(bodyText.getMeasuredWidth() + ViewUtil.dpToPx(6) + footerWidth + bodyMargins, bodyBubble.getMeasuredWidth()));
|
||||||
if (hasQuote(messageRecord) && sizeWithMargins < availableWidth) {
|
if (hasQuote(messageRecord) && sizeWithMargins < availableWidth) {
|
||||||
ViewUtil.setTopMargin(footer, topMargin);
|
ViewUtil.setTopMargin(footer, collapsedTopMargin);
|
||||||
|
ViewUtil.setBottomMargin(footer, collapsedBottomMargin);
|
||||||
needsMeasure = true;
|
needsMeasure = true;
|
||||||
updatingFooter = true;
|
updatingFooter = true;
|
||||||
} else if (sizeWithMargins != bodyText.getMeasuredWidth() && sizeWithMargins <= minSize) {
|
} else if (sizeWithMargins != bodyText.getMeasuredWidth() && sizeWithMargins <= minSize) {
|
||||||
bodyBubble.getLayoutParams().width = minSize;
|
bodyBubble.getLayoutParams().width = minSize;
|
||||||
ViewUtil.setTopMargin(footer, topMargin);
|
ViewUtil.setTopMargin(footer, collapsedTopMargin);
|
||||||
|
ViewUtil.setBottomMargin(footer, collapsedBottomMargin);
|
||||||
needsMeasure = true;
|
needsMeasure = true;
|
||||||
updatingFooter = true;
|
updatingFooter = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!updatingFooter && bodyText.getLastLineWidth() + ViewUtil.dpToPx(6) + footerWidth <= bodyText.getMeasuredWidth()) {
|
if (!updatingFooter && bodyText.getLastLineWidth() + ViewUtil.dpToPx(6) + footerWidth <= bodyText.getMeasuredWidth()) {
|
||||||
ViewUtil.setTopMargin(footer, topMargin);
|
ViewUtil.setTopMargin(footer, collapsedTopMargin);
|
||||||
|
ViewUtil.setBottomMargin(footer, collapsedBottomMargin);
|
||||||
updatingFooter = true;
|
updatingFooter = true;
|
||||||
needsMeasure = true;
|
needsMeasure = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!updatingFooter && ViewUtil.getTopMargin(footer) != defaultMargin) {
|
if (!updatingFooter && ViewUtil.getTopMargin(footer) != defaultTopMargin) {
|
||||||
ViewUtil.setTopMargin(footer, defaultMargin);
|
ViewUtil.setTopMargin(footer, defaultTopMargin);
|
||||||
|
ViewUtil.setBottomMargin(footer, defaultBottomMargin);
|
||||||
needsMeasure = true;
|
needsMeasure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,7 +1375,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_default_footer_bottom_margin));
|
ViewUtil.setTopMargin(footer, readDimen(R.dimen.message_bubble_default_footer_bottom_margin));
|
||||||
|
|
||||||
footer.setVisibility(GONE);
|
footer.setVisibility(GONE);
|
||||||
stickerFooter.setVisibility(GONE);
|
ViewUtil.setVisibilityIfNonNull(stickerFooter, GONE);
|
||||||
if (sharedContactStub.resolved()) sharedContactStub.get().getFooter().setVisibility(GONE);
|
if (sharedContactStub.resolved()) sharedContactStub.get().getFooter().setVisibility(GONE);
|
||||||
if (mediaThumbnailStub.resolved()) mediaThumbnailStub.require().getFooter().setVisibility(GONE);
|
if (mediaThumbnailStub.resolved()) mediaThumbnailStub.require().getFooter().setVisibility(GONE);
|
||||||
|
|
||||||
|
@ -1405,7 +1410,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConversationItemFooter getActiveFooter(@NonNull MessageRecord messageRecord) {
|
private ConversationItemFooter getActiveFooter(@NonNull MessageRecord messageRecord) {
|
||||||
if (hasNoBubble(messageRecord)) {
|
if (hasNoBubble(messageRecord) && stickerFooter != null) {
|
||||||
return stickerFooter;
|
return stickerFooter;
|
||||||
} else if (hasSharedContact(messageRecord) && TextUtils.isEmpty(messageRecord.getDisplayBody(getContext()))) {
|
} else if (hasSharedContact(messageRecord) && TextUtils.isEmpty(messageRecord.getDisplayBody(getContext()))) {
|
||||||
return sharedContactStub.get().getFooter();
|
return sharedContactStub.get().getFooter();
|
||||||
|
|
|
@ -19,9 +19,7 @@ package org.thoughtcrime.securesms.util;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -41,7 +39,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||||
import androidx.lifecycle.Lifecycle;
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
|
||||||
|
@ -229,6 +226,12 @@ public final class ViewUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setVisibilityIfNonNull(@Nullable View view, int visibility) {
|
||||||
|
if (view != null) {
|
||||||
|
view.setVisibility(visibility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getLeftMargin(@NonNull View view) {
|
public static int getLeftMargin(@NonNull View view) {
|
||||||
if (isLtr(view)) {
|
if (isLtr(view)) {
|
||||||
return ((ViewGroup.MarginLayoutParams) view.getLayoutParams()).leftMargin;
|
return ((ViewGroup.MarginLayoutParams) view.getLayoutParams()).leftMargin;
|
||||||
|
|
|
@ -203,7 +203,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
@ -233,7 +232,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/body_bubble"
|
android:layout_below="@id/body_bubble"
|
||||||
android:layout_alignStart="@id/body_bubble"
|
android:layout_alignStart="@id/body_bubble"
|
||||||
android:layout_marginTop="-8dp"
|
android:layout_marginTop="-4dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:rcv_outgoing="false" />
|
app:rcv_outgoing="false" />
|
||||||
|
|
||||||
|
|
|
@ -127,21 +127,6 @@
|
||||||
app:footer_reveal_dot_color="@color/signal_icon_tint_secondary"
|
app:footer_reveal_dot_color="@color/signal_icon_tint_secondary"
|
||||||
app:footer_text_color="@color/signal_text_secondary" />
|
app:footer_text_color="@color/signal_text_secondary" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
|
||||||
android:id="@+id/conversation_item_sticker_footer"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
|
|
||||||
android:clipChildren="false"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:footer_icon_color="@color/signal_icon_tint_secondary"
|
|
||||||
app:footer_mode="incoming"
|
|
||||||
app:footer_reveal_dot_color="@color/signal_icon_tint_secondary"
|
|
||||||
app:footer_text_color="@color/signal_text_secondary" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble>
|
</org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.AlertView
|
<org.thoughtcrime.securesms.components.AlertView
|
||||||
|
@ -158,7 +143,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/body_bubble"
|
android:layout_below="@id/body_bubble"
|
||||||
android:layout_alignStart="@id/body_bubble"
|
android:layout_alignStart="@id/body_bubble"
|
||||||
android:layout_marginTop="-8dp"
|
android:layout_marginTop="-4dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:rcv_outgoing="false" />
|
app:rcv_outgoing="false" />
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
android:paddingStart="@dimen/message_bubble_horizontal_padding"
|
||||||
|
@ -185,7 +184,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/body_bubble"
|
android:layout_below="@id/body_bubble"
|
||||||
android:layout_alignEnd="@id/body_bubble"
|
android:layout_alignEnd="@id/body_bubble"
|
||||||
android:layout_marginTop="-8dp"
|
android:layout_marginTop="-4dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:rcv_outgoing="true" />
|
app:rcv_outgoing="true" />
|
||||||
|
|
||||||
|
|
|
@ -79,21 +79,6 @@
|
||||||
app:footer_reveal_dot_color="@color/conversation_item_sent_text_secondary_color"
|
app:footer_reveal_dot_color="@color/conversation_item_sent_text_secondary_color"
|
||||||
app:footer_text_color="@color/conversation_item_sent_text_secondary_color" />
|
app:footer_text_color="@color/conversation_item_sent_text_secondary_color" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
|
||||||
android:id="@+id/conversation_item_sticker_footer"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
|
|
||||||
android:clipChildren="false"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:footer_mode="outgoing"
|
|
||||||
app:footer_icon_color="@color/signal_icon_tint_secondary"
|
|
||||||
app:footer_reveal_dot_color="@color/signal_icon_tint_secondary"
|
|
||||||
app:footer_text_color="@color/signal_text_secondary" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble>
|
</org.thoughtcrime.securesms.conversation.ConversationItemBodyBubble>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.AlertView
|
<org.thoughtcrime.securesms.components.AlertView
|
||||||
|
@ -112,7 +97,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/body_bubble"
|
android:layout_below="@id/body_bubble"
|
||||||
android:layout_alignEnd="@id/body_bubble"
|
android:layout_alignEnd="@id/body_bubble"
|
||||||
android:layout_marginTop="-8dp"
|
android:layout_marginTop="-4dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:rcv_outgoing="true" />
|
app:rcv_outgoing="true" />
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
<dimen name="message_bubble_collapsed_footer_padding">6dp</dimen>
|
<dimen name="message_bubble_collapsed_footer_padding">6dp</dimen>
|
||||||
<dimen name="message_bubble_edge_margin">32dp</dimen>
|
<dimen name="message_bubble_edge_margin">32dp</dimen>
|
||||||
<dimen name="message_bubble_bottom_padding">7dp</dimen>
|
<dimen name="message_bubble_bottom_padding">7dp</dimen>
|
||||||
|
<dimen name="message_bubble_collapsed_bottom_padding">7dp</dimen>
|
||||||
<dimen name="message_bubble_revealable_padding">12dp</dimen>
|
<dimen name="message_bubble_revealable_padding">12dp</dimen>
|
||||||
<dimen name="media_bubble_remove_button_size">24dp</dimen>
|
<dimen name="media_bubble_remove_button_size">24dp</dimen>
|
||||||
<dimen name="media_bubble_edit_button_size">24dp</dimen>
|
<dimen name="media_bubble_edit_button_size">24dp</dimen>
|
||||||
|
|
Ładowanie…
Reference in New Issue