Removing click-feedback shadow generation logic in BubbleTextView

Instead of animating the shadow, animating the icon scale. This avoids
unnecessary bitmap creating at app-launch and also plays nice with the
app-launch transition

Change-Id: I1d3d24bc7212a6d659855ff1002a45388e269e52
This commit is contained in:
Sunny Goyal
2018-03-05 12:54:24 -08:00
parent 85f1eed52d
commit 726bee7d5d
13 changed files with 68 additions and 522 deletions

View File

@@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -45,7 +46,6 @@ import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import com.android.launcher3.BubbleTextView.BubbleTextShadowHandler;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate;
import com.android.launcher3.accessibility.FolderAccessibilityHelper;
@@ -70,7 +70,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Stack;
public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
public class CellLayout extends ViewGroup {
public static final int WORKSPACE_ACCESSIBILITY_DRAG = 2;
public static final int FOLDER_ACCESSIBILITY_DRAG = 1;
@@ -128,8 +128,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
private int mDragOutlineCurrent = 0;
private final Paint mDragOutlinePaint = new Paint();
private final ClickShadowView mTouchFeedbackView;
@Thunk final ArrayMap<LayoutParams, Animator> mReorderAnimators = new ArrayMap<>();
@Thunk final ArrayMap<View, ReorderPreviewAnimation> mShakeAnimators = new ArrayMap<>();
@@ -285,9 +283,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mCountX, mCountY);
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
mTouchFeedbackView = new ClickShadowView(context);
addView(mTouchFeedbackView);
addView(mShortcutsAndWidgets);
}
@@ -384,11 +379,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
return mDropPending;
}
@Override
public void setPressedIcon(BubbleTextView icon, Bitmap background) {
mTouchFeedbackView.setPressedIcon(icon, background);
}
void setIsDragOverlapping(boolean isDragOverlapping) {
if (mIsDragOverlapping != isDragOverlapping) {
mIsDragOverlapping = isDragOverlapping;
@@ -785,13 +775,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
// Make the feedback view large enough to hold the blur bitmap.
mTouchFeedbackView.measure(
MeasureSpec.makeMeasureSpec(mCellWidth + mTouchFeedbackView.getExtraSize(),
MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mCellHeight + mTouchFeedbackView.getExtraSize(),
MeasureSpec.EXACTLY));
mShortcutsAndWidgets.measure(
MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY));
@@ -815,11 +798,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
int top = getPaddingTop();
int bottom = b - t - getPaddingBottom();
mTouchFeedbackView.layout(left, top,
left + mTouchFeedbackView.getMeasuredWidth(),
top + mTouchFeedbackView.getMeasuredHeight());
mShortcutsAndWidgets.layout(left, top, right, bottom);
// Expand the background drawing bounds by the padding baked into the background drawable
mBackground.getPadding(mTempRect);
mBackground.setBounds(
@@ -1012,6 +991,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
}
}
@SuppressLint("StringFormatMatches")
public String getItemMoveDescription(int cellX, int cellY) {
if (mContainerType == HOTSEAT) {
return getContext().getString(R.string.move_to_hotseat_position,