[Android] Improve micro widget breakpoint

Nicolas Pomepuy git at videolan.org
Wed Aug 3 09:27:21 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jul 28 07:58:36 2022 +0200| [63ebfc6f29e7ba283b56a2e51fd9c643b16f18c1] | committer: Duncan McNamara

Improve micro widget breakpoint

Fixes #2619

> https://code.videolan.org/videolan/vlc-android/commit/63ebfc6f29e7ba283b56a2e51fd9c643b16f18c1
---

 .../src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
index 542596b94..a55ae00e7 100644
--- a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
@@ -180,7 +180,7 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
             log(appWidgetId, WidgetLogType.INFO, "Size is 0. Getting size from db: $widgetCacheEntry.widget")
             Pair(widgetCacheEntry.widget.width, widgetCacheEntry.widget.height)
         } else size
-        log(appWidgetId, WidgetLogType.INFO, "New widget size by provider: ${correctedSize.first} / ${correctedSize.second}")
+        log(appWidgetId, WidgetLogType.INFO, "New widget size by provider: ${correctedSize.first} / ${correctedSize.second} // ratio = ${correctedSize.first.toFloat() / correctedSize.second}")
         val widgetType = getWidgetTypeFromSize(correctedSize.first, correctedSize.second)
 
 
@@ -398,8 +398,8 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
      */
     private fun getWidgetTypeFromSize(width: Int, height: Int) = when {
         width > 220 && height > 220 -> WidgetType.MACRO
-        width > 128 && height > 128 -> WidgetType.MICRO
         width > 220 && height > 72 -> WidgetType.MINI
+        width > 128 && height > 148 -> WidgetType.MICRO
         else -> WidgetType.PILL
     }
 



More information about the Android mailing list