summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Utilities.java
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-08-05 20:35:36 -0700
committerMichael Jurka <mikejurka@google.com>2011-08-08 17:03:09 -0700
commit86c119a2267398dfe7ccbc2c262c6b48c93d76c4 (patch)
tree98c81eece6b71faf003b06ff9d3bc2c1babf379e /src/com/android/launcher2/Utilities.java
parentfa2b241424f3478200e77d61db83448c2f211fee (diff)
downloadandroid_packages_apps_Trebuchet-86c119a2267398dfe7ccbc2c262c6b48c93d76c4.tar.gz
android_packages_apps_Trebuchet-86c119a2267398dfe7ccbc2c262c6b48c93d76c4.tar.bz2
android_packages_apps_Trebuchet-86c119a2267398dfe7ccbc2c262c6b48c93d76c4.zip
Fix visual bugs
- Fix clipping of icon labels on large devices - Fix bug where icons and widgets on side pages in home workspace were visible on startup Change-Id: I8c17cfcb1ac27255b955e6db9d0eec7ce3833bd0
Diffstat (limited to 'src/com/android/launcher2/Utilities.java')
-rw-r--r--src/com/android/launcher2/Utilities.java114
1 files changed, 0 insertions, 114 deletions
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index b537f7acc..1175fadb9 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -265,120 +265,6 @@ final class Utilities {
sDisabledPaint.setAlpha(0x88);
}
- static class BubbleText {
- private static final int MAX_LINES = 2;
-
- private final TextPaint mTextPaint;
-
- private final RectF mBubbleRect = new RectF();
-
- private final float mTextWidth;
- private final int mLeading;
- private final int mFirstLineY;
- private final int mLineHeight;
-
- private final int mBitmapWidth;
- private final int mBitmapHeight;
- private final int mDensity;
-
- BubbleText(Context context) {
- final Resources resources = context.getResources();
-
- final DisplayMetrics metrics = resources.getDisplayMetrics();
- final float scale = metrics.density;
- mDensity = metrics.densityDpi;
-
- final float paddingLeft = 2.0f * scale;
- final float paddingRight = 2.0f * scale;
- final float cellWidth = resources.getDimension(R.dimen.title_texture_width);
-
- RectF bubbleRect = mBubbleRect;
- bubbleRect.left = 0;
- bubbleRect.top = 0;
- bubbleRect.right = (int) cellWidth;
-
- mTextWidth = cellWidth - paddingLeft - paddingRight;
-
- TextPaint textPaint = mTextPaint = new TextPaint();
- textPaint.setTypeface(Typeface.DEFAULT);
- textPaint.setTextSize(13*scale);
- textPaint.setColor(0xffffffff);
- textPaint.setAntiAlias(true);
- if (TEXT_BURN) {
- textPaint.setShadowLayer(8, 0, 0, 0xff000000);
- }
-
- float ascent = -textPaint.ascent();
- float descent = textPaint.descent();
- float leading = 0.0f;//(ascent+descent) * 0.1f;
- mLeading = (int)(leading + 0.5f);
- mFirstLineY = (int)(leading + ascent + 0.5f);
- mLineHeight = (int)(leading + ascent + descent + 0.5f);
-
- mBitmapWidth = (int)(mBubbleRect.width() + 0.5f);
- mBitmapHeight = roundToPow2((int)((MAX_LINES * mLineHeight) + leading + 0.5f));
-
- mBubbleRect.offsetTo((mBitmapWidth-mBubbleRect.width())/2, 0);
-
- if (false) {
- Log.d(TAG, "mBitmapWidth=" + mBitmapWidth + " mBitmapHeight="
- + mBitmapHeight + " w=" + ((int)(mBubbleRect.width() + 0.5f))
- + " h=" + ((int)((MAX_LINES * mLineHeight) + leading + 0.5f)));
- }
- }
-
- /** You own the bitmap after this and you must call recycle on it. */
- Bitmap createTextBitmap(String text) {
- Bitmap b = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ALPHA_8);
- b.setDensity(mDensity);
- Canvas c = new Canvas(b);
-
- StaticLayout layout = new StaticLayout(text, mTextPaint, (int)mTextWidth,
- Alignment.ALIGN_CENTER, 1, 0, true);
- int lineCount = layout.getLineCount();
- if (lineCount > MAX_LINES) {
- lineCount = MAX_LINES;
- }
- //if (!TEXT_BURN && lineCount > 0) {
- //RectF bubbleRect = mBubbleRect;
- //bubbleRect.bottom = height(lineCount);
- //c.drawRoundRect(bubbleRect, mCornerRadius, mCornerRadius, mRectPaint);
- //}
- for (int i=0; i<lineCount; i++) {
- //int x = (int)((mBubbleRect.width() - layout.getLineMax(i)) / 2.0f);
- //int y = mFirstLineY + (i * mLineHeight);
- final String lineText = text.substring(layout.getLineStart(i), layout.getLineEnd(i));
- int x = (int)(mBubbleRect.left
- + ((mBubbleRect.width() - mTextPaint.measureText(lineText)) * 0.5f));
- int y = mFirstLineY + (i * mLineHeight);
- c.drawText(lineText, x, y, mTextPaint);
- }
-
- c.setBitmap(null);
- return b;
- }
-
- private int height(int lineCount) {
- return (int)((lineCount * mLineHeight) + mLeading + mLeading + 0.0f);
- }
-
- int getBubbleWidth() {
- return (int)(mBubbleRect.width() + 0.5f);
- }
-
- int getMaxBubbleHeight() {
- return height(MAX_LINES);
- }
-
- int getBitmapWidth() {
- return mBitmapWidth;
- }
-
- int getBitmapHeight() {
- return mBitmapHeight;
- }
- }
-
/** Only works for positive numbers. */
static int roundToPow2(int n) {
int orig = n;