ChatListCell redrawing fix

This commit is contained in:
maksimillano 2024-11-29 02:35:17 +03:00 committed by Maksimillano
parent fb2e545101
commit 2ac2faa923
2 changed files with 10 additions and 1 deletions

View file

@ -45,6 +45,7 @@ public class ChatListCell extends LinearLayout {
ListView.this.invalidate(); ListView.this.invalidate();
} }
}; };
button.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked));
button.setSize(AndroidUtilities.dp(20)); button.setSize(AndroidUtilities.dp(20));
addView(button, LayoutHelper.createFrame(22, 22, Gravity.RIGHT | Gravity.TOP, 0, 26, 10, 0)); addView(button, LayoutHelper.createFrame(22, 22, Gravity.RIGHT | Gravity.TOP, 0, 26, 10, 0));
button.setChecked(isThreeLines && SharedConfig.useThreeLinesLayout || !isThreeLines && !SharedConfig.useThreeLinesLayout, false); button.setChecked(isThreeLines && SharedConfig.useThreeLinesLayout || !isThreeLines && !SharedConfig.useThreeLinesLayout, false);
@ -57,7 +58,11 @@ public class ChatListCell extends LinearLayout {
int g = Color.green(color); int g = Color.green(color);
int b = Color.blue(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)); 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)); Theme.chat_instantViewRectPaint.setColor(Color.argb((int) (43 * button.getProgress()), r, g, b));

View file

@ -114,6 +114,10 @@ public class RadioButton extends View {
invalidate(); invalidate();
} }
public int getCheckedColor() {
return checkedColor;
}
public void setCheckedColor(int color2) { public void setCheckedColor(int color2) {
checkedColor = color2; checkedColor = color2;
invalidate(); invalidate();