diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-02-16 13:10:56 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2012-02-16 13:12:14 +0000 |
commit | a61e5035e42e19c47bc666030de8252eeb454924 (patch) | |
tree | 540f011154937776f62c2a9e4f94123db4b604bb /src/com | |
parent | 0a360d97ba4c378c04a390a34e115d1ef2363a41 (diff) | |
download | android_packages_apps_Trebuchet-a61e5035e42e19c47bc666030de8252eeb454924.tar.gz android_packages_apps_Trebuchet-a61e5035e42e19c47bc666030de8252eeb454924.tar.bz2 android_packages_apps_Trebuchet-a61e5035e42e19c47bc666030de8252eeb454924.zip |
AppWidget: Use old padding method on 4.0.1
Change-Id: I2f060452dca78ff62b2af8fdded3c8a554db93c1
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java | 10 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 16 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 2 |
3 files changed, 9 insertions, 19 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java b/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java index e0f3b707f..71ebfff40 100644 --- a/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java +++ b/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java @@ -112,16 +112,8 @@ public class AppWidgetResizeFrame extends FrameLayout { Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); addView(mBottomHandle, lp); - Rect p; - - // Public api for widget padding was added in 4.0.3 - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - p = AppWidgetHostView.getDefaultPaddingForWidget(context, + Rect p = mLauncher.getDefaultPaddingForWidget(context, widgetView.getAppWidgetInfo().provider, null); - } else { - p = mLauncher.getDefaultPaddingForWidget( - widgetView.getAppWidgetInfo().provider); - } mWidgetPaddingLeft = p.left; mWidgetPaddingTop = p.top; diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index af88dcad0..1d4757e33 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -952,7 +952,12 @@ public final class Launcher extends Activity } } - Rect getDefaultPaddingForWidget(ComponentName component) { + Rect getDefaultPaddingForWidget(Context context, ComponentName component, Rect rect) { + // Public api for widget padding was added in 4.0.3 + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + return AppWidgetHostView.getDefaultPaddingForWidget(context, component, rect); + } + Rect p = new Rect(); Resources r = getResources(); @@ -969,14 +974,7 @@ public final class Launcher extends Activity spanXY = new int[2]; } - Rect padding; - - // Public api for widget padding was added in 4.0.3 - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - padding = AppWidgetHostView.getDefaultPaddingForWidget(this, component, null); - } else { - padding = getDefaultPaddingForWidget(component); - } + Rect padding = getDefaultPaddingForWidget(this, component, null); // We want to account for the extra amount of padding that we are adding to the widget // to ensure that it gets the full amount of space that it has requested diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 300ac36f7..35d1b71b0 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -389,7 +389,7 @@ public class Workspace extends PagedView cl.cellToRect(hCell, vCell, hSpan, vSpan, r); if (pendingInfo instanceof PendingAddWidgetInfo) { PendingAddWidgetInfo widgetInfo = (PendingAddWidgetInfo) pendingInfo; - Rect p = AppWidgetHostView.getDefaultPaddingForWidget(mContext, + Rect p = mLauncher.getDefaultPaddingForWidget(mContext, widgetInfo.componentName, null); r.top += p.top; r.left += p.left; |