Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,23 @@ public void onBind(@NonNull ChatMessage message) {
binding.messageTime.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));

binding.messageEditIndicator.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));

if(!message.isThread()) {
binding.threadTitleWrapperContainer.setVisibility(View.GONE);
} else {
binding.threadTitleWrapperContainer.setVisibility(View.VISIBLE);
}
}

@NonNull
@Override
public android.widget.TextView getMessageEditIndicator() {
return binding.messageEditIndicator;
}


@NonNull
@Override
public EmojiTextView getMessageText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.google.android.material.card.MaterialCardView;
import com.nextcloud.talk.R;
import com.nextcloud.talk.databinding.ItemCustomOutcomingPreviewMessageBinding;
import com.nextcloud.talk.databinding.ItemThreadTitleBinding;
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
import com.nextcloud.talk.chat.data.model.ChatMessage;
import com.nextcloud.talk.models.json.chat.ReadStatus;
import com.nextcloud.talk.utils.TextMatchers;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Objects;
Expand Down Expand Up @@ -90,6 +93,33 @@ public void onBind(@NonNull ChatMessage message) {
binding.messageTime.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));

binding.messageEditIndicator.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
R.color.no_emphasis_text));

binding.checkMark.setVisibility(View.GONE);
Integer readStatusDrawableInt = null;
String readStatusContentDescriptionString = null;
if (message.getReadStatus() == ReadStatus.READ) {
readStatusDrawableInt = R.drawable.ic_check_all;
readStatusContentDescriptionString =
binding.checkMark.getContext().getString(R.string.nc_message_read);
} else if (message.getReadStatus() == ReadStatus.SENT) {
readStatusDrawableInt = R.drawable.ic_check;
readStatusContentDescriptionString =
binding.checkMark.getContext().getString(R.string.nc_message_sent);
}

if (readStatusDrawableInt != null) {
binding.checkMark.setVisibility(View.VISIBLE);
binding.checkMark.setImageDrawable(ContextCompat.getDrawable(binding.checkMark.getContext(),
readStatusDrawableInt));
if (viewThemeUtils != null) {
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark);
}
}
binding.checkMark.setContentDescription(readStatusContentDescriptionString);


if(!message.isThread()) {
binding.threadTitleWrapperContainer.setVisibility(View.GONE);
} else {
Expand Down Expand Up @@ -146,4 +176,9 @@ public ProgressBar getPreviewContactProgressBar() {
@NonNull
@Override
public EmojiTextView getMessageCaption() { return binding.messageCaption; }

@Override
public @NotNull TextView getMessageEditIndicator() {
return binding.messageEditIndicator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.emoji2.widget.EmojiTextView
Expand Down Expand Up @@ -99,7 +100,13 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
super.onBind(message)
image.minimumHeight = DisplayUtils.convertDpToPixel(MIN_IMAGE_HEIGHT, context!!).toInt()

time.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
if (message.lastEditTimestamp != 0L && !message.isDeleted) {
time.text = dateUtils.getLocalTimeStringFromTimestamp(message.lastEditTimestamp!!)
messageEditIndicator.visibility = View.VISIBLE
} else {
time.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
messageEditIndicator.visibility = View.GONE
}

viewThemeUtils!!.platform.colorCircularProgressBar(progressBar!!, ColorRole.PRIMARY)
clickView = image
Expand Down Expand Up @@ -342,6 +349,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
abstract val previewContactPhoto: ImageView
abstract val previewContactName: EmojiTextView
abstract val previewContactProgressBar: ProgressBar?
abstract val messageEditIndicator: TextView

companion object {
private const val TAG = "PreviewMsgViewHolder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ class MessageActionsDialog(
) &&
!isOlderThanTwentyFourHours

private val messageHasCaptions = messageHasFileAttachment && message.message != "{file}" && !message.isDeleted

private var messageIsEditable = hasSpreedFeatureCapability(
spreedCapabilities,
SpreedFeatures.EDIT_MESSAGES
) &&
messageHasRegularText &&
(messageHasRegularText || messageHasCaptions) &&
!isOlderThanTwentyFourHours &&
isUserAllowedToEdit

Expand Down
52 changes: 33 additions & 19 deletions app/src/main/res/layout/item_custom_incoming_preview_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,14 @@
app:layout_alignSelf="flex_start"
app:layout_flexGrow="1"
app:layout_wrapBefore="true"
tools:ignore="TextContrastCheck"
tools:text="A simple message" />

<TextView
android:id="@id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/standard_half_padding"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="2dp"
android:alpha="0.6"
android:gravity="end"
android:textColor="@color/no_emphasis_text"
app:layout_alignSelf="center"
tools:ignore="TextContrastCheck"
tools:text="12:38" />

<androidx.emoji2.widget.EmojiTextView
android:id="@+id/messageCaption"
android:padding="@dimen/standard_half_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="4dp"
android:textColor="@color/high_emphasis_text"
android:textIsSelectable="false"
android:textSize="@dimen/chat_text_size"
Expand All @@ -205,9 +188,40 @@
tools:ignore="TextContrastCheck"
tools:text="This is my caption" />

<TextView
android:id="@id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messageCaption"
android:layout_marginStart="8dp"
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
android:gravity="end"
app:layout_alignSelf="flex_end"
app:layout_flexGrow="1"
app:layout_wrapBefore="false"
tools:text="12:38" />


<TextView
android:id="@+id/messageEditIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messageCaption"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="flex_end"
android:text = "@string/hint_edited_message"
android:textSize="12sp">
</TextView>

<include
android:id="@+id/reactions"
layout="@layout/reactions_inside_message" />
</com.google.android.flexbox.FlexboxLayout>

</RelativeLayout>
</com.google.android.flexbox.FlexboxLayout>
</RelativeLayout>
57 changes: 42 additions & 15 deletions app/src/main/res/layout/item_custom_outcoming_preview_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,12 @@
app:layout_wrapBefore="true"
tools:text="A simple message" />

<TextView
android:id="@id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/standard_half_padding"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="2dp"
android:alpha="0.6"
android:gravity="end"
android:textColor="@color/no_emphasis_text"
app:layout_alignSelf="center"
tools:text="12:34" />

<androidx.emoji2.widget.EmojiTextView
android:id="@+id/messageCaption"
android:padding="@dimen/standard_half_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="4dp"
android:textColor="@color/high_emphasis_text"
android:textIsSelectable="false"
android:textSize="@dimen/chat_text_size"
Expand All @@ -178,6 +163,48 @@
tools:ignore="TextContrastCheck"
tools:text="This is my caption" />

<TextView
android:id="@id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messageCaption"
android:layout_marginStart="8dp"
android:alpha="0.6"
android:gravity="end"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="flex_end"
app:layout_flexGrow="1"
app:layout_wrapBefore="false"
tools:text="10:35" />

<TextView
android:id="@+id/messageEditIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messageCaption"
android:layout_marginStart="8dp"
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="flex_end"
android:text = "@string/hint_edited_message"
android:textSize="12sp">

</TextView>

<ImageView
android:id="@+id/checkMark"
android:layout_width="25dp"
android:layout_height="@dimen/message_bubble_checkmark_height"
android:layout_below="@id/messageTime"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:contentDescription="@null"
app:layout_alignSelf="flex_end"
app:tint="@color/high_emphasis_text"
tools:src="@drawable/ic_check_all" />

<include
android:id="@+id/reactions"
layout="@layout/reactions_inside_message" />
Expand Down
Loading