diff options
author | Adam Cohen <adamcohen@google.com> | 2011-02-25 12:03:37 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-02-25 15:10:40 -0800 |
commit | d2e20de64b6de8b6391c63e2f5b02ce7698bf4bf (patch) | |
tree | f8467e4deac16cdb5a8bc1aca57c97e7b1345e3f /services/java/com/android/server/AppWidgetService.java | |
parent | 0277c171283826dce53cc48e8dd66187051227e4 (diff) | |
download | frameworks_base-d2e20de64b6de8b6391c63e2f5b02ce7698bf4bf.zip frameworks_base-d2e20de64b6de8b6391c63e2f5b02ce7698bf4bf.tar.gz frameworks_base-d2e20de64b6de8b6391c63e2f5b02ce7698bf4bf.tar.bz2 |
Adding framework support for resizable widgets
-> Added resizeMode to the widget xml
-> Fixed an unexposed bug in AppWidgetHost where
minWidth and minHeight were never being converted
from complex type to dp
Change-Id: Ibbc4fc6542d095623ac2a40694b6a3dbfeb279ad
Diffstat (limited to 'services/java/com/android/server/AppWidgetService.java')
-rw-r--r-- | services/java/com/android/server/AppWidgetService.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index ad25657..550bb3d 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -897,15 +897,15 @@ class AppWidgetService extends IAppWidgetService.Stub + "AppWidget provider '" + component + '\''); return null; } - + AttributeSet attrs = Xml.asAttributeSet(parser); - + int type; while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) { // drain whitespace, comments, etc. } - + String nodeName = parser.getName(); if (!"appwidget-provider".equals(nodeName)) { Slog.w(TAG, "Meta-data does not start with appwidget-provider tag for" @@ -925,10 +925,10 @@ class AppWidgetService extends IAppWidgetService.Stub Resources res = mPackageManager.getResourcesForApplication( activityInfo.applicationInfo); - + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AppWidgetProviderInfo); - + // These dimensions has to be resolved in the application's context. // We simply send back the raw complex data, which will be // converted to dp in {@link AppWidgetManager#getAppWidgetInfo}. @@ -937,7 +937,7 @@ class AppWidgetService extends IAppWidgetService.Stub info.minWidth = value != null ? value.data : 0; value = sa.peekValue(com.android.internal.R.styleable.AppWidgetProviderInfo_minHeight); info.minHeight = value != null ? value.data : 0; - + info.updatePeriodMillis = sa.getInt( com.android.internal.R.styleable.AppWidgetProviderInfo_updatePeriodMillis, 0); info.initialLayout = sa.getResourceId( @@ -953,6 +953,9 @@ class AppWidgetService extends IAppWidgetService.Stub com.android.internal.R.styleable.AppWidgetProviderInfo_previewImage, 0); info.autoAdvanceViewId = sa.getResourceId( com.android.internal.R.styleable.AppWidgetProviderInfo_autoAdvanceViewId, -1); + info.resizableMode = sa.getInt( + com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, + AppWidgetProviderInfo.RESIZE_NONE); sa.recycle(); } catch (Exception e) { |