fix displaying of sticker's footer

This commit is contained in:
adbenitez
2023-10-04 03:28:21 +02:00
parent 44376a6046
commit ce1733f3ea
7 changed files with 28 additions and 53 deletions
+1 -19
View File
@@ -122,7 +122,7 @@
android:id="@+id/sticker_view_stub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/conversation_item_received_sticker" />
android:layout="@layout/conversation_item_sticker" />
<ViewStub
android:id="@+id/audio_view_stub"
@@ -201,24 +201,6 @@
android:alpha="0.7"
app:footer_text_color="?conversation_item_incoming_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_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
android:layout_marginTop="3dp"
android:paddingTop="@dimen/transparent_footer_padding"
android:paddingBottom="@dimen/transparent_footer_padding"
android:paddingLeft="@dimen/transparent_footer_padding"
android:paddingRight="@dimen/transparent_footer_padding"
android:layout_gravity="end"
android:gravity="end"
android:clipChildren="false"
android:clipToPadding="false"
android:background="@drawable/conversation_item_update_background"
app:footer_text_color="@color/core_dark_05"/>
</LinearLayout>
<org.thoughtcrime.securesms.reactions.ReactionsConversationView
+1 -19
View File
@@ -100,7 +100,7 @@
android:id="@+id/sticker_view_stub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/conversation_item_received_sticker" />
android:layout="@layout/conversation_item_sticker" />
<ViewStub
android:id="@+id/audio_view_stub"
@@ -178,24 +178,6 @@
android:clipToPadding="false"
app:footer_text_color="?attr/conversation_item_outgoing_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_marginLeft="@dimen/message_bubble_horizontal_padding"
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
android:layout_marginTop="3dp"
android:paddingTop="@dimen/transparent_footer_padding"
android:paddingBottom="@dimen/transparent_footer_padding"
android:paddingLeft="@dimen/transparent_footer_padding"
android:paddingRight="@dimen/transparent_footer_padding"
android:layout_gravity="end"
android:gravity="end"
android:clipChildren="false"
android:clipToPadding="false"
android:background="@drawable/conversation_item_update_background"
app:footer_text_color="@color/core_dark_05"/>
</LinearLayout>
<org.thoughtcrime.securesms.reactions.ReactionsConversationView
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.BorderlessImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_view"
android:layout_width="@dimen/media_bubble_sticker_dimens"
android:layout_height="@dimen/media_bubble_sticker_dimens"
android:contentDescription="@string/sticker" />
+13
View File
@@ -23,4 +23,17 @@
app:minHeight="@dimen/media_bubble_min_height"
app:maxHeight="@dimen/media_bubble_max_height" />
<org.thoughtcrime.securesms.components.ConversationItemFooter
android:id="@+id/sticker_footer"
android:background="@drawable/conversation_item_update_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:gravity="bottom|end"
android:paddingTop="@dimen/transparent_footer_padding"
android:paddingBottom="@dimen/transparent_footer_padding"
android:paddingLeft="@dimen/transparent_footer_padding"
android:paddingRight="@dimen/transparent_footer_padding"
app:footer_text_color="@color/core_white"/>
</merge>
@@ -100,7 +100,6 @@ public class ConversationItem extends BaseConversationItem
protected View replyView;
@Nullable private QuoteView quoteView;
private ConversationItemFooter footer;
private ConversationItemFooter stickerFooter;
private ReactionsConversationView reactionsView;
private TextView groupSender;
private View groupSenderHolder;
@@ -138,7 +137,6 @@ public class ConversationItem extends BaseConversationItem
this.bodyText = findViewById(R.id.conversation_item_body);
this.footer = findViewById(R.id.conversation_item_footer);
this.stickerFooter = findViewById(R.id.conversation_item_sticker_footer);
this.reactionsView = findViewById(R.id.reactions_view);
this.groupSender = findViewById(R.id.group_message_sender);
this.contactPhoto = findViewById(R.id.contact_photo);
@@ -324,7 +322,7 @@ public class ConversationItem extends BaseConversationItem
} else if (mediaThumbnailStub.resolved() && mediaThumbnailStub.get().getVisibility() == View.VISIBLE) {
desc += mediaThumbnailStub.get().getDescription() + "\n";
} else if (stickerStub.resolved() && stickerStub.get().getVisibility() == View.VISIBLE) {
desc += context.getString(R.string.sticker) + "\n";
desc += stickerStub.get().getDescription() + "\n";
}
if (bodyText.getVisibility() == View.VISIBLE) {
@@ -332,9 +330,7 @@ public class ConversationItem extends BaseConversationItem
}
if (footer.getVisibility() == View.VISIBLE) {
desc += footer.getDescription() + "\n";
} else if (stickerFooter.getVisibility() == View.VISIBLE) {
desc += stickerFooter.getDescription() + "\n";
desc += footer.getDescription();
}
this.setContentDescription(desc);
@@ -714,7 +710,6 @@ public class ConversationItem extends BaseConversationItem
ViewUtil.updateLayoutParams(footer, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
footer.setVisibility(GONE);
stickerFooter.setVisibility(GONE);
if (mediaThumbnailStub.resolved()) mediaThumbnailStub.get().getFooter().setVisibility(GONE);
ConversationItemFooter activeFooter = getActiveFooter(current);
@@ -744,7 +739,7 @@ public class ConversationItem extends BaseConversationItem
private ConversationItemFooter getActiveFooter(@NonNull DcMsg messageRecord) {
if (hasSticker(messageRecord)) {
return stickerFooter;
return stickerStub.get().getFooter();
} else if (hasOnlyThumbnail(messageRecord) && TextUtils.isEmpty(messageRecord.getText())) {
return mediaThumbnailStub.get().getFooter();
} else {
@@ -18,6 +18,7 @@ public class BorderlessImageView extends FrameLayout {
private ThumbnailView image;
private View missingShade;
private ConversationItemFooter footer;
public BorderlessImageView(@NonNull Context context) {
super(context);
@@ -34,6 +35,7 @@ public class BorderlessImageView extends FrameLayout {
this.image = findViewById(R.id.sticker_thumbnail);
this.missingShade = findViewById(R.id.sticker_missing_shade);
this.footer = findViewById(R.id.sticker_footer);
}
@Override
@@ -65,6 +67,14 @@ public class BorderlessImageView extends FrameLayout {
missingShade.setVisibility(showControls ? View.VISIBLE : View.GONE);
}
public String getDescription() {
return getContext().getString(R.string.sticker) + "\n" + footer.getDescription();
}
public ConversationItemFooter getFooter() {
return footer;
}
public void setThumbnailClickListener(@NonNull SlideClickListener listener) {
image.setThumbnailClickListener(listener);
}