Merge branch 'heads/android-14.0.0_r18' into 14-dev

This commit is contained in:
MrSluffy
2023-12-14 15:26:43 +08:00
parent 32700b0100
commit cc8f9828ab
756 changed files with 23785 additions and 12235 deletions

View File

@@ -18,6 +18,7 @@
package com.android.launcher3;
import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES;
import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ICON_LABEL_AUTO_SCALING;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
@@ -103,11 +104,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
IconLabelDotView, DraggableView, Reorderable {
private static final int DISPLAY_WORKSPACE = 0;
private static final int DISPLAY_ALL_APPS = 1;
public static final int DISPLAY_ALL_APPS = 1;
private static final int DISPLAY_FOLDER = 2;
protected static final int DISPLAY_TASKBAR = 5;
private static final int DISPLAY_SEARCH_RESULT = 6;
private static final int DISPLAY_SEARCH_RESULT_SMALL = 7;
public static final int DISPLAY_SEARCH_RESULT = 6;
public static final int DISPLAY_SEARCH_RESULT_SMALL = 7;
public static final int DISPLAY_PREDICTION_ROW = 8;
public static final int DISPLAY_SEARCH_RESULT_APP_ROW = 9;
private static final float MIN_LETTER_SPACING = -0.05f;
private static final int MAX_SEARCH_LOOP_COUNT = 20;
@@ -159,7 +162,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
private final CheckLongPressHelper mLongPressHelper;
private final boolean mLayoutHorizontal;
private boolean mLayoutHorizontal;
private final boolean mIsRtl;
private final int mIconSize;
@@ -217,8 +220,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
defaultIconSize = grid.iconSizePx;
setCenterVertically(grid.isScalableGrid);
} else if (mDisplay == DISPLAY_ALL_APPS) {
setCenterVertically(grid.iconCenterVertically);
} else if (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW
|| mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW) {
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
defaultIconSize = grid.allAppsIconSizePx;
@@ -433,10 +437,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
}
/** This is used for testing to forcefully set the display to ALL_APPS */
/** This is used for testing to forcefully set the display. */
@VisibleForTesting
public void setDisplayAllApps() {
mDisplay = DISPLAY_ALL_APPS;
public void setDisplay(int display) {
mDisplay = display;
}
/**
@@ -643,6 +647,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
}
@VisibleForTesting
public boolean getForceHideDot() {
return mForceHideDot;
}
private boolean hasDot() {
return mDotInfo != null;
}
@@ -671,6 +680,18 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
}
/**
* Sets whether the layout is horizontal.
*/
public void setLayoutHorizontal(boolean layoutHorizontal) {
if (mLayoutHorizontal == layoutHorizontal) {
return;
}
mLayoutHorizontal = layoutHorizontal;
applyCompoundDrawables(getIconOrTransparentColor());
}
/**
* Sets whether to vertically center the content.
*/
@@ -1008,10 +1029,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
if (!mIsIconVisible) {
resetIconScale();
}
Drawable icon = visible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
Drawable icon = getIconOrTransparentColor();
applyCompoundDrawables(icon);
}
private Drawable getIconOrTransparentColor() {
return mIsIconVisible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
}
/** Sets the icon visual state to disabled or not. */
public void setIconDisabled(boolean isDisabled) {
if (mIcon != null) {
@@ -1106,8 +1131,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
public boolean isDisplaySearchResult() {
return mDisplay == DISPLAY_SEARCH_RESULT ||
mDisplay == DISPLAY_SEARCH_RESULT_SMALL;
return mDisplay == DISPLAY_SEARCH_RESULT
|| mDisplay == DISPLAY_SEARCH_RESULT_SMALL
|| mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW;
}
public int getIconDisplay() {
return mDisplay;
}
@Override