Revert "Handles Bold Text setting for inline icon by providing bolded cloud icon"
This reverts commit 114e84908f.
Reason for revert: b/356166053
Change-Id: I30dfbc5da1caecd89b4b23aafe4de8e9efede6a0
This commit is contained in:
committed by
Android (Google) Code Review
parent
114e84908f
commit
00fb1adab4
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.graphics.fonts.FontStyle.FONT_WEIGHT_BOLD;
|
||||
import static android.graphics.fonts.FontStyle.FONT_WEIGHT_NORMAL;
|
||||
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||
|
||||
import static com.android.launcher3.Flags.enableCursorHoverStates;
|
||||
@@ -120,7 +118,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
private static final String EMPTY = "";
|
||||
private static final StringMatcherUtility.StringMatcher MATCHER =
|
||||
StringMatcherUtility.StringMatcher.getInstance();
|
||||
private static final int BOLD_TEXT_ADJUSTMENT = FONT_WEIGHT_BOLD - FONT_WEIGHT_NORMAL;
|
||||
|
||||
private static final int[] STATE_PRESSED = new int[]{android.R.attr.state_pressed};
|
||||
|
||||
@@ -507,7 +504,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
if (Flags.enableNewArchivingIcon()
|
||||
&& info instanceof ItemInfoWithIcon infoWithIcon
|
||||
&& infoWithIcon.isInactiveArchive()) {
|
||||
setTextWithArchivingIcon(label);
|
||||
setTextWithStartIcon(label, R.drawable.cloud_download_24px);
|
||||
} else {
|
||||
setText(label);
|
||||
}
|
||||
@@ -823,7 +820,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
if (Flags.enableNewArchivingIcon()
|
||||
&& getTag() instanceof ItemInfoWithIcon infoWithIcon
|
||||
&& infoWithIcon.isInactiveArchive()) {
|
||||
setTextWithArchivingIcon(modifiedString);
|
||||
setTextWithStartIcon(modifiedString, R.drawable.cloud_download_24px);
|
||||
} else {
|
||||
setText(modifiedString);
|
||||
}
|
||||
@@ -847,29 +844,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
super.setTextColor(getModifiedColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets text with a start icon for App Archiving.
|
||||
* Uses a bolded drawable if text is bolded.
|
||||
* @param text
|
||||
*/
|
||||
private void setTextWithArchivingIcon(CharSequence text) {
|
||||
var drawableId = R.drawable.cloud_download_24px;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S
|
||||
&& getResources().getConfiguration().fontWeightAdjustment >= BOLD_TEXT_ADJUSTMENT) {
|
||||
// If System bold text setting is on, then use a bolded icon
|
||||
drawableId = R.drawable.cloud_download_semibold_24px;
|
||||
}
|
||||
setTextWithStartIcon(text, drawableId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses a SpannableString to set text with a Drawable at the start of the TextView
|
||||
* @param text text to use for TextView
|
||||
* @param drawableId Drawable Resource to use for drawing image at start of text
|
||||
* @param drawableRes Drawable Resource to use for drawing image at start of text
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void setTextWithStartIcon(CharSequence text, @DrawableRes int drawableId) {
|
||||
Drawable drawable = getContext().getDrawable(drawableId);
|
||||
private void setTextWithStartIcon(CharSequence text, @DrawableRes int drawableRes) {
|
||||
Drawable drawable = getContext().getDrawable(drawableRes);
|
||||
if (drawable == null) {
|
||||
setText(text);
|
||||
Log.w(TAG, "setTextWithStartIcon: start icon Drawable not found from resources"
|
||||
|
||||
Reference in New Issue
Block a user