Fix app detail screen crashing on Nougat#1241
Conversation
This prevents crash on Nougat. AppDetailAdapter.kt referenced android.R.attr.colorError, introduced in API 26.
app/src/main/res/values/colors.xml
Outdated
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <color name="pitch_black">#000000</color> | ||
| <color name="colorError"></color> |
There was a problem hiding this comment.
Haha my bad. I forgot to check before making the pull request. I will move #FC3E1B to here if that's the value you'd like.
There was a problem hiding this comment.
Use the following 2 error colors instead:
md_theme_l_error, md_theme_d_error
For light and dark theme respectively
| <item name="android:colorBackground">@color/md_theme_l_background</item> | ||
| <item name="colorSurface">?android:attr/colorBackground</item> | ||
| <item name="android:colorPrimaryDark">?android:attr/colorBackground</item> | ||
| <item name="colorError">#FC3E1B</item> |
There was a problem hiding this comment.
Can you use ?android:attr/colorError? If possible
There was a problem hiding this comment.
@Iamlooker
Actually, no. That's what's casing the problem in the first place. We have to use a custom color here.
However, we can use it in values-v26 though.
I will fix the PR. I hurriedly made it as a concept to show you how we can fix it and didn't check properly.
There was a problem hiding this comment.
No worries, thanks for doing the hard work. It would have taken me sometime to find this solution
@Iamlooker |
- Rename Base.MainTheme to Base.MainTheme.Light - Add Base.MainTheme.Night to dark night theme - Add colorError style to night themes
|
@Iamlooker |
|
Will test this on my pc when I get home and will merge after that |
|
Awesome work 😉 |
Fixes #1199
This prevents a crash on Nougat which happens because
AppDetailAdapter.ktis referencingandroid.R.attr.colorError, which was introduced in API 26.A custom theme attribute (
errorColor) was added to provide a fallback on pre-26 devices.Verified on Nougat and Android 16.