widget: change default size

Make the default widget size 3x2 again. This is because the UX is
generally nicer if the smaller widget is used as the default and
because the small widget is now no longer text-only and ugly.
This commit is contained in:
OxygenCobalt 2021-11-20 09:53:10 -07:00
parent 0e3ffb973b
commit 58c2681f72
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 9 additions and 12 deletions

View file

@ -30,7 +30,7 @@ import android.os.Bundle
import android.util.SizeF
import android.widget.RemoteViews
import androidx.core.graphics.drawable.toBitmap
import coil.Coil
import coil.imageLoader
import coil.request.ImageRequest
import coil.transform.RoundedCornersTransformation
import org.oxycblt.auxio.BuildConfig
@ -98,6 +98,10 @@ class WidgetProvider : AppWidgetProvider() {
val coverRequest = ImageRequest.Builder(context)
.data(song.album)
.size(imageSize)
.target(
onError = { onDone(null) },
onSuccess = { onDone(it.toBitmap()) }
)
// If we are on Android 12 or higher, round out the album cover so that the widget is
// cohesive. I really don't like this, but whatever.
@ -111,12 +115,7 @@ class WidgetProvider : AppWidgetProvider() {
coverRequest.transformations(transform)
}
coverRequest.target(
onError = { onDone(null) },
onSuccess = { onDone(it.toBitmap()) }
)
Coil.imageLoader(context).enqueue(coverRequest.build())
context.imageLoader.enqueue(coverRequest.build())
}
/*

View file

@ -57,7 +57,6 @@
android:paddingBottom="@dimen/spacing_small"
android:paddingStart="@dimen/spacing_small"
android:paddingEnd="@dimen/spacing_small"
android:elevation="@dimen/elevation_normal"
android:orientation="horizontal"
android:background="@drawable/ui_widget_panel"
android:layout_gravity="center">

View file

@ -55,7 +55,6 @@
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:background="@drawable/ui_widget_panel"
android:elevation="@dimen/elevation_normal"
android:orientation="horizontal"
android:paddingTop="@dimen/spacing_small"
android:paddingBottom="@dimen/spacing_small"

View file

@ -36,5 +36,5 @@
<dimen name="widget_width_min">176dp</dimen>
<dimen name="widget_height_min">110dp</dimen>
<dimen name="widget_width_def">@dimen/widget_width_min</dimen>
<dimen name="widget_height_def">110dp</dimen>
<dimen name="widget_height_def">@dimen/widget_height_min</dimen>
</resources>

View file

@ -7,9 +7,9 @@
android:minResizeWidth="@dimen/widget_width_min"
android:minResizeHeight="@dimen/widget_height_min"
android:previewImage="@drawable/ui_widget_preview"
android:previewLayout="@layout/widget_medium"
android:previewLayout="@layout/widget_small"
android:resizeMode="horizontal|vertical"
android:targetCellWidth="3"
android:targetCellHeight="3"
android:targetCellHeight="2"
android:updatePeriodMillis="0"
android:widgetCategory="home_screen" />