TBog / TBLauncher

based on https://github.com/Neamar/KISS
GNU General Public License v3.0
140 stars 18 forks source link

Reported AppWidgetOptions are wrong #456

Open mtotschnig opened 7 months ago

mtotschnig commented 7 months ago

Description

My Expenses (https://github.com/mtotschnig/MyExpenses) has widgets that adjust the layout based on the size options reported through getAppWidgetOptions (OPTION_APPWIDGET_MIN_WIDTH and OPTION_APPWIDGET_MAX_WIDTH) This is the result on Pixel Launcher on Android Studio emulator: Bildschirmfoto vom 2024-04-22 09-53-37 With TinyBit: Bildschirmfoto vom 2024-04-22 09-51-26 I created a sample project with a widget that displays the reported values (https://github.com/mtotschnig/DebugWidget). Pixel Launcher: Bildschirmfoto vom 2024-04-22 09-54-23 vs TinyBit: Bildschirmfoto vom 2024-04-22 09-51-49

Context

The documenation for AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH spezifies that the reported values should be in dips, which is clearly not the case with TinyBit.

Steps to Reproduce

To reproduce the behavior:

  1. Checkout https://github.com/mtotschnig/DebugWidget, and deploy
  2. Add Widget and resize.

Expected behavior

Widget displays min and max width in dips.

Device info

TBog commented 7 months ago

Thank you. I'll look into it. I'm not usually using widgets. Your testing seems to show a flaw in my implementation.

TBog commented 7 months ago

@mtotschnig is the debug widget repository private?

mtotschnig commented 7 months ago

@TBog I am sorry. I thought it was public. It is now.

TBog commented 6 months ago

I don't think it's my mistake. Here are the relevant lines

https://github.com/TBog/TBLauncher/blob/54e7b2a09b7c3f4a3931c01dcdbefcf3df913f16/app/src/main/java/rocks/tbog/tblauncher/widgets/WidgetManager.java#L366-L367

https://github.com/TBog/TBLauncher/blob/54e7b2a09b7c3f4a3931c01dcdbefcf3df913f16/app/src/main/java/rocks/tbog/tblauncher/widgets/WidgetManager.java#L391-L394

I am reporting the size in dp. The function UISizes.px2dp will return pixelSize / metrics.density

TBog commented 6 months ago

image