Do not access color attributes in background

Workaround with ImageView tints
This commit is contained in:
topjohnwu 2020-09-12 03:17:21 -07:00
parent 2eb001876a
commit 9a8a27dbb9
16 changed files with 16 additions and 166 deletions

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="?colorSurfaceVariant" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="?colorSurface" />
</shape>
</item>
</layer-list>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="4dp" />
<corners android:radius="2dp" />
<solid android:color="?colorOnPrimary" />
</shape>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="?colorSurfaceVariant"
android:startColor="@android:color/transparent" />
</shape>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="?colorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="?colorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
</selector>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="?colorSecondary" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="?colorPrimary" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/defColorSurfaceVariant" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/defColorSurface" />
</shape>
</item>
</layer-list>

View File

@ -3,5 +3,5 @@
android:shape="rectangle"> android:shape="rectangle">
<size android:height="4dp" /> <size android:height="4dp" />
<corners android:radius="2dp" /> <corners android:radius="2dp" />
<solid android:color="@color/defColorOnPrimary" /> <solid android:color="@android:color/black" />
</shape> </shape>

View File

@ -3,6 +3,6 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:angle="270" android:angle="270"
android:endColor="@color/defColorSurfaceVariant" android:endColor="@android:color/black"
android:startColor="@android:color/transparent" /> android:startColor="@android:color/transparent" />
</shape> </shape>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="@color/defColorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="@color/defColorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
</selector>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="@color/defColorSecondary" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/defColorPrimary" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -43,6 +43,12 @@
tools:layout_marginTop="24dp" tools:layout_marginTop="24dp"
tools:title="Home" /> tools:title="Home" />
<View
gone="@{android.os.Build.VERSION.SDK_INT >= 21}"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="?colorSurfaceVariant"/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<!-- <!--

View File

@ -87,12 +87,13 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@string/safetynet_attest_success" /> tools:text="@string/safetynet_attest_success" />
<View <ImageView
android:id="@+id/safetynet_divider" android:id="@+id/safetynet_divider"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="4dp" android:layout_height="4dp"
android:layout_marginTop="@dimen/l2" android:layout_marginTop="@dimen/l2"
android:background="@drawable/bg_divider_rounded_on_primary" app:srcCompat="@drawable/bg_divider_rounded_on_primary"
app:tint="?colorOnPrimary"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/safetynet_title" /> app:layout_constraintTop_toBottomOf="@+id/safetynet_title" />

View File

@ -35,11 +35,6 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/l1" android:paddingStart="@dimen/l1"
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}" android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}"
app:fastScrollEnabled="true"
app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constrainedHeight="true" app:layout_constrainedHeight="true"
app:layout_constraintBottom_toTopOf="@+id/module_filter_title_search" app:layout_constraintBottom_toTopOf="@+id/module_filter_title_search"
@ -48,10 +43,11 @@
app:spanCount="2" app:spanCount="2"
tools:listitem="@layout/item_repo_md2" /> tools:listitem="@layout/item_repo_md2" />
<View <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/l_50" android:layout_height="@dimen/l_50"
android:background="@drawable/bg_shadow" app:srcCompat="@drawable/bg_shadow"
app:tint="?colorSurfaceVariant"
app:layout_constraintBottom_toBottomOf="@+id/module_filter_list" /> app:layout_constraintBottom_toBottomOf="@+id/module_filter_list" />
<TextView <TextView

View File

@ -107,6 +107,7 @@
style="@style/WidgetFoundation.ProgressBar" style="@style/WidgetFoundation.ProgressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_gravity="top" android:layout_gravity="top"
gone="@{item.checkedPercent == 0}"
android:progress="@{item.checkedPercent}" /> android:progress="@{item.checkedPercent}" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>

View File

@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="WidgetFoundation.Appbar" parent="Widget.MaterialComponents.AppBarLayout.Surface"> <style name="WidgetFoundation.Appbar" parent="Widget.MaterialComponents.AppBarLayout.Surface" />
<item name="elevation">0dp</item>
<item name="android:background">@drawable/bg_appbar</item>
</style>
<style name="WidgetFoundation.Toolbar" parent="Widget.MaterialComponents.Toolbar.Surface"> <style name="WidgetFoundation.Toolbar" parent="Widget.MaterialComponents.Toolbar.Surface">
<item name="titleTextAppearance">@style/AppearanceFoundation.Title</item> <item name="titleTextAppearance">@style/AppearanceFoundation.Title</item>
@ -169,7 +166,6 @@
<style name="WidgetFoundation.ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal"> <style name="WidgetFoundation.ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminate">false</item> <item name="android:indeterminate">false</item>
<item name="android:layout_height">4dp</item> <item name="android:layout_height">4dp</item>
<item name="android:progressDrawable">@drawable/progress_determinate</item>
</style> </style>
<style name="WidgetFoundation.ProgressBar.Indeterminate" parent="Widget.AppCompat.ProgressBar.Horizontal"> <style name="WidgetFoundation.ProgressBar.Indeterminate" parent="Widget.AppCompat.ProgressBar.Horizontal">