Convert to dynamic color
* Drop color hardcode
This commit is contained in:
1 parent
bc38c8c135
commit
fcce3a04a6
20 files changed
+13
-194
No files matched your search
@@ -92,14 +92,8 @@ public final class UrlOpener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isNight = (context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_YES) > 0;
|
||||
CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder();
|
||||
customTabsIntent.setShowTitle(true);
|
||||
CustomTabColorSchemeParams params = new CustomTabColorSchemeParams.Builder()
|
||||
.setToolbarColor(ResourcesKt.resolveColor(context.getTheme(), R.attr.toolbarColor))
|
||||
.build();
|
||||
customTabsIntent.setDefaultColorSchemeParams(params);
|
||||
customTabsIntent.setColorScheme(isNight ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT);
|
||||
try {
|
||||
customTabsIntent.build().launchUrl(context, uri);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
||||
@@ -383,7 +383,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
mFastScroller.attachToRecyclerView(mRecyclerView);
|
||||
HandlerDrawable handlerDrawable = new HandlerDrawable();
|
||||
handlerDrawable.setColor(ResourcesKt.resolveColor(getTheme(), R.attr.widgetColorThemeAccent));
|
||||
handlerDrawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
|
||||
mFastScroller.setHandlerDrawable(handlerDrawable);
|
||||
mFastScroller.setOnDragHandlerListener(this);
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
|
||||
mFastScroller.attachToRecyclerView(mRecyclerView);
|
||||
HandlerDrawable handlerDrawable = new HandlerDrawable();
|
||||
handlerDrawable.setColor(ResourcesKt.resolveColor(getTheme(), R.attr.widgetColorThemeAccent));
|
||||
handlerDrawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
|
||||
mFastScroller.setHandlerDrawable(handlerDrawable);
|
||||
|
||||
updateLazyList();
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ContentLayout extends FrameLayout {
|
||||
|
||||
mFastScroller.attachToRecyclerView(mRecyclerView);
|
||||
HandlerDrawable drawable = new HandlerDrawable();
|
||||
drawable.setColor(ResourcesKt.resolveColor(context.getTheme(), R.attr.widgetColorThemeAccent));
|
||||
drawable.setColor(com.google.android.material.R.color.material_dynamic_neutral100);
|
||||
mFastScroller.setHandlerDrawable(drawable);
|
||||
|
||||
mRefreshLayout.setColorSchemeResources(
|
||||
|
||||
@@ -45,6 +45,8 @@ import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
|
||||
import rikka.core.res.ResourcesKt;
|
||||
|
||||
public class Slider extends View {
|
||||
|
||||
private static final char[] CHARACTERS = {
|
||||
@@ -134,10 +136,8 @@ public class Slider extends View {
|
||||
setProgress(a.getInteger(R.styleable.Slider_slider_progress, 0));
|
||||
mThickness = a.getDimension(R.styleable.Slider_thickness, 2);
|
||||
mRadius = a.getDimension(R.styleable.Slider_radius, 6);
|
||||
setColor(a.getColor(R.styleable.Slider_color, Color.BLACK));
|
||||
|
||||
mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mBgPaint.setColor(a.getBoolean(R.styleable.Slider_dark, false) ? 0x4dffffff : 0x42000000);
|
||||
|
||||
a.recycle();
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<solid android:color="@color/divider" />
|
||||
|
||||
<size android:height="1dp" />
|
||||
|
||||
</shape>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<solid android:color="@color/divider_black" />
|
||||
|
||||
<size android:height="1dp" />
|
||||
|
||||
</shape>
|
||||
@@ -66,7 +66,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/gallerySliderBackgroundColor"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/toolbarColor"
|
||||
android:elevation="4dp"
|
||||
android:saveEnabled="false" />
|
||||
|
||||
|
||||
@@ -29,10 +29,7 @@
|
||||
android:id="@+id/below_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="?attr/galleryDetailDivider"
|
||||
android:dividerPadding="@dimen/keyline_margin"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/gallery_detail_info" />
|
||||
|
||||
|
||||
@@ -139,10 +139,8 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:textColor="?attr/textColorThemePrimary" />
|
||||
android:focusable="true" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
@@ -157,11 +155,9 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:text="@string/read"
|
||||
android:textColor="?attr/textColorThemeAccent" />
|
||||
android:text="@string/read" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
@@ -47,15 +47,13 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/edit_panel"
|
||||
android:background="@color/material_dynamic_primary50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?colorPrimarySurface"
|
||||
android:elevation="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible"
|
||||
android:outlineAmbientShadowColor="?attr/widgetColorThemePrimary"
|
||||
android:outlineSpotShadowColor="?attr/widgetColorThemePrimary"
|
||||
app:fitsSystemWindowsInsets="bottom">
|
||||
|
||||
<EditText
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<resources></resources>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<style name="AppTheme" parent="Base.AppTheme" />
|
||||
</resources>
|
||||
@@ -1 +0,0 @@
|
||||
<resources></resources>
|
||||
@@ -1 +0,0 @@
|
||||
<resources></resources>
|
||||
@@ -20,9 +20,7 @@
|
||||
<attr name="colorEdgeEffect" format="color" />
|
||||
|
||||
<attr name="dividerColor" format="color" />
|
||||
<attr name="toolbarColor" format="color" />
|
||||
|
||||
<attr name="textColorThemePrimary" format="color" />
|
||||
<attr name="textColorThemeAccent" format="color" />
|
||||
|
||||
<!-- For light theme, it's secondary dark color -->
|
||||
@@ -35,31 +33,19 @@
|
||||
<attr name="drawableColorThemePrimary" format="color" />
|
||||
|
||||
<!-- Color of card background -->
|
||||
<attr name="contentColorPrimary" format="color" />
|
||||
<attr name="contentColorThemePrimary" format="color" />
|
||||
<attr name="contentColorThemeAccent" format="color" />
|
||||
<attr name="contentColorReactive" format="color" />
|
||||
|
||||
<attr name="widgetColorThemePrimary" format="color" />
|
||||
<attr name="widgetColorThemeAccent" format="color" />
|
||||
|
||||
<attr name="guideBackgroundColor" format="color" />
|
||||
<attr name="guideTitleColor" format="color" />
|
||||
<attr name="guideTextColor" format="color" />
|
||||
|
||||
<attr name="progressColor" format="color" />
|
||||
|
||||
<attr name="tagGroupBackgroundColor" format="color" />
|
||||
<attr name="tagBackgroundColor" format="color" />
|
||||
|
||||
<attr name="galleryDetailHeaderTitleColor" format="color" />
|
||||
<attr name="galleryDetailHeaderBackgroundColor" format="color" />
|
||||
<attr name="galleryDetailButtonBackgroundColor" format="color" />
|
||||
|
||||
<attr name="gallerySliderBackgroundColor" format="color" />
|
||||
|
||||
<attr name="toolbarPopupTheme" format="reference" />
|
||||
<attr name="galleryDetailDivider" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="ProgressView">
|
||||
|
||||
@@ -15,14 +15,13 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<style name="AppTheme" parent="Base.AppTheme.Light" />
|
||||
<style name="AppTheme" parent="Base.AppTheme" />
|
||||
|
||||
<!-- TextAppearance -->
|
||||
<style name="TextAppearance" parent="TextAppearance.AppCompat" />
|
||||
|
||||
<!-- Progress View -->
|
||||
<style name="ProgressView">
|
||||
<item name="indicatorColor">?attr/progressColor</item>
|
||||
<item name="android:indeterminate">true</item>
|
||||
<item name="android:minWidth">48dp</item>
|
||||
<item name="android:minHeight">48dp</item>
|
||||
@@ -59,7 +58,7 @@
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:minHeight">@dimen/category_table_item_height</item>
|
||||
<item name="android:foreground">@drawable/check_text_view_foreground</item>
|
||||
<item name="android:theme">@style/Theme.MaterialComponents</item>
|
||||
<item name="android:theme">@style/Theme.Material3.DynamicColors.DayNight</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.CategoryTitle" parent="TextAppearance.AppCompat.Small">
|
||||
@@ -87,10 +86,7 @@
|
||||
<style name="Slider">
|
||||
<item name="thickness">2dp</item>
|
||||
<item name="radius">6dp</item>
|
||||
<item name="color">?attr/widgetColorThemeAccent</item>
|
||||
<item name="textColor">@android:color/white</item>
|
||||
<item name="textSize">12sp</item>
|
||||
<item name="dark">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Indicating">
|
||||
|
||||
@@ -19,25 +19,16 @@
|
||||
<!-- ========== -->
|
||||
<!-- Base Theme -->
|
||||
<!-- ========== -->
|
||||
<style name="Base.AppTheme.Light" parent="Theme.Material3.Light">
|
||||
<item name="android:colorBackground">@color/colorBackground</item>
|
||||
<item name="android:windowSplashScreenIconBackgroundColor" tools:targetApi="s">@color/ic_launcher_background</item>
|
||||
|
||||
<style name="Base.AppTheme.Light" parent="Theme.Material3.DynamicColors.Light">
|
||||
<item name="colorEdgeEffect">@color/colorPrimary</item>
|
||||
<item name="dividerColor">@color/divider</item>
|
||||
<item name="toolbarColor">@color/colorPrimary</item>
|
||||
<item name="textColorThemePrimary">@color/colorPrimary</item>
|
||||
<item name="textColorThemeAccent">@color/colorAccent</item>
|
||||
<item name="colorControlNormal">@color/primary_drawable</item>
|
||||
<item name="drawableColorSecondary">@color/secondary_drawable</item>
|
||||
<item name="drawableColorThemePrimary">@color/colorPrimary</item>
|
||||
<item name="contentColorPrimary">@color/content</item>
|
||||
<item name="contentColorThemePrimary">@color/colorPrimary</item>
|
||||
<item name="contentColorThemeAccent">@color/colorAccent</item>
|
||||
<item name="contentColorReactive">@color/content_reactive</item>
|
||||
<item name="widgetColorThemePrimary">@color/colorPrimary</item>
|
||||
<item name="widgetColorThemeAccent">@color/colorAccent</item>
|
||||
<item name="progressColor">@color/progress</item>
|
||||
<item name="guideBackgroundColor">@color/guide_bg</item>
|
||||
<item name="guideTitleColor">?android:attr/textColorPrimaryInverse</item>
|
||||
<item name="guideTextColor">?android:attr/textColorSecondaryInverse</item>
|
||||
@@ -45,11 +36,6 @@
|
||||
<item name="tagBackgroundColor">@color/tag_background</item>
|
||||
<item name="galleryDetailHeaderTitleColor">?android:attr/textColorPrimaryInverse</item>
|
||||
<item name="galleryDetailHeaderBackgroundColor">?attr/contentColorThemePrimary</item>
|
||||
<item name="galleryDetailButtonBackgroundColor">@color/gallery_detail_button_background
|
||||
</item>
|
||||
|
||||
<item name="toolbarPopupTheme">@style/ThemeOverlay.MaterialComponents.Light</item>
|
||||
<item name="galleryDetailDivider">@drawable/divider_gallery_detail</item>
|
||||
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
@@ -57,26 +43,15 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Base.AppTheme" parent="Theme.Material3.DayNight">
|
||||
<style name="Base.AppTheme" parent="Theme.Material3.DynamicColors.DayNight">
|
||||
<item name="colorControlActivated">@color/colorPrimary</item>
|
||||
<item name="android:colorBackground">@color/grey_850</item>
|
||||
<item name="android:windowSplashScreenIconBackgroundColor" tools:targetApi="s">@color/ic_launcher_background</item>
|
||||
|
||||
<item name="colorEdgeEffect">@color/grey_500</item>
|
||||
<item name="dividerColor">@color/divider</item>
|
||||
<item name="toolbarColor">?android:attr/colorBackground</item>
|
||||
<item name="textColorThemePrimary">?android:attr/textColorSecondary</item>
|
||||
<item name="textColorThemeAccent">?android:attr/textColorSecondary</item>
|
||||
<item name="colorControlNormal">@color/primary_drawable</item>
|
||||
<item name="drawableColorSecondary">@color/secondary_drawable</item>
|
||||
<item name="drawableColorThemePrimary">@color/primary_drawable</item>
|
||||
<item name="contentColorPrimary">@color/content</item>
|
||||
<item name="contentColorThemePrimary">?attr/contentColorPrimary</item>
|
||||
<item name="contentColorThemeAccent">?attr/contentColorPrimary</item>
|
||||
<item name="contentColorReactive">@color/content_reactive</item>
|
||||
<item name="widgetColorThemePrimary">@color/widget</item>
|
||||
<item name="widgetColorThemeAccent">@color/widget</item>
|
||||
<item name="progressColor">@color/progress</item>
|
||||
<item name="guideBackgroundColor">#e5303030</item>
|
||||
<item name="guideTitleColor">?android:attr/textColorPrimary</item>
|
||||
<item name="guideTextColor">?android:attr/textColorSecondary</item>
|
||||
@@ -84,12 +59,6 @@
|
||||
<item name="tagBackgroundColor">@color/tag_background</item>
|
||||
<item name="galleryDetailHeaderTitleColor">?android:attr/textColorPrimary</item>
|
||||
<item name="galleryDetailHeaderBackgroundColor">?attr/contentColorThemePrimary</item>
|
||||
<item name="galleryDetailButtonBackgroundColor">@color/gallery_detail_button_background
|
||||
</item>
|
||||
|
||||
<item name="toolbarPopupTheme">@style/ThemeOverlay.MaterialComponents.Dark</item>
|
||||
<item name="galleryDetailDivider">@drawable/divider_gallery_detail_dark</item>
|
||||
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
@@ -103,33 +72,18 @@
|
||||
<style name="ThemeOverlay" />
|
||||
|
||||
<style name="ThemeOverlay.Black">
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/primary_text_material_black</item>
|
||||
|
||||
<item name="dividerColor">@color/divider_black</item>
|
||||
<item name="toolbarColor">@android:color/black</item>
|
||||
<item name="colorControlNormal">@color/primary_drawable_black</item>
|
||||
<item name="drawableColorSecondary">@color/secondary_drawable_black</item>
|
||||
<item name="drawableColorThemePrimary">@color/primary_drawable_black</item>
|
||||
<item name="contentColorPrimary">@color/content_black</item>
|
||||
<item name="contentColorReactive">@color/content_reactive_black</item>
|
||||
<item name="widgetColorThemePrimary">@color/widget_black</item>
|
||||
<item name="widgetColorThemeAccent">@color/widget_black</item>
|
||||
<item name="progressColor">@color/progress_black</item>
|
||||
<item name="guideBackgroundColor">#e5000000</item>
|
||||
<item name="tagGroupBackgroundColor">@color/tag_group_background_black</item>
|
||||
<item name="tagBackgroundColor">@color/tag_background_black</item>
|
||||
<item name="galleryDetailHeaderBackgroundColor">@android:color/black</item>
|
||||
<item name="galleryDetailButtonBackgroundColor">
|
||||
@color/gallery_detail_button_background_black
|
||||
</item>
|
||||
|
||||
<item name="galleryDetailDivider">@drawable/divider_gallery_detail_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Gallery" parent="AppTheme">
|
||||
<item name="gallerySliderBackgroundColor">@color/gallery_slider_background</item>
|
||||
</style>
|
||||
|
||||
<!-- ============ -->
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Add android:colorControlNormal -->
|
||||
<style name="Base.ThemeOverlay.AppCompat.ActionBar" tools:override="true">
|
||||
<item name="android:colorControlNormal">?android:attr/textColorPrimary</item>
|
||||
<item name="colorControlNormal">?android:attr/textColorPrimary</item>
|
||||
<item name="searchViewStyle">@style/Widget.AppCompat.SearchView.ActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="Base.ThemeOverlay.AppCompat.Dark.ActionBar" tools:override="true">
|
||||
<item name="android:colorControlNormal">?android:attr/textColorPrimary</item>
|
||||
<item name="colorControlNormal">?android:attr/textColorPrimary</item>
|
||||
<item name="searchViewStyle">@style/Widget.AppCompat.SearchView.ActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.MaterialComponents.CompoundButton.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox" tools:override="true">
|
||||
<item name="enforceMaterialTheme">true</item>
|
||||
<item name="useMaterialThemeColors">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.MaterialComponents.CompoundButton.RadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton" tools:override="true">
|
||||
<item name="enforceMaterialTheme">true</item>
|
||||
<item name="useMaterialThemeColors">true</item>
|
||||
</style>
|
||||
|
||||
<style name="PreferenceSummaryTextStyle" tools:override="true">
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:letterSpacing">0.0178571429</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in new issue
Block a user