Merge "Fixing alpha issue on AllApps."
This commit is contained in:
@@ -144,4 +144,10 @@ public class BubbleTextView extends TextView {
|
||||
super.onDetachedFromWindow();
|
||||
mBackground.setCallback(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSetAlpha(int alpha) {
|
||||
mPaint.setAlpha(alpha);
|
||||
return super.onSetAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,8 +271,9 @@ public abstract class PagedView extends ViewGroup {
|
||||
dimAlpha = Math.max(0.0f, Math.min(1.0f, (dimAlpha * dimAlpha)));
|
||||
alpha = 1.0f - dimAlpha;
|
||||
}
|
||||
if (Float.compare(alpha, layout.getAlpha()) != 0)
|
||||
if (Float.compare(alpha, layout.getAlpha()) != 0) {
|
||||
layout.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
@@ -75,9 +75,9 @@ public class PagedViewCellLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
super.setAlpha(alpha);
|
||||
setChildrenAlpha(alpha);
|
||||
mHolographicAlpha = 1.0f - alpha;
|
||||
setChildrenAlpha(alpha);
|
||||
super.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -170,17 +170,9 @@ public class PagedViewIcon extends TextView implements Checkable {
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
final float viewAlpha = sHolographicOutlineHelper.viewAlphaInterpolator(alpha);
|
||||
mAlpha = (int) (viewAlpha * 255);
|
||||
final float holographicAlpha = sHolographicOutlineHelper.highlightAlphaInterpolator(alpha);
|
||||
mAlpha = (int) (viewAlpha * 255);
|
||||
mHolographicAlpha = (int) (holographicAlpha * 255);
|
||||
|
||||
// WORKAROUND: until TextView handles canvas shadow layer alpha itself
|
||||
int sRed = Color.red(mShadowColor);
|
||||
int sGreen = Color.green(mShadowColor);
|
||||
int sBlue = Color.blue(mShadowColor);
|
||||
super.setShadowLayer(mShadowRadius, mShadowDx, mShadowDy, Color.argb(mAlpha, sRed, sGreen,
|
||||
sBlue));
|
||||
|
||||
super.setAlpha(viewAlpha);
|
||||
}
|
||||
|
||||
@@ -227,27 +219,17 @@ public class PagedViewIcon extends TextView implements Checkable {
|
||||
}
|
||||
}
|
||||
|
||||
// WORKAROUND: until TextView handles canvas shadow layer alpha itself
|
||||
float mShadowRadius, mShadowDx, mShadowDy;
|
||||
int mShadowColor;
|
||||
@Override
|
||||
public void setShadowLayer(float radius, float dx, float dy, int color) {
|
||||
mShadowRadius = radius;
|
||||
mShadowDx = dx;
|
||||
mShadowDy = dy;
|
||||
mShadowColor = color;
|
||||
super.setShadowLayer(radius, dx, dy, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
// draw the view itself
|
||||
if (mIsHolographicUpdatePass) {
|
||||
// only clip to the text view (restore its alpha so that we get a proper outline)
|
||||
canvas.save();
|
||||
canvas.clipRect(mDrawableClipRect, Op.REPLACE);
|
||||
super.onSetAlpha(255);
|
||||
final float alpha = getAlpha();
|
||||
super.setAlpha(1.0f);
|
||||
super.onDraw(canvas);
|
||||
super.onSetAlpha(mAlpha);
|
||||
super.setAlpha(alpha);
|
||||
canvas.restore();
|
||||
} else {
|
||||
if (mAlpha > 0) {
|
||||
|
||||
Reference in New Issue
Block a user