comments: add dark colors

This commit is contained in:
Yuriy Liskov
2024-12-18 08:14:04 +02:00
parent 2a875c5d8e
commit af9ed6950b
3 changed files with 22 additions and 1 deletions
@@ -20,6 +20,7 @@ import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.util.SparseArray;
@@ -29,8 +30,11 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.LayoutRes;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.liskovsoft.sharedutils.helpers.Helpers;
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.DebouncedOnClickListener;
import com.stfalcon.chatkit.commons.ImageLoader;
@@ -766,7 +770,21 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
// Change background of the focused message
// NOTE: you can have only one focus listener
View bubble = v.findViewById(R.id.bubble);
bubble.setBackgroundResource(hasFocus ? R.drawable.shape_incoming_message_focused : R.drawable.shape_incoming_message);
TextView text = v.findViewById(R.id.messageText);
//bubble.setBackgroundResource(hasFocus ? R.drawable.shape_incoming_message_focused : R.drawable.shape_incoming_message);
if (hasFocus) {
// Invert text and bg color
Drawable originalBackground = messagesListStyle.getIncomingBubbleDrawable();
DrawableCompat.setTint(originalBackground, messagesListStyle.getIncomingTextColor()); // keep original shape
bubble.setBackground(originalBackground);
text.setTextColor(Helpers.invertColor(messagesListStyle.getIncomingTextColor()));
} else {
// Revert to original
Drawable originalBackground = messagesListStyle.getIncomingBubbleDrawable();
bubble.setBackground(originalBackground);
text.setTextColor(messagesListStyle.getIncomingTextColor());
}
if (hasFocus) {
notifyMessageViewFocused(v, wrapper.item);
+1
View File
@@ -19,6 +19,7 @@
<color name="leanback">#0096A6</color>
<color name="semi_transparent">#64000000</color>
<color name="live_chat_bg">#90000000</color>
<color name="comments_bg">#904D4D4D</color>
<color name="semi_grey">#64282828</color>
<color name="grey">#282828</color>
<color name="dimming">#D0000000</color>
@@ -59,6 +59,8 @@
app:incomingBubblePaddingBottom="0sp"
app:incomingAvatarWidth="30dp"
app:incomingAvatarHeight="30dp"
app:incomingDefaultBubbleColor="@color/comments_bg"
app:incomingTextColor="@color/white"
/>
</LinearLayout>