diff options
author | Winson Chung <winsonc@google.com> | 2013-10-09 15:50:52 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-10-09 17:53:32 -0700 |
commit | 3a6e7f330e680ef718ca7c0921d842efb4d8bbae (patch) | |
tree | 260e400c897a77d6727e5ea5f933864fa2ac1ace /src/com/android/launcher3/Hotseat.java | |
parent | 558f1c2ac73c3a0c3c0c316222b6b7f9c76e2501 (diff) | |
download | android_packages_apps_Trebuchet-3a6e7f330e680ef718ca7c0921d842efb4d8bbae.tar.gz android_packages_apps_Trebuchet-3a6e7f330e680ef718ca7c0921d842efb4d8bbae.tar.bz2 android_packages_apps_Trebuchet-3a6e7f330e680ef718ca7c0921d842efb4d8bbae.zip |
Initial changes for new clings. (Bug 11142616)
Change-Id: Id66ebceb99449941921d9e617dfe0cc05a2e3b65
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 986a89b5d..1f876fd6b 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -20,12 +20,11 @@ import android.content.ComponentName; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Bitmap; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import android.widget.TextView; @@ -102,6 +101,25 @@ public class Hotseat extends FrameLayout { } } + /** This returns the coordinates of an app in a given cell, relative to the DragLayer */ + Rect getCellCoordinates(int cellX, int cellY) { + Rect coords = new Rect(); + mContent.cellToRect(cellX, cellY, 1, 1, coords); + int[] hotseatInParent = new int[2]; + Utilities.getDescendantCoordRelativeToParent(this, mLauncher.getDragLayer(), + hotseatInParent, false); + coords.offset(hotseatInParent[0], hotseatInParent[1]); + + // Center the icon + int cWidth = mContent.getShortcutsAndWidgets().getCellContentWidth(); + int cHeight = mContent.getShortcutsAndWidgets().getCellContentHeight(); + int cellPaddingX = (int) Math.max(0, ((coords.width() - cWidth) / 2f)); + int cellPaddingY = (int) Math.max(0, ((coords.height() - cHeight) / 2f)); + coords.offset(cellPaddingX, cellPaddingY); + + return coords; + } + @Override protected void onFinishInflate() { super.onFinishInflate(); |