diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-12-25 20:52:17 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2012-12-26 13:38:24 +0000 |
commit | 8fb6e3e975674d6960dc370ce0d2c7dd80b50117 (patch) | |
tree | 77b4eee121191a0fe1814ab6973062f5a3a25121 /src | |
parent | 2fc141a085b6fbabce43b5245d85999bcc3b93ab (diff) | |
download | android_packages_apps_Trebuchet-8fb6e3e975674d6960dc370ce0d2c7dd80b50117.tar.gz android_packages_apps_Trebuchet-8fb6e3e975674d6960dc370ce0d2c7dd80b50117.tar.bz2 android_packages_apps_Trebuchet-8fb6e3e975674d6960dc370ce0d2c7dd80b50117.zip |
AppsCustomizePagedView: Fixes
Change-Id: Iaddfc70886546dca52c5178f6f0d63cbbec56ac7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java | 28 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 4 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index 3da7f8e5c..7d5346ff0 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java @@ -281,6 +281,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen private int mMaxAppCellCountX, mMaxAppCellCountY; private int mWidgetCountX, mWidgetCountY; private int mWidgetWidthGap, mWidgetHeightGap; + private final int mWidgetPreviewIconPaddedDimension; private static final float WIDGET_PREVIEW_ICON_PADDING_PERCENTAGE = 0.25f; private PagedViewCellLayout mWidgetSpacingLayout; private int mNumAppsPages = 0; @@ -415,6 +416,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mClingFocusedY = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedY, 0); a.recycle(); mWidgetSpacingLayout = new PagedViewCellLayout(getContext()); + + // The padding on the non-matched dimension for the default widget preview icons + // (top + bottom) + mWidgetPreviewIconPaddedDimension = + (int) (mAppIconSize * (1 + (2 * WIDGET_PREVIEW_ICON_PADDING_PERCENTAGE))); } @Override @@ -602,7 +608,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } else if (!mHasShownAllAppsSortCling && isDataReady() && allAppsCling != null && allAppsCling.isDismissed()) { mHasShownAllAppsSortCling = true; - mLauncher.showFirstRunAllAppsSortCling(); + tabHost.selectAppsTab(); + // Calculate the position for the cling punch through + int[] offset = new int[2]; + View appsTab = tabHost.getCurrentTabView(); + mLauncher.getDragLayer().getLocationInDragLayer(appsTab, offset); + mLauncher.showFirstRunAllAppsSortCling(offset); } } } @@ -910,8 +921,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen Matrix.ScaleToFit.START); m.getValues(mv); scale = mv[0]; - } else { - PendingAddShortcutInfo createShortcutInfo = (PendingAddShortcutInfo) v.getTag(); + } else if (createItemInfo instanceof PendingAddShortcutInfo) { + PendingAddShortcutInfo createShortcutInfo = (PendingAddShortcutInfo) createItemInfo; Drawable icon = mIconCache.getFullResIcon(createShortcutInfo.shortcutActivityInfo); preview = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); @@ -923,6 +934,17 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mCanvas.restore(); mCanvas.setBitmap(null); createItemInfo.spanX = createItemInfo.spanY = 1; + } else { + // Workaround for the fact that we don't keep the original ResolveInfo associated with + // the shortcut around. To get the icon, we just render the preview image (which has + // the shortcut icon) to a new drag bitmap that clips the non-icon space. + preview = Bitmap.createBitmap(mWidgetPreviewIconPaddedDimension, + mWidgetPreviewIconPaddedDimension, Bitmap.Config.ARGB_8888); + Drawable d = image.getDrawable(); + mCanvas.setBitmap(preview); + d.draw(mCanvas); + mCanvas.setBitmap(null); + createItemInfo.spanX = createItemInfo.spanY = 1; } // Don't clip alpha values for the drag outline if we're using the default widget preview diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 8dceb3bbe..023ab564c 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -4183,12 +4183,12 @@ public final class Launcher extends Activity removeCling(R.id.all_apps_cling); } } - public void showFirstRunAllAppsSortCling() { + public void showFirstRunAllAppsSortCling(int[] position) { // Enable the clings only if they have not been dismissed before SharedPreferences prefs = getSharedPreferences(PreferencesProvider.PREFERENCES_KEY, Context.MODE_PRIVATE); if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_SORT_CLING_DISMISSED_KEY, false)) { - initCling(R.id.all_apps_sort_cling, null, true, 0); + initCling(R.id.all_apps_sort_cling, position, true, 0); } else { removeCling(R.id.all_apps_sort_cling); } |