diff options
author | Adam Cohen <adamcohen@google.com> | 2014-08-12 09:23:13 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2014-08-13 21:39:48 +0000 |
commit | 63f1ec00fbbd109130d1e476371dbc9a87bb544d (patch) | |
tree | 3ce4a58917723ada9e838629e5660fe0758b83e7 /src/com/android/launcher3/Utilities.java | |
parent | 0fc1be164e982433e619bcbb16aa67e28ff681ef (diff) | |
download | android_packages_apps_Trebuchet-63f1ec00fbbd109130d1e476371dbc9a87bb544d.tar.gz android_packages_apps_Trebuchet-63f1ec00fbbd109130d1e476371dbc9a87bb544d.tar.bz2 android_packages_apps_Trebuchet-63f1ec00fbbd109130d1e476371dbc9a87bb544d.zip |
Further refinement of all apps / widgets transition
Change-Id: Id107a9aff74f014c07f8cbea6e74951a02dbddab
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 60185c658..f70fc4d86 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -67,6 +67,8 @@ public final class Utilities { static int sColors[] = { 0xffff0000, 0xff00ff00, 0xff0000ff }; static int sColorIndex = 0; + static int[] sLoc0 = new int[2]; + static int[] sLoc1 = new int[2]; // To turn on these properties, type // adb shell setprop log.tag.PROPERTY_NAME [VERBOSE | SUPPRESS] @@ -346,6 +348,25 @@ public final class Utilities { } } + public static int[] getCenterDeltaInScreenSpace(View v0, View v1, int[] delta) { + v0.getLocationInWindow(sLoc0); + v1.getLocationInWindow(sLoc1); + + sLoc0[0] += (v0.getMeasuredWidth() * v0.getScaleX()) / 2; + sLoc0[1] += (v0.getMeasuredHeight() * v0.getScaleY()) / 2; + sLoc1[0] += (v1.getMeasuredWidth() * v1.getScaleX()) / 2; + sLoc1[1] += (v1.getMeasuredHeight() * v1.getScaleY()) / 2; + + if (delta == null) { + delta = new int[2]; + } + + delta[0] = sLoc1[0] - sLoc0[0]; + delta[1] = sLoc1[1] - sLoc0[1]; + + return delta; + } + public static void scaleRectAboutCenter(Rect r, float scale) { int cx = r.centerX(); int cy = r.centerY(); |