Loading src/com/android/launcher3/BubbleTextView.java +3 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3; import static android.text.Layout.Alignment.ALIGN_NORMAL; 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.config.FeatureFlags.enableCursorHoverStates; import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon; Loading Loading @@ -878,7 +877,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if ((info.runtimeStatusFlags & FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0 || info.hasPromiseIconUi() || (info.runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) != 0 || (ENABLE_DOWNLOAD_APP_UX_V2.get() && icon != null)) { || (icon != null)) { updateProgressBarUi(info.getProgressLevel() == 100 ? icon : null); } } Loading Loading @@ -915,9 +914,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if (mIcon instanceof PreloadIconDrawable) { preloadIconDrawable = (PreloadIconDrawable) mIcon; preloadIconDrawable.setLevel(progressLevel); preloadIconDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get() ? info.getProgressLevel() == 0 : !info.isAppStartable()); preloadIconDrawable.setIsDisabled(info.getProgressLevel() == 0); } else { preloadIconDrawable = makePreloadIcon(); setIcon(preloadIconDrawable); Loading @@ -942,9 +939,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, final PreloadIconDrawable preloadDrawable = newPendingIcon(getContext(), info); preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get() ? info.getProgressLevel() == 0 : !info.isAppStartable()); preloadDrawable.setIsDisabled(info.getProgressLevel() == 0); return preloadDrawable; } Loading src/com/android/launcher3/config/FeatureFlags.java +0 −7 Original line number Diff line number Diff line Loading @@ -151,13 +151,6 @@ public final class FeatureFlags { // TODO(Block 8): Clean up flags // TODO(Block 9): Clean up flags public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V2 = getReleaseFlag(270395134, "ENABLE_DOWNLOAD_APP_UX_V2", ENABLED, "Updates the download app UX" + " to have better visuals"); public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V3 = getDebugFlag(270395186, "ENABLE_DOWNLOAD_APP_UX_V3", ENABLED, "Updates the download app UX" + " to have better visuals, improve contrast, and color"); public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(270395278, "SHOW_DOT_PAGINATION", ENABLED, "Enable showing dot pagination in workspace"); Loading src/com/android/launcher3/graphics/PreloadIconDrawable.java +12 −57 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.launcher3.graphics; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V2; import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -76,10 +74,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable { // Duration = COMPLETE_ANIM_FRACTION * DURATION_SCALE private static final float COMPLETE_ANIM_FRACTION = 1f; private static final float SMALL_SCALE = ENABLE_DOWNLOAD_APP_UX_V3.get() ? 0.8f : 0.7f; private static final float PROGRESS_STROKE_SCALE = ENABLE_DOWNLOAD_APP_UX_V2.get() ? 0.055f : 0.075f; private static final float SMALL_SCALE = 0.8f; private static final float PROGRESS_STROKE_SCALE = 0.055f; private static final float PROGRESS_BOUNDS_SCALE = 0.075f; private static final int PRELOAD_ACCENT_COLOR_INDEX = 0; private static final int PRELOAD_BACKGROUND_COLOR_INDEX = 1; Loading Loading @@ -119,8 +115,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { private ObjectAnimator mCurrentAnim; private boolean mIsStartable; public PreloadIconDrawable(ItemInfoWithIcon info, Context context) { this( info, Loading @@ -144,9 +138,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); if (ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setAlpha(MAX_PAINT_ALPHA); } mIndicatorColor = indicatorColor; // This is the color Loading Loading @@ -181,9 +173,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mIconScaleMultiplier.updateValue(info.getProgressLevel() == 0 ? 0 : 1); setLevel(info.getProgressLevel()); if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { setIsStartable(info.isAppStartable()); } } @Override Loading Loading @@ -212,54 +201,31 @@ public class PreloadIconDrawable extends FastBitmapDrawable { return; } if (mInternalStateProgress > 0 && (ENABLE_DOWNLOAD_APP_UX_V3.get() || !ENABLE_DOWNLOAD_APP_UX_V2.get())) { if (mInternalStateProgress > 0) { // Draw background. mProgressPaint.setStyle(ENABLE_DOWNLOAD_APP_UX_V3.get() ? Paint.Style.FILL : Paint.Style.FILL_AND_STROKE); mProgressPaint.setColor(ENABLE_DOWNLOAD_APP_UX_V3.get() ? mPlateColor : mSystemBackgroundColor); mProgressPaint.setStyle(Paint.Style.FILL); mProgressPaint.setColor(mPlateColor); canvas.drawPath(mScaledTrackPath, mProgressPaint); } if (!ENABLE_DOWNLOAD_APP_UX_V2.get() || mInternalStateProgress > 0) { if (mInternalStateProgress > 0) { // Draw track and progress. mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setColor(ENABLE_DOWNLOAD_APP_UX_V3.get() ? mTrackColor : mSystemAccentColor); if (!ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setAlpha(TRACK_ALPHA); } mProgressPaint.setColor(mTrackColor); canvas.drawPath(mScaledTrackPath, mProgressPaint); mProgressPaint.setAlpha(MAX_PAINT_ALPHA); if (ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setColor(mProgressColor); } canvas.drawPath(mScaledProgressPath, mProgressPaint); } int saveCount = canvas.save(); float scale = ENABLE_DOWNLOAD_APP_UX_V2.get() ? 1 - mIconScaleMultiplier.value * (1 - SMALL_SCALE) : SMALL_SCALE; float scale = 1 - mIconScaleMultiplier.value * (1 - SMALL_SCALE); canvas.scale(scale, scale, bounds.exactCenterX(), bounds.exactCenterY()); super.drawInternal(canvas, bounds); canvas.restoreToCount(saveCount); } @Override protected void updateFilter() { if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { setAlpha(mIsDisabled ? DISABLED_ICON_ALPHA : MAX_PAINT_ALPHA); } else { super.updateFilter(); } } /** * Updates the install progress based on the level */ Loading Loading @@ -296,14 +262,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { return !mRanFinishAnimation; } /** Sets whether this icon should display the startable app UI. */ public void setIsStartable(boolean isStartable) { if (mIsStartable != isStartable) { mIsStartable = isStartable; setIsDisabled(!isStartable); } } private void updateInternalState( float finalProgress, boolean isFinish, Runnable onFinishCallback) { if (mCurrentAnim != null) { Loading Loading @@ -355,7 +313,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable { */ private void setInternalProgress(float progress) { // Animate scale and alpha from pending to downloading state. if (ENABLE_DOWNLOAD_APP_UX_V2.get() && progress > 0 && mInternalStateProgress == 0) { if (progress > 0 && mInternalStateProgress == 0) { // Progress is changing for the first time, animate the icon scale Animator iconScaleAnimator = mIconScaleMultiplier.animateToValue(1); iconScaleAnimator.setDuration(SCALE_AND_ALPHA_ANIM_DURATION); Loading @@ -365,14 +323,11 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mInternalStateProgress = progress; if (progress <= 0) { if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { mScaledTrackPath.reset(); } mIconScaleMultiplier.updateValue(0); } else { mPathMeasure.getSegment( 0, Math.min(progress, 1) * mTrackLength, mScaledProgressPath, true); if (progress > 1 && ENABLE_DOWNLOAD_APP_UX_V2.get()) { if (progress > 1) { // map the scale back to original value mIconScaleMultiplier.updateValue(Utilities.mapBoundToRange( progress - 1, 0, COMPLETE_ANIM_FRACTION, 1, 0, EMPHASIZED)); Loading Loading
src/com/android/launcher3/BubbleTextView.java +3 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3; import static android.text.Layout.Alignment.ALIGN_NORMAL; 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.config.FeatureFlags.enableCursorHoverStates; import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon; Loading Loading @@ -878,7 +877,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if ((info.runtimeStatusFlags & FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0 || info.hasPromiseIconUi() || (info.runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) != 0 || (ENABLE_DOWNLOAD_APP_UX_V2.get() && icon != null)) { || (icon != null)) { updateProgressBarUi(info.getProgressLevel() == 100 ? icon : null); } } Loading Loading @@ -915,9 +914,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if (mIcon instanceof PreloadIconDrawable) { preloadIconDrawable = (PreloadIconDrawable) mIcon; preloadIconDrawable.setLevel(progressLevel); preloadIconDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get() ? info.getProgressLevel() == 0 : !info.isAppStartable()); preloadIconDrawable.setIsDisabled(info.getProgressLevel() == 0); } else { preloadIconDrawable = makePreloadIcon(); setIcon(preloadIconDrawable); Loading @@ -942,9 +939,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, final PreloadIconDrawable preloadDrawable = newPendingIcon(getContext(), info); preloadDrawable.setLevel(progressLevel); preloadDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get() ? info.getProgressLevel() == 0 : !info.isAppStartable()); preloadDrawable.setIsDisabled(info.getProgressLevel() == 0); return preloadDrawable; } Loading
src/com/android/launcher3/config/FeatureFlags.java +0 −7 Original line number Diff line number Diff line Loading @@ -151,13 +151,6 @@ public final class FeatureFlags { // TODO(Block 8): Clean up flags // TODO(Block 9): Clean up flags public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V2 = getReleaseFlag(270395134, "ENABLE_DOWNLOAD_APP_UX_V2", ENABLED, "Updates the download app UX" + " to have better visuals"); public static final BooleanFlag ENABLE_DOWNLOAD_APP_UX_V3 = getDebugFlag(270395186, "ENABLE_DOWNLOAD_APP_UX_V3", ENABLED, "Updates the download app UX" + " to have better visuals, improve contrast, and color"); public static final BooleanFlag SHOW_DOT_PAGINATION = getDebugFlag(270395278, "SHOW_DOT_PAGINATION", ENABLED, "Enable showing dot pagination in workspace"); Loading
src/com/android/launcher3/graphics/PreloadIconDrawable.java +12 −57 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.launcher3.graphics; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V2; import static com.android.launcher3.config.FeatureFlags.ENABLE_DOWNLOAD_APP_UX_V3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -76,10 +74,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable { // Duration = COMPLETE_ANIM_FRACTION * DURATION_SCALE private static final float COMPLETE_ANIM_FRACTION = 1f; private static final float SMALL_SCALE = ENABLE_DOWNLOAD_APP_UX_V3.get() ? 0.8f : 0.7f; private static final float PROGRESS_STROKE_SCALE = ENABLE_DOWNLOAD_APP_UX_V2.get() ? 0.055f : 0.075f; private static final float SMALL_SCALE = 0.8f; private static final float PROGRESS_STROKE_SCALE = 0.055f; private static final float PROGRESS_BOUNDS_SCALE = 0.075f; private static final int PRELOAD_ACCENT_COLOR_INDEX = 0; private static final int PRELOAD_BACKGROUND_COLOR_INDEX = 1; Loading Loading @@ -119,8 +115,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { private ObjectAnimator mCurrentAnim; private boolean mIsStartable; public PreloadIconDrawable(ItemInfoWithIcon info, Context context) { this( info, Loading @@ -144,9 +138,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); if (ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setAlpha(MAX_PAINT_ALPHA); } mIndicatorColor = indicatorColor; // This is the color Loading Loading @@ -181,9 +173,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mIconScaleMultiplier.updateValue(info.getProgressLevel() == 0 ? 0 : 1); setLevel(info.getProgressLevel()); if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { setIsStartable(info.isAppStartable()); } } @Override Loading Loading @@ -212,54 +201,31 @@ public class PreloadIconDrawable extends FastBitmapDrawable { return; } if (mInternalStateProgress > 0 && (ENABLE_DOWNLOAD_APP_UX_V3.get() || !ENABLE_DOWNLOAD_APP_UX_V2.get())) { if (mInternalStateProgress > 0) { // Draw background. mProgressPaint.setStyle(ENABLE_DOWNLOAD_APP_UX_V3.get() ? Paint.Style.FILL : Paint.Style.FILL_AND_STROKE); mProgressPaint.setColor(ENABLE_DOWNLOAD_APP_UX_V3.get() ? mPlateColor : mSystemBackgroundColor); mProgressPaint.setStyle(Paint.Style.FILL); mProgressPaint.setColor(mPlateColor); canvas.drawPath(mScaledTrackPath, mProgressPaint); } if (!ENABLE_DOWNLOAD_APP_UX_V2.get() || mInternalStateProgress > 0) { if (mInternalStateProgress > 0) { // Draw track and progress. mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setColor(ENABLE_DOWNLOAD_APP_UX_V3.get() ? mTrackColor : mSystemAccentColor); if (!ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setAlpha(TRACK_ALPHA); } mProgressPaint.setColor(mTrackColor); canvas.drawPath(mScaledTrackPath, mProgressPaint); mProgressPaint.setAlpha(MAX_PAINT_ALPHA); if (ENABLE_DOWNLOAD_APP_UX_V3.get()) { mProgressPaint.setColor(mProgressColor); } canvas.drawPath(mScaledProgressPath, mProgressPaint); } int saveCount = canvas.save(); float scale = ENABLE_DOWNLOAD_APP_UX_V2.get() ? 1 - mIconScaleMultiplier.value * (1 - SMALL_SCALE) : SMALL_SCALE; float scale = 1 - mIconScaleMultiplier.value * (1 - SMALL_SCALE); canvas.scale(scale, scale, bounds.exactCenterX(), bounds.exactCenterY()); super.drawInternal(canvas, bounds); canvas.restoreToCount(saveCount); } @Override protected void updateFilter() { if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { setAlpha(mIsDisabled ? DISABLED_ICON_ALPHA : MAX_PAINT_ALPHA); } else { super.updateFilter(); } } /** * Updates the install progress based on the level */ Loading Loading @@ -296,14 +262,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable { return !mRanFinishAnimation; } /** Sets whether this icon should display the startable app UI. */ public void setIsStartable(boolean isStartable) { if (mIsStartable != isStartable) { mIsStartable = isStartable; setIsDisabled(!isStartable); } } private void updateInternalState( float finalProgress, boolean isFinish, Runnable onFinishCallback) { if (mCurrentAnim != null) { Loading Loading @@ -355,7 +313,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable { */ private void setInternalProgress(float progress) { // Animate scale and alpha from pending to downloading state. if (ENABLE_DOWNLOAD_APP_UX_V2.get() && progress > 0 && mInternalStateProgress == 0) { if (progress > 0 && mInternalStateProgress == 0) { // Progress is changing for the first time, animate the icon scale Animator iconScaleAnimator = mIconScaleMultiplier.animateToValue(1); iconScaleAnimator.setDuration(SCALE_AND_ALPHA_ANIM_DURATION); Loading @@ -365,14 +323,11 @@ public class PreloadIconDrawable extends FastBitmapDrawable { mInternalStateProgress = progress; if (progress <= 0) { if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) { mScaledTrackPath.reset(); } mIconScaleMultiplier.updateValue(0); } else { mPathMeasure.getSegment( 0, Math.min(progress, 1) * mTrackLength, mScaledProgressPath, true); if (progress > 1 && ENABLE_DOWNLOAD_APP_UX_V2.get()) { if (progress > 1) { // map the scale back to original value mIconScaleMultiplier.updateValue(Utilities.mapBoundToRange( progress - 1, 0, COMPLETE_ANIM_FRACTION, 1, 0, EMPHASIZED)); Loading