Fix colors in high-contrast modes

This commit is contained in:
Grishka 2024-10-31 09:24:26 +03:00
parent d988e1aecf
commit 3582d7bdad
7 changed files with 18 additions and 5 deletions

View File

@ -9,12 +9,10 @@ import android.graphics.RectF;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.VibrationEffect; import android.os.VibrationEffect;
import android.os.Vibrator;
import android.view.HapticFeedbackConstants; import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;

View File

@ -36,7 +36,7 @@ public class CheckIconSelectableTextView extends TextView{
currentlySelected=isSelected(); currentlySelected=isSelected();
Drawable start=currentlySelected ? getResources().getDrawable(R.drawable.ic_baseline_check_18, getContext().getTheme()).mutate() : null; Drawable start=currentlySelected ? getResources().getDrawable(R.drawable.ic_baseline_check_18, getContext().getTheme()).mutate() : null;
if(start!=null) if(start!=null)
start.setTint(UiUtils.getThemeColor(getContext(), getCheckmarkColorAttribute())); start.setTintList(getTextColors());
Drawable end=getCompoundDrawablesRelative()[2]; Drawable end=getCompoundDrawablesRelative()[2];
setCompoundDrawablesRelativeWithIntrinsicBounds(start, null, end, null); setCompoundDrawablesRelativeWithIntrinsicBounds(start, null, end, null);
} }

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorM3PrimaryContainer" android:alpha="?composePollStyleInactiveAlpha"/>
</selector>

View File

@ -33,7 +33,7 @@
<layer-list> <layer-list>
<item> <item>
<shape android:shape="oval"> <shape android:shape="oval">
<solid android:color="?colorM3PrimaryContainer"/> <solid android:color="@color/bg_compose_poll_style_inactive"/>
</shape> </shape>
</item> </item>
<item> <item>

View File

@ -40,7 +40,7 @@
<layer-list> <layer-list>
<item> <item>
<shape android:shape="oval"> <shape android:shape="oval">
<solid android:color="?colorM3PrimaryContainer"/> <solid android:color="@color/bg_compose_poll_style_inactive"/>
</shape> </shape>
</item> </item>
<item> <item>

View File

@ -47,6 +47,8 @@
<attr name="colorRichTextContainer" format="color"/> <attr name="colorRichTextContainer" format="color"/>
<attr name="colorRichTextDecorations" format="color"/> <attr name="colorRichTextDecorations" format="color"/>
<attr name="composePollStyleInactiveAlpha" format="float"/>
<declare-styleable name="MaxWidthFrameLayout"> <declare-styleable name="MaxWidthFrameLayout">
<attr name="android:maxWidth" format="dimension"/> <attr name="android:maxWidth" format="dimension"/>
</declare-styleable> </declare-styleable>

View File

@ -82,6 +82,7 @@
<item name="android:textColorPrimary">?colorM3OnSurface</item> <item name="android:textColorPrimary">?colorM3OnSurface</item>
<item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item> <item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item>
<item name="android:textAppearanceLargePopupMenu">@style/popup_menu_item_text</item> <item name="android:textAppearanceLargePopupMenu">@style/popup_menu_item_text</item>
<item name="composePollStyleInactiveAlpha">1</item>
</style> </style>
<style name="Theme.Mastodon.Dark" parent="Theme.AppKit"> <style name="Theme.Mastodon.Dark" parent="Theme.AppKit">
@ -105,6 +106,7 @@
<item name="android:switchStyle">@style/Widget.Mastodon.M3.Switch</item> <item name="android:switchStyle">@style/Widget.Mastodon.M3.Switch</item>
<item name="android:windowActionModeOverlay">true</item> <item name="android:windowActionModeOverlay">true</item>
<item name="android:actionModeBackground">@color/m3_sys_dark_primary</item> <item name="android:actionModeBackground">@color/m3_sys_dark_primary</item>
<item name="android:actionModeStyle">@style/Widget.Mastodon.Toolbar.ActionMode</item>
<item name="android:actionModeCloseDrawable">@drawable/ic_actionmode_close</item> <item name="android:actionModeCloseDrawable">@drawable/ic_actionmode_close</item>
<item name="appkitEmptyTextAppearance">@style/empty_text</item> <item name="appkitEmptyTextAppearance">@style/empty_text</item>
@ -165,6 +167,7 @@
<item name="android:textColorPrimary">?colorM3OnSurface</item> <item name="android:textColorPrimary">?colorM3OnSurface</item>
<item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item> <item name="android:textColorSecondary">?colorM3OnSurfaceVariant</item>
<item name="android:textAppearanceLargePopupMenu">@style/popup_menu_item_text</item> <item name="android:textAppearanceLargePopupMenu">@style/popup_menu_item_text</item>
<item name="composePollStyleInactiveAlpha">1</item>
</style> </style>
<style name="Theme.Mastodon.Light.MediumContrast"> <style name="Theme.Mastodon.Light.MediumContrast">
@ -183,6 +186,8 @@
<item name="colorRichTextText">@color/ext_rich_text_text_light_medium_contrast</item> <item name="colorRichTextText">@color/ext_rich_text_text_light_medium_contrast</item>
<item name="colorRichTextContainer">@color/ext_rich_text_container_light_medium_contrast</item> <item name="colorRichTextContainer">@color/ext_rich_text_container_light_medium_contrast</item>
<item name="colorRichTextDecorations">@color/ext_rich_text_decoration_light_medium_contrast</item> <item name="colorRichTextDecorations">@color/ext_rich_text_decoration_light_medium_contrast</item>
<item name="composePollStyleInactiveAlpha">0.6</item>
</style> </style>
<style name="Theme.Mastodon.Light.HighContrast"> <style name="Theme.Mastodon.Light.HighContrast">
@ -201,12 +206,16 @@
<item name="colorRichTextText">@color/ext_rich_text_text_light_high_contrast</item> <item name="colorRichTextText">@color/ext_rich_text_text_light_high_contrast</item>
<item name="colorRichTextContainer">@color/ext_rich_text_container_light_high_contrast</item> <item name="colorRichTextContainer">@color/ext_rich_text_container_light_high_contrast</item>
<item name="colorRichTextDecorations">@color/ext_rich_text_decoration_light_high_contrast</item> <item name="colorRichTextDecorations">@color/ext_rich_text_decoration_light_high_contrast</item>
<item name="composePollStyleInactiveAlpha">0.6</item>
</style> </style>
<style name="Theme.Mastodon.Dark.MediumContrast"> <style name="Theme.Mastodon.Dark.MediumContrast">
<item name="composePollStyleInactiveAlpha">0.6</item>
</style> </style>
<style name="Theme.Mastodon.Dark.HighContrast"> <style name="Theme.Mastodon.Dark.HighContrast">
<item name="composePollStyleInactiveAlpha">0.6</item>
</style> </style>
<style name="Theme.Mastodon.Dark.SplashFragment"> <style name="Theme.Mastodon.Dark.SplashFragment">