Merge "Crossfading splashscreen if icon is themed" into sc-dev am: 55060ca7ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14687100 Change-Id: I99c6254f5c732e88a0733df77a6430dc0f539682
This commit is contained in:
@@ -583,7 +583,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
|
|
||||||
AnimOpenProperties prop = new AnimOpenProperties(mLauncher.getResources(), mDeviceProfile,
|
AnimOpenProperties prop = new AnimOpenProperties(mLauncher.getResources(), mDeviceProfile,
|
||||||
windowTargetBounds, launcherIconBounds, v, dragLayerBounds[0], dragLayerBounds[1],
|
windowTargetBounds, launcherIconBounds, v, dragLayerBounds[0], dragLayerBounds[1],
|
||||||
hasSplashScreen);
|
hasSplashScreen, floatingView.isDifferentFromAppIcon());
|
||||||
int left = (int) (prop.cropCenterXStart - prop.cropWidthStart / 2);
|
int left = (int) (prop.cropCenterXStart - prop.cropWidthStart / 2);
|
||||||
int top = (int) (prop.cropCenterYStart - prop.cropHeightStart / 2);
|
int top = (int) (prop.cropCenterYStart - prop.cropHeightStart / 2);
|
||||||
int right = (int) (left + prop.cropWidthStart);
|
int right = (int) (left + prop.cropWidthStart);
|
||||||
@@ -1327,7 +1327,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
|
|
||||||
AnimOpenProperties(Resources r, DeviceProfile dp, Rect windowTargetBounds,
|
AnimOpenProperties(Resources r, DeviceProfile dp, Rect windowTargetBounds,
|
||||||
RectF launcherIconBounds, View view, int dragLayerLeft, int dragLayerTop,
|
RectF launcherIconBounds, View view, int dragLayerLeft, int dragLayerTop,
|
||||||
boolean hasSplashScreen) {
|
boolean hasSplashScreen, boolean hasDifferentAppIcon) {
|
||||||
// Scale the app icon to take up the entire screen. This simplifies the math when
|
// Scale the app icon to take up the entire screen. This simplifies the math when
|
||||||
// animating the app window position / scale.
|
// animating the app window position / scale.
|
||||||
float smallestSize = Math.min(windowTargetBounds.height(), windowTargetBounds.width());
|
float smallestSize = Math.min(windowTargetBounds.height(), windowTargetBounds.width());
|
||||||
@@ -1359,8 +1359,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
: APP_LAUNCH_DOWN_CURVED_DURATION;
|
: APP_LAUNCH_DOWN_CURVED_DURATION;
|
||||||
alphaDuration = useUpwardAnimation ? APP_LAUNCH_ALPHA_DURATION
|
alphaDuration = useUpwardAnimation ? APP_LAUNCH_ALPHA_DURATION
|
||||||
: APP_LAUNCH_ALPHA_DOWN_DURATION;
|
: APP_LAUNCH_ALPHA_DOWN_DURATION;
|
||||||
|
iconAlphaStart = hasSplashScreen && !hasDifferentAppIcon ? 0 : 1f;
|
||||||
iconAlphaStart = hasSplashScreen ? 0 : 1f;
|
|
||||||
|
|
||||||
// TOOD: Share value from shell when available.
|
// TOOD: Share value from shell when available.
|
||||||
final float windowIconSize = Utilities.pxFromSp(108, r.getDisplayMetrics());
|
final float windowIconSize = Utilities.pxFromSp(108, r.getDisplayMetrics());
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
|||||||
};
|
};
|
||||||
|
|
||||||
private final ActivityContext mActivity;
|
private final ActivityContext mActivity;
|
||||||
private Drawable mIcon;
|
private FastBitmapDrawable mIcon;
|
||||||
private boolean mCenterVertically;
|
private boolean mCenterVertically;
|
||||||
|
|
||||||
protected final int mDisplay;
|
protected final int mDisplay;
|
||||||
@@ -335,16 +335,6 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly set the icon and label.
|
|
||||||
*/
|
|
||||||
@UiThread
|
|
||||||
public void applyIconAndLabel(Drawable icon, CharSequence label) {
|
|
||||||
setIcon(icon);
|
|
||||||
setText(label);
|
|
||||||
setContentDescription(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the default long press timeout.
|
* Overrides the default long press timeout.
|
||||||
*/
|
*/
|
||||||
@@ -369,7 +359,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the icon for this view. */
|
/** Returns the icon for this view. */
|
||||||
public Drawable getIcon() {
|
public FastBitmapDrawable getIcon() {
|
||||||
return mIcon;
|
return mIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,7 +694,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
|||||||
/**
|
/**
|
||||||
* Sets the icon for this view based on the layout direction.
|
* Sets the icon for this view based on the layout direction.
|
||||||
*/
|
*/
|
||||||
protected void setIcon(Drawable icon) {
|
protected void setIcon(FastBitmapDrawable icon) {
|
||||||
if (mIsIconVisible) {
|
if (mIsIconVisible) {
|
||||||
applyCompoundDrawables(icon);
|
applyCompoundDrawables(icon);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import com.android.launcher3.dragndrop.DragLayer;
|
|||||||
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
||||||
import com.android.launcher3.folder.FolderIcon;
|
import com.android.launcher3.folder.FolderIcon;
|
||||||
import com.android.launcher3.graphics.PreloadIconDrawable;
|
import com.android.launcher3.graphics.PreloadIconDrawable;
|
||||||
|
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||||
import com.android.launcher3.icons.LauncherIcons;
|
import com.android.launcher3.icons.LauncherIcons;
|
||||||
import com.android.launcher3.model.data.ItemInfo;
|
import com.android.launcher3.model.data.ItemInfo;
|
||||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||||
@@ -250,27 +251,12 @@ public class FloatingIconView extends FrameLayout implements
|
|||||||
@WorkerThread
|
@WorkerThread
|
||||||
@SuppressWarnings("WrongThread")
|
@SuppressWarnings("WrongThread")
|
||||||
private static void getIconResult(Launcher l, View originalView, ItemInfo info, RectF pos,
|
private static void getIconResult(Launcher l, View originalView, ItemInfo info, RectF pos,
|
||||||
IconLoadResult iconLoadResult) {
|
Drawable btvIcon, IconLoadResult iconLoadResult) {
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
Drawable btvIcon;
|
|
||||||
Drawable badge = null;
|
|
||||||
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
|
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
|
||||||
&& !info.isDisabled(); // Use original icon for disabled icons.
|
&& !info.isDisabled(); // Use original icon for disabled icons.
|
||||||
|
|
||||||
if (originalView instanceof BubbleTextView) {
|
Drawable badge = null;
|
||||||
BubbleTextView btv = (BubbleTextView) originalView;
|
|
||||||
|
|
||||||
if (info instanceof ItemInfoWithIcon
|
|
||||||
&& (((ItemInfoWithIcon) info).runtimeStatusFlags
|
|
||||||
& ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
|
|
||||||
btvIcon = btv.makePreloadIcon();
|
|
||||||
} else {
|
|
||||||
btvIcon = btv.getIcon();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
btvIcon = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info instanceof SystemShortcut) {
|
if (info instanceof SystemShortcut) {
|
||||||
if (originalView instanceof ImageView) {
|
if (originalView instanceof ImageView) {
|
||||||
drawable = ((ImageView) originalView).getDrawable();
|
drawable = ((ImageView) originalView).getDrawable();
|
||||||
@@ -367,6 +353,13 @@ public class FloatingIconView extends FrameLayout implements
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the icon is different from main app icon
|
||||||
|
*/
|
||||||
|
public boolean isDifferentFromAppIcon() {
|
||||||
|
return mIconLoadResult == null ? false : mIconLoadResult.isThemed;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the icon result is loaded. If true, we set the icon immediately. Else, we add a
|
* Checks if the icon result is loaded. If true, we set the icon immediately. Else, we add a
|
||||||
* callback to set the icon once the icon result is loaded.
|
* callback to set the icon once the icon result is loaded.
|
||||||
@@ -505,12 +498,28 @@ public class FloatingIconView extends FrameLayout implements
|
|||||||
*/
|
*/
|
||||||
@UiThread
|
@UiThread
|
||||||
public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
|
public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
|
||||||
IconLoadResult result = new IconLoadResult(info);
|
RectF position = new RectF();
|
||||||
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
|
getLocationBoundsForView(l, v, isOpening, position);
|
||||||
RectF position = new RectF();
|
|
||||||
getLocationBoundsForView(l, v, isOpening, position);
|
final FastBitmapDrawable btvIcon;
|
||||||
getIconResult(l, v, info, position, result);
|
if (v instanceof BubbleTextView) {
|
||||||
});
|
BubbleTextView btv = (BubbleTextView) v;
|
||||||
|
if (info instanceof ItemInfoWithIcon
|
||||||
|
&& (((ItemInfoWithIcon) info).runtimeStatusFlags
|
||||||
|
& ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
|
||||||
|
btvIcon = btv.makePreloadIcon();
|
||||||
|
} else {
|
||||||
|
btvIcon = btv.getIcon();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
btvIcon = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IconLoadResult result = new IconLoadResult(info,
|
||||||
|
btvIcon == null ? false : btvIcon.isThemed());
|
||||||
|
|
||||||
|
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() ->
|
||||||
|
getIconResult(l, v, info, position, btvIcon, result));
|
||||||
|
|
||||||
sIconLoadResult = result;
|
sIconLoadResult = result;
|
||||||
return result;
|
return result;
|
||||||
@@ -626,6 +635,7 @@ public class FloatingIconView extends FrameLayout implements
|
|||||||
|
|
||||||
private static class IconLoadResult {
|
private static class IconLoadResult {
|
||||||
final ItemInfo itemInfo;
|
final ItemInfo itemInfo;
|
||||||
|
final boolean isThemed;
|
||||||
Drawable btvDrawable;
|
Drawable btvDrawable;
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
Drawable badge;
|
Drawable badge;
|
||||||
@@ -633,8 +643,9 @@ public class FloatingIconView extends FrameLayout implements
|
|||||||
Runnable onIconLoaded;
|
Runnable onIconLoaded;
|
||||||
boolean isIconLoaded;
|
boolean isIconLoaded;
|
||||||
|
|
||||||
IconLoadResult(ItemInfo itemInfo) {
|
IconLoadResult(ItemInfo itemInfo, boolean isThemed) {
|
||||||
this.itemInfo = itemInfo;
|
this.itemInfo = itemInfo;
|
||||||
|
this.isThemed = isThemed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user