Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jan 22, 2025
2 parents 58679a7 + a99f487 commit 25444cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class HomeWidgetProvider : AppWidgetProvider() {

private fun getDevicePixelRatio(): Float = Resources.getSystem().displayMetrics.density

private fun getWidgetSizesDip(context: Context, widgetInfo: Bundle): List<FieldMap> {
private fun getWidgetSizesDip(context: Context, widgetInfo: Bundle): List<SizeF> {
var sizes: List<SizeF>? = 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) {
Expand All @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 25444cb

Please sign in to comment.