widget: fix corner radius on default
This commit is contained in:
parent
7995d3ac98
commit
6c919ccd8b
3 changed files with 13 additions and 8 deletions
|
@ -130,7 +130,7 @@ constructor(
|
|||
imageSettings.unregisterListener(this)
|
||||
playbackManager.removeListener(this)
|
||||
uiSettings.unregisterListener(this)
|
||||
widgetProvider.reset(context)
|
||||
widgetProvider.reset(context, uiSettings)
|
||||
}
|
||||
|
||||
// --- CALLBACKS ---
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.oxycblt.auxio.music.resolveNames
|
|||
import org.oxycblt.auxio.playback.service.PlaybackActions
|
||||
import org.oxycblt.auxio.playback.state.RepeatMode
|
||||
import org.oxycblt.auxio.ui.UISettings
|
||||
import org.oxycblt.auxio.ui.UISettingsImpl
|
||||
import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.logW
|
||||
import org.oxycblt.auxio.util.newBroadcastPendingIntent
|
||||
|
@ -53,7 +54,7 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
requestUpdate(context)
|
||||
// Revert to the default layout for now until we get a response from WidgetComponent.
|
||||
// If we don't, then we will stick with the default widget layout.
|
||||
reset(context)
|
||||
reset(context, UISettingsImpl(context))
|
||||
}
|
||||
|
||||
override fun onAppWidgetOptionsChanged(
|
||||
|
@ -82,7 +83,7 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
if (state == null) {
|
||||
// No state, use the default widget.
|
||||
logD("No state provided, returning to default")
|
||||
reset(context)
|
||||
reset(context, uiSettings)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -109,7 +110,7 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
} catch (e: Exception) {
|
||||
// Layout update failed, gracefully degrade to the default widget.
|
||||
logW("Unable to update widget: $e")
|
||||
reset(context)
|
||||
reset(context, uiSettings)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,10 +119,11 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
*
|
||||
* @param context [Context] required to update the widget layout.
|
||||
*/
|
||||
fun reset(context: Context) {
|
||||
fun reset(context: Context, uiSettings: UISettings) {
|
||||
logD("Using default layout")
|
||||
AppWidgetManager.getInstance(context)
|
||||
.updateAppWidget(ComponentName(context, this::class.java), newDefaultLayout(context))
|
||||
.updateAppWidget(
|
||||
ComponentName(context, this::class.java), newDefaultLayout(context, uiSettings))
|
||||
}
|
||||
|
||||
// --- INTERNAL METHODS ---
|
||||
|
@ -139,8 +141,10 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
|
||||
// --- LAYOUTS ---
|
||||
|
||||
private fun newDefaultLayout(context: Context) =
|
||||
private fun newDefaultLayout(context: Context, uiSettings: UISettings) =
|
||||
newRemoteViews(context, R.layout.widget_default)
|
||||
.setupBackground(uiSettings)
|
||||
.setupBackground(uiSettings)
|
||||
|
||||
private fun newThinStickLayout(context: Context, state: WidgetComponent.PlaybackState) =
|
||||
newRemoteViews(context, R.layout.widget_stick_thin).setupTimelineControls(context, state)
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
android:id="@android:id/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
android:background="@drawable/ui_widget_bg_sharp"
|
||||
android:backgroundTint="?attr/colorSurface"
|
||||
android:theme="@style/Theme.Auxio.Widget"
|
||||
tools:ignore="Overdraw">
|
||||
|
||||
|
|
Loading…
Reference in a new issue