diff --git a/android/app/build.gradle b/android/app/build.gradle index cad7d2211..85e1c2808 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -36,7 +36,7 @@ android { namespace 'deckers.thibault.aves' compileSdk 35 // cf https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp - ndkVersion '27.0.12077973' + ndkVersion '28.0.12916984' defaultConfig { applicationId packageName diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/HomeWidgetProvider.kt b/android/app/src/main/kotlin/deckers/thibault/aves/HomeWidgetProvider.kt index f42bb2e8e..103a27901 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/HomeWidgetProvider.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/HomeWidgetProvider.kt @@ -83,7 +83,7 @@ class HomeWidgetProvider : AppWidgetProvider() { private fun getDevicePixelRatio(): Float = Resources.getSystem().displayMetrics.density - private fun getWidgetSizesDip(context: Context, widgetInfo: Bundle): List { + private fun getWidgetSizesDip(context: Context, widgetInfo: Bundle): List { var sizes: List? = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { widgetInfo.getParcelableArrayList(AppWidgetManager.OPTION_APPWIDGET_SIZES, SizeF::class.java) } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { @@ -102,7 +102,7 @@ class HomeWidgetProvider : AppWidgetProvider() { sizes = listOf(SizeF(widthDip.toFloat(), heightDip.toFloat())) } - return sizes.map { size -> hashMapOf("widthDip" to size.width, "heightDip" to size.height) } + return sizes } private suspend fun getProps( @@ -116,13 +116,14 @@ class HomeWidgetProvider : AppWidgetProvider() { if (sizesDip.isEmpty()) return null val sizeDip = sizesDip.first() - if (sizeDip["widthDip"] == 0 || sizeDip["heightDip"] == 0) return null + if (sizeDip.width == 0f || sizeDip.height == 0f) return null + val sizesDipMap = sizesDip.map { size -> hashMapOf("widthDip" to size.width, "heightDip" to size.height) } val isNightModeOn = (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES val params = hashMapOf( "widgetId" to widgetId, - "sizesDip" to sizesDip, + "sizesDip" to sizesDipMap, "devicePixelRatio" to getDevicePixelRatio(), "drawEntryImage" to drawEntryImage, "reuseEntry" to reuseEntry,