6.6.2 - Alpha4 - 优化部分控件主题色与背景色对比度过低时的视觉体验
This commit is contained in:
@@ -6,9 +6,11 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import com.afollestad.materialdialogs.Theme;
|
||||
import org.autojs.autojs.theme.ThemeColor;
|
||||
import org.autojs.autojs.theme.ThemeColorManager;
|
||||
import org.autojs.autojs.theme.ThemeColorMutable;
|
||||
import org.autojs.autojs.util.ColorUtils;
|
||||
|
||||
/**
|
||||
* Created by Stardust on Mar 5, 2017.
|
||||
@@ -21,7 +23,7 @@ public class ThemeColorMaterialDialogBuilder extends MaterialDialog.Builder impl
|
||||
|
||||
@Override
|
||||
public void setThemeColor(ThemeColor themeColor) {
|
||||
int color = themeColor.colorPrimary;
|
||||
int color = ColorUtils.adjustColorForContrast(backgroundColor, themeColor.colorPrimary, 2.3);
|
||||
positiveColor(color);
|
||||
negativeColor(color);
|
||||
neutralColor(color);
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import org.autojs.autojs.theme.ThemeColor;
|
||||
import org.autojs.autojs.theme.ThemeColorManager;
|
||||
import org.autojs.autojs.theme.ThemeColorMutable;
|
||||
import org.autojs.autojs.util.ColorUtils;
|
||||
import org.autojs.autojs6.R;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,9 @@ public class ThemeColorSwipeRefreshLayout extends SwipeRefreshLayout implements
|
||||
|
||||
@Override
|
||||
public void setThemeColor(ThemeColor themeColor) {
|
||||
setColorSchemeColors(themeColor.colorPrimary);
|
||||
int backgroundColor = getContext().getColor(R.color.swipe_refresh_background);
|
||||
int adjustedColor = ColorUtils.adjustColorForContrast(backgroundColor, themeColor.colorPrimary, 2.3);
|
||||
setColorSchemeColors(adjustedColor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.autojs.autojs.theme.ThemeColorMutable;
|
||||
* Created by Stardust on Aug 7, 2016.
|
||||
*/
|
||||
public class ThemeColorSwitch extends SwitchCompat implements ThemeColorMutable {
|
||||
|
||||
public ThemeColorSwitch(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
@@ -35,6 +36,7 @@ public class ThemeColorSwitch extends SwitchCompat implements ThemeColorMutable
|
||||
|
||||
@Override
|
||||
public void setThemeColor(ThemeColor color) {
|
||||
ThemeColorHelper.setColorPrimary(this, color.colorPrimary);
|
||||
ThemeColorHelper.setColorPrimary(this, color.colorPrimary, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -653,6 +653,7 @@ object ColorUtils {
|
||||
* @return The adjusted color. (zh-CN: 调整后的颜色.)
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun adjustColorForContrast(
|
||||
@ColorInt background: Int,
|
||||
@ColorInt reference: Int,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Wed Mar 19 00:38:56 CST 2025
|
||||
BUILD_TIME=1742315936702
|
||||
#Wed Mar 19 00:50:23 CST 2025
|
||||
BUILD_TIME=1742316623695
|
||||
COMPILE_SDK_VERSION=35
|
||||
JAVA_VERSION=23
|
||||
JAVA_VERSION_MIN_RADICAL=0
|
||||
|
||||
Reference in New Issue
Block a user