Merge "Fix Folder text animation bugs." into ub-launcher3-dorval-polish

This commit is contained in:
TreeHugger Robot 2017-06-26 22:01:07 +00:00 committed by Android (Google) Code Review
commit f729eb5291
2 changed files with 10 additions and 5 deletions

View File

@ -791,6 +791,7 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
if (mFolderIcon != null) {
mFolderIcon.setVisibility(View.VISIBLE);
if (FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION) {
mFolderIcon.mFolderName.setTextVisibility(true);
mFolderIcon.setBackgroundVisible(true);
mFolderIcon.mBackground.fadeInBackgroundShadow();
}

View File

@ -19,7 +19,9 @@ package com.android.launcher3.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Region;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import com.android.launcher3.BubbleTextView;
@ -45,18 +47,20 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
mShadowInfo = new ShadowInfo(context, attrs, defStyle);
setShadowLayer(mShadowInfo.ambientShadowBlur, 0, 0, mShadowInfo.ambientShadowColor);
}
@Override
public void onDraw(Canvas canvas) {
// If text is transparent, don't draw any shadow
if ((getCurrentTextColor() >> 24) == 0) {
int alpha = Color.alpha(getCurrentTextColor());
if (alpha == 0) {
getPaint().clearShadowLayer();
super.onDraw(canvas);
return;
}
// We enhance the shadow by drawing the shadow twice
getPaint().setShadowLayer(
mShadowInfo.ambientShadowBlur, 0, 0, mShadowInfo.ambientShadowColor);
getPaint().setShadowLayer(mShadowInfo.ambientShadowBlur, 0, 0,
ColorUtils.setAlphaComponent(mShadowInfo.ambientShadowColor, alpha));
drawWithoutBadge(canvas);
canvas.save(Canvas.CLIP_SAVE_FLAG);
@ -64,8 +68,8 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
getScrollX() + getWidth(),
getScrollY() + getHeight(), Region.Op.INTERSECT);
getPaint().setShadowLayer(mShadowInfo.keyShadowBlur, 0.0f,
mShadowInfo.keyShadowOffset, mShadowInfo.keyShadowColor);
getPaint().setShadowLayer(mShadowInfo.keyShadowBlur, 0.0f, mShadowInfo.keyShadowOffset,
ColorUtils.setAlphaComponent(mShadowInfo.keyShadowColor, alpha));
drawWithoutBadge(canvas);
canvas.restore();