Merge deep shortcuts in rounded rect
- DeepShortcutViews are added to ShortcutsItemView, which is in PopupContainerWithArrow - Moved some shortcut-specific logic to ShortcutsItemView (namely, touch/long-click handling for draggin shortcuts) - Moved round-rect clipping to PopupItemView - Removed collapseToIcon() logic, including PillWidthRevealOutlineProvider, which was only used for that purpose. It isn't necessary now that the deep shortcuts have no background themselves. - Replaced focus pill drawable with ripple effect on shortcuts and notification view. Bug: 35766387 Change-Id: I6bc09f1851cfbb806df4bf75a6e435b0f1900c9c
This commit is contained in:
1 parent
7f3526a1a4
commit
51889b0be8
17 files changed
+363
-288
No files matched your search
@@ -20,14 +20,7 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -36,11 +29,11 @@ import android.widget.FrameLayout;
|
||||
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.PillHeightRevealOutlineProvider;
|
||||
import com.android.launcher3.graphics.IconPalette;
|
||||
import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider;
|
||||
import com.android.launcher3.popup.PopupItemView;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
import com.android.launcher3.anim.PillHeightRevealOutlineProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,9 +47,6 @@ public class NotificationItemView extends PopupItemView implements LogContainerP
|
||||
|
||||
private static final Rect sTempRect = new Rect();
|
||||
|
||||
private final Paint mBackgroundClipPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG |
|
||||
Paint.FILTER_BITMAP_FLAG);
|
||||
|
||||
private View mDivider;
|
||||
private NotificationMainView mMainView;
|
||||
private NotificationFooterLayout mFooter;
|
||||
@@ -85,35 +75,6 @@ public class NotificationItemView extends PopupItemView implements LogContainerP
|
||||
mSwipeHelper.setDisableHardwareLayers(true);
|
||||
}
|
||||
|
||||
private void initializeBackgroundClipping(boolean force) {
|
||||
if (force || mBackgroundClipPaint.getShader() == null) {
|
||||
mBackgroundClipPaint.setXfermode(null);
|
||||
mBackgroundClipPaint.setShader(null);
|
||||
Bitmap backgroundBitmap = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
|
||||
Bitmap.Config.ALPHA_8);
|
||||
Canvas canvas = new Canvas();
|
||||
canvas.setBitmap(backgroundBitmap);
|
||||
float roundRectRadius = getResources().getDimensionPixelSize(
|
||||
R.dimen.bg_round_rect_radius);
|
||||
canvas.drawRoundRect(0, 0, getMeasuredWidth(), getMeasuredHeight(),
|
||||
roundRectRadius, roundRectRadius, mBackgroundClipPaint);
|
||||
Shader backgroundClipShader = new BitmapShader(backgroundBitmap,
|
||||
Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
mBackgroundClipPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
|
||||
mBackgroundClipPaint.setShader(backgroundClipShader);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
initializeBackgroundClipping(false /* force */);
|
||||
int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null,
|
||||
Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
|
||||
super.dispatchDraw(canvas);
|
||||
canvas.drawPaint(mBackgroundClipPaint);
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
|
||||
public Animator animateHeightRemoval(int heightToRemove) {
|
||||
final int newHeight = getHeight() - heightToRemove;
|
||||
Animator heightAnimator = new PillHeightRevealOutlineProvider(mPillRect,
|
||||
@@ -134,11 +95,6 @@ public class NotificationItemView extends PopupItemView implements LogContainerP
|
||||
return heightAnimator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBackgroundRadius() {
|
||||
return getResources().getDimensionPixelSize(R.dimen.bg_round_rect_radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (mMainView.getNotificationInfo() == null) {
|
||||
|
||||
Reference in new issue
Block a user