diff options
author | Winson Chung <winsonc@google.com> | 2015-06-05 18:09:35 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-05 18:09:35 +0000 |
commit | 6103501fa6c70ca112ac867e18e5f82021bf4f7c (patch) | |
tree | 7a371d309afdabb03f7db35bb17288ecc065cdf4 /src/com/android/launcher3/Utilities.java | |
parent | 7501adf4b71bb17d0785a5939efbcac4b39125c3 (diff) | |
parent | 2c6e5ccbcd7c3f87e7e85029782440600dc0a3d8 (diff) | |
download | android_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.tar.gz android_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.tar.bz2 android_packages_apps_Trebuchet-6103501fa6c70ca112ac867e18e5f82021bf4f7c.zip |
Merge "Ensuring that we use the screen width more optimally in AllApps." into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index b267f759d..0cd980cb2 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -54,7 +54,6 @@ import android.util.SparseArray; import android.util.TypedValue; import android.view.View; import android.widget.Toast; - import junit.framework.Assert; import java.io.ByteArrayOutputStream; @@ -628,6 +627,16 @@ public final class Utilities { return m.replaceAll("$1"); } + /** + * Calculates the height of a given string at a specific text size. + */ + public static float calculateTextHeight(float textSizePx) { + Paint p = new Paint(); + p.setTextSize(textSizePx); + Paint.FontMetrics fm = p.getFontMetrics(); + return -fm.top + fm.bottom; + } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static boolean isRtl(Resources res) { return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) && |