comments: add dark colors upd

This commit is contained in:
Yuriy Liskov
2024-12-18 09:42:58 +02:00
parent af9ed6950b
commit 62da6b1308
4 changed files with 8 additions and 7 deletions

View File

@ -21,6 +21,7 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.util.SparseArray;
@ -30,6 +31,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.LayoutRes;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -770,20 +772,17 @@ 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);
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()));
Drawable shapeBackground = ContextCompat.getDrawable(bubble.getContext(), R.drawable.shape_incoming_message_focused);
bubble.setBackground(new LayerDrawable(new Drawable[]{originalBackground, shapeBackground}));
} else {
// Revert to original
Drawable originalBackground = messagesListStyle.getIncomingBubbleDrawable();
bubble.setBackground(originalBackground);
text.setTextColor(messagesListStyle.getIncomingTextColor());
}
if (hasFocus) {

View File

@ -29,6 +29,6 @@
<color name="dialog_date_text">@color/warm_grey_two</color>
<color name="dialog_unread_text">@color/white</color>
<color name="dialog_unread_bubble">@color/dark_mint</color>
<color name="tg_selected_bg">#c2dcf2</color>
<color name="tg_selected_bg">#1EC2DCF2</color>
</resources>

View File

@ -19,7 +19,8 @@
<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="comments_bg">#90303030</color>
<color name="comments_bg_pressed">#903E3E3E</color>
<color name="semi_grey">#64282828</color>
<color name="grey">#282828</color>
<color name="dimming">#D0000000</color>

View File

@ -60,6 +60,7 @@
app:incomingAvatarWidth="30dp"
app:incomingAvatarHeight="30dp"
app:incomingDefaultBubbleColor="@color/comments_bg"
app:incomingDefaultBubblePressedColor="@color/comments_bg_pressed"
app:incomingTextColor="@color/white"
/>