summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Utilities.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-10-09 15:50:52 -0700
committerWinson Chung <winsonc@google.com>2013-10-09 17:53:32 -0700
commit3a6e7f330e680ef718ca7c0921d842efb4d8bbae (patch)
tree260e400c897a77d6727e5ea5f933864fa2ac1ace /src/com/android/launcher3/Utilities.java
parent558f1c2ac73c3a0c3c0c316222b6b7f9c76e2501 (diff)
downloadandroid_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/Utilities.java')
-rw-r--r--src/com/android/launcher3/Utilities.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index b6900fe52..2cb9314e1 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -295,6 +295,23 @@ final class Utilities {
sIconTextureWidth = sIconTextureHeight = widthPx;
}
+ public static void scaleRect(Rect r, float scale) {
+ if (scale != 1.0f) {
+ r.left = (int) (r.left * scale + 0.5f);
+ r.top = (int) (r.top * scale + 0.5f);
+ r.right = (int) (r.right * scale + 0.5f);
+ r.bottom = (int) (r.bottom * scale + 0.5f);
+ }
+ }
+
+ public static void scaleRectAboutCenter(Rect r, float scale) {
+ int cx = r.centerX();
+ int cy = r.centerY();
+ r.offset(-cx, -cy);
+ Utilities.scaleRect(r, scale);
+ r.offset(cx, cy);
+ }
+
public static void startActivityForResultSafely(
Activity activity, Intent intent, int requestCode) {
try {