4

I'm currently attempting to create an Android AppWidget that is 4x1 cells initially, but can be resized vertically by the user. I created a class that extends AppWidgetProvider, and overrode the onAppWidgetOptionsChanged() method to examine the AppWidgets's minimum and maximum widths and heights whenever the user resizes the AppWidget:

@Override public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions)
{
    int minimumHeight = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);

    int maximumHeight = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT);

    int minimumWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);

    int maximumWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH);

    Log.d("TAG", "minimumHeight: " + minimumHeight + ", maximumHeight: " + maximumHeight + ", Difference: " + (maximumHeight - minimumHeight));

    Log.d("TAG", "minimumWidth: " + minimumWidth + ", maximumWidth: " + maximumWidth + ", Difference: " + (maximumWidth - minimumWidth));
}

However, I'm not sure how to interpret these widths and heights. From my initial 4x1 AppWidget, the output of my method is:

minimumHeight: 58, maximumHeight: 84, Difference: 26
minimumWidth: 304, maximumWidth: 408, Difference: 104

Then if I resize the AppWidget to 4x2, the output of my method is:

minimumHeight: 132, maximumHeight: 184, Difference: 52
minimumWidth: 304, maximumWidth: 408, Difference: 104

Again, if I resize the AppWidget to 4x3, the output of my method is:

minimumHeight: 206, maximumHeight: 284, Difference: 78
minimumWidth: 304, maximumWidth: 408, Difference: 104

From reading the App Widget Design Guidelines, I can't figure out what these numbers correspond to.

So my question is: how do I interpret these four values? What exactly do they correspond to?

Luke
  • 2,187
  • 1
  • 18
  • 29

0 Answers0