Fix contrast tile measurement calculation for folders
When creating a folder, the element name begins empty. Because of this, while layout is happening, the paddings for the text and the bubble are not considered. Fix the condition within onMeasure to add the respective paddings when the bubble could be drawn. Bug: 341217082 Flag: com.android.launcher3.enable_contrast_tiles Test: Manual, visual change Change-Id: Ie707102fa3d4827568a9db247ea5ebf5f8e1ae0d
This commit is contained in:
@@ -964,7 +964,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
|
||||
@Override
|
||||
public void setTextColor(ColorStateList colors) {
|
||||
mTextColor = shouldDrawAppContrastTile() ? PillColorProvider.getInstance(
|
||||
mTextColor = (shouldDrawAppContrastTile() && !TextUtils.isEmpty(getText()))
|
||||
? PillColorProvider.getInstance(
|
||||
getContext()).getAppTitleTextPaint().getColor()
|
||||
: colors.getDefaultColor();
|
||||
mTextColorStateList = colors;
|
||||
@@ -989,7 +990,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
public boolean shouldDrawAppContrastTile() {
|
||||
return mDisplay == DISPLAY_WORKSPACE && shouldTextBeVisible()
|
||||
&& PillColorProvider.getInstance(getContext()).isMatchaEnabled()
|
||||
&& enableContrastTiles() && !TextUtils.isEmpty(getText());
|
||||
&& enableContrastTiles();
|
||||
}
|
||||
|
||||
public void setTextVisibility(boolean visible) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -102,7 +103,7 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
if (shouldDrawAppContrastTile()) {
|
||||
if (shouldDrawAppContrastTile() && !TextUtils.isEmpty(getText())) {
|
||||
drawAppContrastTile(canvas);
|
||||
}
|
||||
// If text is transparent or shadow alpha is 0, don't draw any shadow
|
||||
|
||||
Reference in New Issue
Block a user