manual merge due to conflicts
Change-Id: I9f18e1a426be7945c159262f79201832c3474a60
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -28,4 +28,4 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
style="@style/WorkspaceIcon.Portrait" />
|
||||
style="@style/WorkspaceIcon.AllApps" />
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
<item name="android:paddingRight">5dip</item>
|
||||
</style>
|
||||
|
||||
<style name="WorkspaceIcon.AllApps">
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="WorkspaceIcon.Portrait">
|
||||
<item name="android:drawablePadding">5dip</item>
|
||||
<item name="android:paddingTop">4dip</item>
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View.MeasureSpec;
|
||||
|
||||
import com.android.launcher.R;
|
||||
|
||||
@@ -40,8 +39,6 @@ public class BubbleTextView extends CacheableTextView {
|
||||
static final float PADDING_H = 8.0f;
|
||||
static final float PADDING_V = 3.0f;
|
||||
|
||||
private int mAppCellWidth;
|
||||
|
||||
private final RectF mRect = new RectF();
|
||||
private Paint mPaint;
|
||||
private float mBubbleColorAlpha;
|
||||
@@ -78,7 +75,6 @@ public class BubbleTextView extends CacheableTextView {
|
||||
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mPaint.setColor(bubbleColor);
|
||||
mBubbleColorAlpha = Color.alpha(bubbleColor) / 255.0f;
|
||||
mAppCellWidth = (int) res.getDimension(R.dimen.app_icon_size);
|
||||
|
||||
final float scale = res.getDisplayMetrics().density;
|
||||
mCornerRadius = CORNER_RADIUS * scale;
|
||||
@@ -165,20 +161,6 @@ public class BubbleTextView extends CacheableTextView {
|
||||
super.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
if (w > 0 && h > 0) {
|
||||
// Temporary Workaround: We need to set padding to compress the text so that we can draw
|
||||
// a hotdog around it. Currently, the background images prevent us from applying the
|
||||
// padding in XML, so we are doing this programmatically
|
||||
int d = w - mAppCellWidth;
|
||||
int pL = d - (d / 2);
|
||||
int pR = d - pL;
|
||||
setPadding(pL, getPaddingTop(), pR, getPaddingBottom());
|
||||
}
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
@@ -18,9 +18,10 @@ package com.android.launcher2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.Rect;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
@@ -66,7 +67,13 @@ public class CacheableTextView extends TextView {
|
||||
}
|
||||
|
||||
public void buildAndEnableCache() {
|
||||
if (getLayout() == null) {
|
||||
// Defers building the cache until the next draw to allow measuring
|
||||
// and laying out.
|
||||
buildAndEnableCache(false);
|
||||
}
|
||||
|
||||
public void buildAndEnableCache(boolean isImmediate) {
|
||||
if (getLayout() == null || !isImmediate) {
|
||||
mWaitingToGenerateCache = true;
|
||||
return;
|
||||
}
|
||||
@@ -94,8 +101,20 @@ public class CacheableTextView extends TextView {
|
||||
int height = (int) (textCacheBottom - mTextCacheTop);
|
||||
|
||||
if (width != 0 && height != 0) {
|
||||
mCache = Bitmap.createBitmap(width, height, Config.ARGB_8888);
|
||||
mCacheCanvas.setBitmap(mCache);
|
||||
if (mCache != null) {
|
||||
if (mCache.getWidth() != width || mCache.getHeight() != height) {
|
||||
mCache.recycle();
|
||||
mCache = null;
|
||||
}
|
||||
}
|
||||
if (mCache == null) {
|
||||
mCache = Bitmap.createBitmap(width, height, Config.ARGB_8888);
|
||||
mCacheCanvas.setBitmap(mCache);
|
||||
} else {
|
||||
mCacheCanvas.drawColor(0x00000000);
|
||||
}
|
||||
|
||||
mCacheCanvas.save();
|
||||
mCacheCanvas.translate(-mTextCacheLeft, -mTextCacheTop);
|
||||
|
||||
mIsBuildingCache = true;
|
||||
@@ -103,6 +122,7 @@ public class CacheableTextView extends TextView {
|
||||
draw(mCacheCanvas);
|
||||
setAlpha(prevAlpha);
|
||||
mIsBuildingCache = false;
|
||||
mCacheCanvas.restore();
|
||||
|
||||
// A hack-- we set the text to be one space (we don't make it empty just to avoid any
|
||||
// potential issues with text measurement, like line height, etc.) so that the text view
|
||||
@@ -114,10 +134,10 @@ public class CacheableTextView extends TextView {
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
if (mWaitingToGenerateCache && !mIsBuildingCache) {
|
||||
buildAndEnableCache();
|
||||
buildAndEnableCache(true);
|
||||
mWaitingToGenerateCache = false;
|
||||
}
|
||||
if (mCache != null) {
|
||||
if (mCache != null && !mIsBuildingCache) {
|
||||
canvas.drawBitmap(mCache, mTextCacheLeft - mTextCacheScrollX + mScrollX,
|
||||
mTextCacheTop, mCachePaint);
|
||||
}
|
||||
|
||||