diff options
author | Mitsuru Oshima <oshima@google.com> | 2009-07-01 00:10:43 -0700 |
---|---|---|
committer | Mitsuru Oshima <oshima@google.com> | 2009-07-01 00:10:43 -0700 |
commit | 8f25c426b118c35f558cbf27bd413e1eb6d59823 (patch) | |
tree | 1dc53d22e856c9f15afabfdef4c3a957652a129b /core/java/android/appwidget | |
parent | 083928fefde7060eb69f7f45cd8e2180efa9bfe1 (diff) | |
download | frameworks_base-8f25c426b118c35f558cbf27bd413e1eb6d59823.zip frameworks_base-8f25c426b118c35f558cbf27bd413e1eb6d59823.tar.gz frameworks_base-8f25c426b118c35f558cbf27bd413e1eb6d59823.tar.bz2 |
resolve complex value in application context instead of system context.
Diffstat (limited to 'core/java/android/appwidget')
-rw-r--r-- | core/java/android/appwidget/AppWidgetManager.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java index eca04b3..3660001 100644 --- a/core/java/android/appwidget/AppWidgetManager.java +++ b/core/java/android/appwidget/AppWidgetManager.java @@ -21,7 +21,9 @@ import android.content.Context; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; +import android.util.DisplayMetrics; import android.util.Log; +import android.util.TypedValue; import android.widget.RemoteViews; import com.android.internal.appwidget.IAppWidgetService; @@ -187,6 +189,8 @@ public class AppWidgetManager { Context mContext; + private DisplayMetrics mDisplayMetrics; + /** * Get the AppWidgetManager instance to use for the supplied {@link android.content.Context * Context} object. @@ -213,6 +217,7 @@ public class AppWidgetManager { private AppWidgetManager(Context context) { mContext = context; + mDisplayMetrics = context.getResources().getDisplayMetrics(); } /** @@ -292,7 +297,15 @@ public class AppWidgetManager { */ public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) { try { - return sService.getAppWidgetInfo(appWidgetId); + AppWidgetProviderInfo info = sService.getAppWidgetInfo(appWidgetId); + if (info != null) { + // Converting complex to dp. + info.minWidth = + TypedValue.complexToDimensionPixelSize(info.minWidth, mDisplayMetrics); + info.minHeight = + TypedValue.complexToDimensionPixelSize(info.minHeight, mDisplayMetrics); + } + return info; } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); |