Merge pull request #3119 from nextcloud/issue_2780_author_name

Authors Name is now above incoming previewed messages
This commit is contained in:
Andy Scherzinger 2023-06-24 19:34:11 +02:00 committed by GitHub
commit 55bdf44585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -34,6 +34,7 @@ import com.nextcloud.talk.databinding.ItemCustomIncomingPreviewMessageBinding;
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
import com.nextcloud.talk.models.json.chat.ChatMessage;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.emoji2.widget.EmojiTextView;
@ -46,15 +47,17 @@ public class IncomingPreviewMessageViewHolder extends PreviewMessageViewHolder {
}
@Override
public void onBind(ChatMessage message) {
public void onBind(@NonNull ChatMessage message) {
super.onBind(message);
binding.messageAuthor.setText(message.getActorDisplayName());
binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));
binding.messageTime.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));
}
@NonNull
@Override
public EmojiTextView getMessageText() {
return binding.messageText;
@ -65,21 +68,25 @@ public class IncomingPreviewMessageViewHolder extends PreviewMessageViewHolder {
return binding.progressBar;
}
@NonNull
@Override
public View getPreviewContainer() {
return binding.previewContainer;
}
@NonNull
@Override
public MaterialCardView getPreviewContactContainer() {
return binding.contactContainer;
}
@NonNull
@Override
public ImageView getPreviewContactPhoto() {
return binding.contactPhoto;
}
@NonNull
@Override
public EmojiTextView getPreviewContactName() {
return binding.contactName;

View file

@ -52,6 +52,19 @@
app:flexWrap="wrap"
app:justifyContent="flex_end">
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/messageAuthor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:alpha="0.6"
android:textAlignment="viewStart"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
android:textSize="12sp"
tools:ignore="TextContrastCheck"
tools:text="Jane Doe" />
<FrameLayout
android:id="@+id/preview_container"
android:layout_width="wrap_content"
@ -160,6 +173,7 @@
app:layout_alignSelf="flex_start"
app:layout_flexGrow="1"
app:layout_wrapBefore="true"
tools:ignore="TextContrastCheck"
tools:text="A simple message" />
<TextView
@ -173,6 +187,7 @@
android:gravity="end"
android:textColor="@color/no_emphasis_text"
app:layout_alignSelf="center"
tools:ignore="TextContrastCheck"
tools:text="12:38" />
<include