Merge "Converting FastBitmapDrawable to kotlin" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
2f9d81a9d7
@@ -23,7 +23,6 @@ import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||
import static com.android.launcher3.BubbleTextView.RunningAppState.RUNNING;
|
||||
import static com.android.launcher3.BubbleTextView.RunningAppState.MINIMIZED;
|
||||
import static com.android.launcher3.Flags.enableContrastTiles;
|
||||
import static com.android.launcher3.Flags.enableCursorHoverStates;
|
||||
import static com.android.launcher3.Flags.enableScalabilityForDesktopExperience;
|
||||
import static com.android.launcher3.allapps.AlphabeticalAppsList.PRIVATE_SPACE_PACKAGE;
|
||||
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
|
||||
@@ -251,7 +250,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mActivity = ActivityContext.lookupContext(context);
|
||||
FastBitmapDrawable.setFlagHoverEnabled(enableCursorHoverStates());
|
||||
mMinimizedStateDescription = getContext().getString(
|
||||
R.string.app_minimized_state_description);
|
||||
mRunningStateDescription = getContext().getString(R.string.app_running_state_description);
|
||||
@@ -1203,7 +1201,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
if (mIcon instanceof PreloadIconDrawable p) {
|
||||
pid = p;
|
||||
pid.setLevel(progressLevel);
|
||||
pid.setIsDisabled(isIconDisabled(info));
|
||||
pid.setDisabled(isIconDisabled(info));
|
||||
} else {
|
||||
pid = makePreloadIcon(info);
|
||||
setIcon(pid);
|
||||
@@ -1226,7 +1224,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
final PreloadIconDrawable preloadDrawable = newPendingIcon(getContext(), info);
|
||||
|
||||
preloadDrawable.setLevel(progressLevel);
|
||||
preloadDrawable.setIsDisabled(isIconDisabled(info));
|
||||
preloadDrawable.setDisabled(isIconDisabled(info));
|
||||
return preloadDrawable;
|
||||
}
|
||||
|
||||
@@ -1337,7 +1335,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
/** Sets the icon visual state to disabled or not. */
|
||||
public void setIconDisabled(boolean isDisabled) {
|
||||
if (mIcon != null) {
|
||||
mIcon.setIsDisabled(isDisabled);
|
||||
mIcon.setDisabled(isDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
// If icons are unlaunchable due to screen size, manually override disabled appearance.
|
||||
// (otherwise, leave disabled state alone; icons will naturally inherit the app's state)
|
||||
val (isApp1Launchable, isApp2Launchable) = appPairInfo.isLaunchable(p.context)
|
||||
if (!isApp1Launchable) appIcon1.setIsDisabled(true)
|
||||
if (!isApp2Launchable) appIcon2.setIsDisabled(true)
|
||||
if (!isApp1Launchable) appIcon1.isDisabled = true
|
||||
if (!isApp2Launchable) appIcon2.isDisabled = true
|
||||
|
||||
// Create icon drawable.
|
||||
val fullIconDrawable = AppPairIconDrawable(p, appIcon1, appIcon2)
|
||||
|
||||
@@ -182,7 +182,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
|
||||
|
||||
setLevel(info.getProgressLevel());
|
||||
// Set a disabled icon color if the app is suspended or if the app is pending download
|
||||
setIsDisabled(info.isDisabled() || info.isPendingDownload());
|
||||
setDisabled(info.isDisabled() || info.isPendingDownload());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -440,7 +440,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
|
||||
@Override
|
||||
public FastBitmapConstantState newConstantState() {
|
||||
return new PreloadIconConstantState(
|
||||
mBitmapInfo,
|
||||
bitmapInfo,
|
||||
mItem,
|
||||
mIndicatorColor,
|
||||
new int[] {mSystemAccentColor, mSystemBackgroundColor},
|
||||
|
||||
@@ -332,7 +332,7 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
|
||||
}
|
||||
FastBitmapDrawable drawable = bitmap.newIcon(
|
||||
context, creationFlags, Utilities.getIconShapeOrNull(context));
|
||||
drawable.setIsDisabled(isDisabled());
|
||||
drawable.setDisabled(isDisabled());
|
||||
return drawable;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class IconButtonView extends BubbleTextView {
|
||||
@TargetApi(Build.VERSION_CODES.TIRAMISU)
|
||||
IconDrawable(Bitmap b, int colorBg, Drawable fg) {
|
||||
super(b);
|
||||
mPaint.setColorFilter(new BlendModeColorFilter(colorBg, BlendMode.SRC_IN));
|
||||
paint.setColorFilter(new BlendModeColorFilter(colorBg, BlendMode.SRC_IN));
|
||||
mFg = fg;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
|
||||
// 3) App icon in the center with a setup icon on the top left corner.
|
||||
if (mDisabledForSafeMode) {
|
||||
FastBitmapDrawable disabledIcon = info.newIcon(getContext());
|
||||
disabledIcon.setIsDisabled(true);
|
||||
disabledIcon.setDisabled(true);
|
||||
mCenterDrawable = disabledIcon;
|
||||
mSettingIconDrawable = null;
|
||||
} else if (isReadyForClickSetup()) {
|
||||
|
||||
Reference in New Issue
Block a user