From 9f921098d3f6352f131c89e1c218b1c8a8bf72c7 Mon Sep 17 00:00:00 2001 From: Zak Cohen Date: Wed, 10 Mar 2021 14:31:02 -0800 Subject: [PATCH] Make TaskMenuView corner radius follow TaskView. Also removes fake shadow from TaskMenuView as not required in new style. Bug: 182276195 Test: Run on 3a and 4 Change-Id: Iadf89e30e56d8d7419b1e6c9550bb1b2bf3d5c49 --- quickstep/res/drawable/task_menu_bg.xml | 26 +++---------------- .../android/quickstep/views/TaskMenuView.java | 18 +++++++++++-- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/quickstep/res/drawable/task_menu_bg.xml b/quickstep/res/drawable/task_menu_bg.xml index 7334d984f1..a60defc3bd 100644 --- a/quickstep/res/drawable/task_menu_bg.xml +++ b/quickstep/res/drawable/task_menu_bg.xml @@ -14,25 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - - - - - - - - - - - + + + + diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java index 2315147bdb..fe7ece216a 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java @@ -23,12 +23,14 @@ import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; +import android.graphics.Outline; import android.graphics.Rect; import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewOutlineProvider; import android.widget.LinearLayout; import android.widget.TextView; @@ -41,10 +43,10 @@ import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.util.Themes; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.TaskOverlayFactory; import com.android.quickstep.TaskUtils; +import com.android.quickstep.util.TaskCornerRadius; /** * Contains options for a recent task when long-pressing its icon. @@ -72,6 +74,7 @@ public class TaskMenuView extends AbstractFloatingView { mActivity = BaseDraggingActivity.fromContext(context); mThumbnailTopMargin = getResources().getDimension(R.dimen.task_thumbnail_top_margin); + setClipToOutline(true); } @Override @@ -108,6 +111,17 @@ public class TaskMenuView extends AbstractFloatingView { return (type & TYPE_TASK_MENU) != 0; } + @Override + public ViewOutlineProvider getOutlineProvider() { + return new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), + TaskCornerRadius.get(view.getContext())); + } + }; + } + public void setPosition(float x, float y, PagedOrientationHandler pagedOrientationHandler) { float adjustedY = y + mThumbnailTopMargin; // Changing pivot to make computations easier @@ -260,7 +274,7 @@ public class TaskMenuView extends AbstractFloatingView { } private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() { - float radius = Themes.getDialogCornerRadius(getContext()); + float radius = TaskCornerRadius.get(mContext); Rect fromRect = new Rect(0, 0, getWidth(), 0); Rect toRect = new Rect(0, 0, getWidth(), getHeight()); return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);