summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-11-05 11:08:31 -0800
committerSunny Goyal <sunnygoyal@google.com>2018-11-06 09:59:03 -0800
commit066ace1b8897229445c0fb3515156ef70bdb05e2 (patch)
tree62dd45b95ed2bd2357368c1fd2c82a31da328ffd /src/com/android/launcher3/folder
parent5bd44153fdc76a4ea96ede8aa6646f7f067bb0d5 (diff)
downloadpackages_apps_Trebuchet-066ace1b8897229445c0fb3515156ef70bdb05e2.tar.gz
packages_apps_Trebuchet-066ace1b8897229445c0fb3515156ef70bdb05e2.tar.bz2
packages_apps_Trebuchet-066ace1b8897229445c0fb3515156ef70bdb05e2.zip
Replacing setAlphaComponent with setAlphaComponentBound for better animation interpolation
setAlphaComponent throws expetion for invalid range, which can cause brashes in overshoot interpolation Bug: 118390004 Change-Id: Ic9c5ff3d660eba353b982c4c47ccfaf329b3e296
Diffstat (limited to 'src/com/android/launcher3/folder')
-rw-r--r--src/com/android/launcher3/folder/FolderAnimationManager.java7
-rw-r--r--src/com/android/launcher3/folder/PreviewBackground.java7
2 files changed, 6 insertions, 8 deletions
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index fa890b99d..2461e284d 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -20,6 +20,7 @@ import static com.android.launcher3.BubbleTextView.TEXT_ALPHA_PROPERTY;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.folder.FolderShape.getShape;
+import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -46,8 +47,6 @@ import com.android.launcher3.util.Themes;
import java.util.List;
-import androidx.core.graphics.ColorUtils;
-
/**
* Manages the opening and closing animations for a {@link Folder}.
*
@@ -153,8 +152,8 @@ public class FolderAnimationManager {
// Set up the Folder background.
final int finalColor = Themes.getAttrColor(mContext, android.R.attr.colorPrimary);
- final int initialColor =
- ColorUtils.setAlphaComponent(finalColor, mPreviewBackground.getBackgroundAlpha());
+ final int initialColor = setColorAlphaBound(
+ finalColor, mPreviewBackground.getBackgroundAlpha());
mFolderBackground.mutate();
mFolderBackground.setColor(mIsOpening ? initialColor : finalColor);
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index 8443953bd..f2683a5f9 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -17,6 +17,7 @@
package com.android.launcher3.folder;
import static com.android.launcher3.folder.FolderShape.getShape;
+import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -41,8 +42,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.util.Themes;
-import androidx.core.graphics.ColorUtils;
-
/**
* This object represents a FolderIcon preview background. It stores drawing / measurement
* information, handles drawing, and animation (accept state <--> rest state).
@@ -189,7 +188,7 @@ public class PreviewBackground {
public int getBgColor() {
int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
- return ColorUtils.setAlphaComponent(mBgColor, alpha);
+ return setColorAlphaBound(mBgColor, alpha);
}
public int getBadgeColor() {
@@ -275,7 +274,7 @@ public class PreviewBackground {
}
public void drawBackgroundStroke(Canvas canvas) {
- mPaint.setColor(ColorUtils.setAlphaComponent(mBgColor, mStrokeAlpha));
+ mPaint.setColor(setColorAlphaBound(mBgColor, mStrokeAlpha));
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);