widget: fix wafer cover setup
Apparently: 1. Some OEMs don't actually autocrop to rounded corners 2. I was not correctly using the right corner radius attributes in the first place, making it inconsistent. Let's fix that. Closes #730
This commit is contained in:
@@ -158,6 +158,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
uiSettings,
|
||||
)
|
||||
.setupCover(context, state.takeIf { canDisplayWaferCover(uiSettings) })
|
||||
.setupFillingCover(uiSettings)
|
||||
.setupTimelineControls(context, state)
|
||||
|
||||
private fun newWideWaferLayout(
|
||||
@@ -170,6 +171,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
uiSettings,
|
||||
)
|
||||
.setupCover(context, state.takeIf { canDisplayWaferCover(uiSettings) })
|
||||
.setupFillingCover(uiSettings)
|
||||
.setupFullControls(context, state)
|
||||
|
||||
private fun newThinDockedLayout(
|
||||
@@ -231,9 +233,9 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
// On API 31+, the bar should always be round in order to fit in with other widgets.
|
||||
val background =
|
||||
if (useRoundedRemoteViews(uiSettings)) {
|
||||
R.drawable.ui_widget_bar_round
|
||||
R.drawable.ui_widget_bg_round
|
||||
} else {
|
||||
R.drawable.ui_widget_bar_system
|
||||
R.drawable.ui_widget_bg_sharp
|
||||
}
|
||||
setBackgroundResource(R.id.widget_controls, background)
|
||||
return this
|
||||
@@ -253,7 +255,7 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
if (useRoundedRemoteViews(uiSettings)) {
|
||||
R.drawable.ui_widget_bg_round
|
||||
} else {
|
||||
R.drawable.ui_widget_bg_system
|
||||
R.drawable.ui_widget_bg_sharp
|
||||
}
|
||||
setBackgroundResource(android.R.id.background, background)
|
||||
return this
|
||||
@@ -292,6 +294,20 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
return this
|
||||
}
|
||||
|
||||
private fun RemoteViews.setupFillingCover(uiSettings: UISettings): RemoteViews {
|
||||
// Below API 31, enable a rounded background only if round mode is enabled.
|
||||
// On API 31+, the background should always be round in order to fit in with other
|
||||
// widgets.
|
||||
val background =
|
||||
if (useRoundedRemoteViews(uiSettings)) {
|
||||
R.drawable.ui_widget_bg_round
|
||||
} else {
|
||||
R.drawable.ui_widget_bg_sharp
|
||||
}
|
||||
setBackgroundResource(R.id.widget_cover, background)
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the album cover, song title, and artist name in a [RemoteViews] layout that contains
|
||||
* them.
|
||||
|
||||
Reference in New Issue
Block a user