style: customize v31 splash screen

Remove the icon background from the Android 12 splash screen, making it
alot more cleaner than it was before.
This commit is contained in:
OxygenCobalt
2021-08-07 20:10:33 -06:00
parent 64c9a4a4a7
commit 2f0df83cb2
6 changed files with 15 additions and 14 deletions
@@ -117,12 +117,11 @@ class WidgetProvider : AppWidgetProvider() {
) {
check(views.isNotEmpty()) { "Must provide a non-empty map" }
val name = ComponentName(context, WidgetProvider::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// Widgets are automatically responsive on Android 12, no need to do anything.
updateAppWidget(
ComponentName(context, WidgetProvider::class.java),
RemoteViews(views)
)
updateAppWidget(name, RemoteViews(views))
} else {
// Otherwise, we try our best to backport the responsive behavior to older versions.
// This is mostly a guess based on RemoteView's documentation, and it has some
@@ -131,15 +130,11 @@ class WidgetProvider : AppWidgetProvider() {
// Each widget has independent dimensions, so we iterate through them all
// and do this for each.
val ids = getAppWidgetIds(ComponentName(context, WidgetProvider::class.java))
val ids = getAppWidgetIds(name)
// Most of the major launchers seem to provide widget sizes that don't include
// padding. Query for the padding here so we can get a sane result later on.
val padding = AppWidgetHostView.getDefaultPaddingForWidget(
context,
ComponentName(context, WidgetProvider::class.java),
null
)
val padding = AppWidgetHostView.getDefaultPaddingForWidget(context, name, null)
val density = context.resources.displayMetrics.density
val padW = ((padding.left + padding.right) / density).toInt()