Drop hardcoded dynamic color

* Fix crash on api<S as well
This commit is contained in:
tarsin committed 2022-06-13 14:32:21 +08:00
1 parent e48ecac3cd
commit 1eb86355cb
8 files changed
+16 -19

No files matched your search

@@ -379,7 +379,7 @@ public class DownloadsScene extends ToolbarScene
mFastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable handlerDrawable = new HandlerDrawable();
handlerDrawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
handlerDrawable.setColor(ResourcesKt.resolveColor(getTheme(), com.google.android.material.R.attr.colorPrimary));
mFastScroller.setHandlerDrawable(handlerDrawable);
mFastScroller.setOnDragHandlerListener(this);
@@ -85,6 +85,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import rikka.core.res.ResourcesKt;
public class HistoryScene extends ToolbarScene {
/*---------------
@@ -232,7 +234,7 @@ public class HistoryScene extends ToolbarScene {
mFastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable handlerDrawable = new HandlerDrawable();
handlerDrawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
handlerDrawable.setColor(ResourcesKt.resolveColor(getTheme(), com.google.android.material.R.attr.colorPrimary));
mFastScroller.setHandlerDrawable(handlerDrawable);
updateLazyList();
@@ -18,6 +18,7 @@ package com.hippo.ehviewer.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -60,9 +61,9 @@ public class GalleryGuideView extends ViewGroup implements View.OnClickListener
}
private void init(Context context) {
mBgColor = ResourcesKt.resolveColor(context.getTheme(), R.attr.guideBackgroundColor);
mBgColor = Color.GRAY;
mPaint = new Paint();
mPaint.setColor(ResourcesKt.resolveColor(context.getTheme(), R.attr.guideTitleColor));
mPaint.setColor(Color.WHITE);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(context.getResources().getDimension(R.dimen.gallery_guide_divider_width));
setOnClickListener(this);
@@ -55,6 +55,8 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import rikka.core.res.ResourcesKt;
public class ContentLayout extends FrameLayout {
private CircularProgressIndicator mProgressView;
@@ -102,7 +104,7 @@ public class ContentLayout extends FrameLayout {
mFastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable drawable = new HandlerDrawable();
drawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
drawable.setColor(ResourcesKt.resolveColor(context.getTheme(), androidx.appcompat.R.attr.colorPrimary));
mFastScroller.setHandlerDrawable(drawable);
mRefreshLayout.setColorSchemeResources(
@@ -50,7 +50,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/material_dynamic_primary50"
android:background="?attr/colorPrimaryContainer"
android:elevation="4dp"
android:orientation="horizontal"
android:visibility="invisible"
-3
View File
@@ -23,9 +23,6 @@
<attr name="drawableColorThemePrimary" format="color" />
<attr name="contentColorThemePrimary" format="color" />
<attr name="contentColorThemeAccent" format="color" />
<attr name="guideBackgroundColor" format="color" />
<attr name="guideTitleColor" format="color" />
<attr name="guideTextColor" format="color" />
<attr name="tagGroupBackgroundColor" format="color" />
<attr name="tagBackgroundColor" format="color" />
</declare-styleable>
+1 -3
View File
@@ -62,7 +62,5 @@
<item name="indicatorColor">?attr/dividerColor</item>
</style>
<style name="Guide.Title" parent="TextAppearance.Material3.TitleMedium">
<item name="android:textColor">?attr/guideTitleColor</item>
</style>
<style name="Guide.Title" parent="TextAppearance.Material3.TitleMedium"/>
</resources>
+4 -7
View File
@@ -23,13 +23,10 @@
<style name="Base.AppTheme" parent="Theme.Material3.DynamicColors.DayNight">
<item name="colorEdgeEffect">@color/grey_500</item>
<item name="dividerColor">@color/divider</item>
<item name="drawableColorSecondary">@color/material_dynamic_secondary50</item>
<item name="drawableColorThemePrimary">@color/material_dynamic_primary50</item>
<item name="guideBackgroundColor">@color/material_dynamic_neutral80</item>
<item name="guideTitleColor">@color/material_dynamic_primary70</item>
<item name="guideTextColor">@color/material_dynamic_primary50</item>
<item name="tagGroupBackgroundColor">@color/material_dynamic_primary50</item>
<item name="tagBackgroundColor">@color/material_dynamic_neutral50</item>
<item name="drawableColorSecondary">?attr/colorOnSurface</item>
<item name="drawableColorThemePrimary">?attr/colorPrimary</item>
<item name="tagGroupBackgroundColor">?attr/colorPrimary</item>
<item name="tagBackgroundColor">?attr/colorTertiary</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>