Skip to content

Commit

Permalink
Formatting changes + Fixes bug (hopefully)
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <[email protected]>
  • Loading branch information
rapterjet2004 committed Nov 8, 2023
1 parent 82952dd commit d94e964
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.nextcloud.talk.utils.TextMatchers;

import java.util.HashMap;
import java.util.Objects;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
Expand All @@ -55,7 +56,7 @@ public IncomingPreviewMessageViewHolder(View itemView, Object payload) {
public void onBind(@NonNull ChatMessage message) {
super.onBind(message);
if(!message.isVoiceMessage()
&& !binding.messageCaption.getText().toString().equals("{file}")
&& !Objects.equals(message.getMessage(), "{file}")
) {
Spanned processedMessageText = null;
if (viewThemeUtils != null ) {
Expand Down Expand Up @@ -87,12 +88,14 @@ public void onBind(@NonNull ChatMessage message) {
textSize = (float) (textSize * IncomingTextMessageViewHolder.TEXT_SIZE_MULTIPLIER);
itemView.setSelected(true);
}
binding.messageCaption.setVisibility(View.VISIBLE);
binding.messageCaption.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
binding.messageCaption.setText(processedMessageText);
binding.incomingPreviewMessageBubble.setBackgroundResource(R.drawable.shape_grouped_incoming_message);
viewThemeUtils.talk.themeIncomingMessageBubble(binding.incomingPreviewMessageBubble, true, false);
} else {
binding.incomingPreviewMessageBubble.setBackground(null);
binding.messageCaption.setVisibility(View.GONE);
}
binding.messageAuthor.setText(message.getActorDisplayName());
binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.nextcloud.talk.utils.TextMatchers;

import java.util.HashMap;
import java.util.Objects;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
Expand All @@ -54,7 +55,7 @@ public OutcomingPreviewMessageViewHolder(View itemView) {
public void onBind(@NonNull ChatMessage message) {
super.onBind(message);
if(!message.isVoiceMessage()
&& !binding.messageCaption.getText().toString().equals("{file}")
&& !Objects.equals(message.getMessage(), "{file}")
) {
Spanned processedMessageText = null;
if (viewThemeUtils != null) {
Expand Down Expand Up @@ -86,12 +87,14 @@ public void onBind(@NonNull ChatMessage message) {
textSize = (float)(textSize * IncomingTextMessageViewHolder.TEXT_SIZE_MULTIPLIER);
itemView.setSelected(true);
}
binding.messageCaption.setVisibility(View.VISIBLE);
binding.messageCaption.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
binding.messageCaption.setText(processedMessageText);
binding.outgoingPreviewMessageBubble.setBackgroundResource(R.drawable.shape_grouped_outcoming_message);
viewThemeUtils.talk.themeOutgoingMessageBubble(binding.outgoingPreviewMessageBubble, true, false);
} else {
binding.outgoingPreviewMessageBubble.setBackground(null);
binding.messageCaption.setVisibility(View.GONE);
}

binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
fileViewerUtils = FileViewerUtils(context!!, message.activeUser!!)
val fileName = message.selectedIndividualHashMap!![KEY_NAME]

messageCaption.visibility = if (message.message != "{file}") {
View.VISIBLE
} else {
View.GONE
}
messageText.text = fileName

if (message.activeUser != null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:paddingHorizontal="@dimen/standard_half_padding"
android:alpha="0.6"
android:autoLink="none"
android:textAlignment="viewStart"
Expand All @@ -179,6 +180,7 @@
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
android:id="@id/messageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:paddingHorizontal="@dimen/standard_half_padding"
android:alpha="0.6"
android:autoLink="none"
android:textColor="@color/no_emphasis_text"
Expand All @@ -156,6 +156,7 @@
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"
Expand Down

0 comments on commit d94e964

Please sign in to comment.