From 2ac2faa923b80f12ad0ec67d3bb8cbea40d0b0dc Mon Sep 17 00:00:00 2001 From: maksimillano Date: Fri, 29 Nov 2024 02:35:17 +0300 Subject: [PATCH] ChatListCell redrawing fix --- .../src/main/java/org/telegram/ui/Cells/ChatListCell.java | 7 ++++++- .../main/java/org/telegram/ui/Components/RadioButton.java | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatListCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatListCell.java index d54cd24ec..da87d3932 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatListCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatListCell.java @@ -45,6 +45,7 @@ public class ChatListCell extends LinearLayout { ListView.this.invalidate(); } }; + button.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked)); button.setSize(AndroidUtilities.dp(20)); addView(button, LayoutHelper.createFrame(22, 22, Gravity.RIGHT | Gravity.TOP, 0, 26, 10, 0)); button.setChecked(isThreeLines && SharedConfig.useThreeLinesLayout || !isThreeLines && !SharedConfig.useThreeLinesLayout, false); @@ -57,7 +58,11 @@ public class ChatListCell extends LinearLayout { int g = Color.green(color); int b = Color.blue(color); - button.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked)); + int buttonColor = Theme.getColor(Theme.key_radioBackground); + int buttonCheckedColor = Theme.getColor(Theme.key_radioBackgroundChecked); + if (button.getColor() != buttonColor || button.getCheckedColor() != buttonCheckedColor) { + button.setColor(buttonColor, buttonCheckedColor); + } rect.set(AndroidUtilities.dp(1), AndroidUtilities.dp(1), getMeasuredWidth() - AndroidUtilities.dp(1), AndroidUtilities.dp(73)); Theme.chat_instantViewRectPaint.setColor(Color.argb((int) (43 * button.getProgress()), r, g, b)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RadioButton.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RadioButton.java index 850c9a0eb..0194dd1f6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RadioButton.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RadioButton.java @@ -114,6 +114,10 @@ public class RadioButton extends View { invalidate(); } + public int getCheckedColor() { + return checkedColor; + } + public void setCheckedColor(int color2) { checkedColor = color2; invalidate();