From 2aec9c42f52c9ca1a075220205a7721d2f864a2b Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Fri, 5 Apr 2019 16:22:55 -0700 Subject: [PATCH] Change task view / all apps/ widgets / folder radius to dialogCornerRadius Bug: 123985787 Change-Id: Iaa8088beb51d37dba90d57ad065f9eac0dd46270 --- .../quickstep/util/ClipAnimationHelper.java | 5 ++-- .../android/quickstep/views/TaskMenuView.java | 3 ++- .../quickstep/views/TaskThumbnailView.java | 2 +- .../com/android/quickstep/views/TaskView.java | 7 ++--- quickstep/res/drawable/bg_wellbeing_toast.xml | 2 +- quickstep/res/drawable/task_menu_bg.xml | 4 +-- quickstep/res/values/dimens.xml | 5 +--- .../quickstep/views/ShelfScrimView.java | 5 +++- res/drawable-v28/round_rect_primary.xml | 21 +++++++++++++++ res/drawable-v28/top_round_rect_primary.xml | 26 +++++++++++++++++++ res/values/dimens.xml | 4 +++ .../android/launcher3/popup/ArrowPopup.java | 3 +-- src/com/android/launcher3/util/Themes.java | 5 ++-- 13 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 res/drawable-v28/round_rect_primary.xml create mode 100644 res/drawable-v28/top_round_rect_primary.xml diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java index 8ab2eb1b78..cbac944aaf 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -35,6 +35,7 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.util.Themes; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.RecentsModel; import com.android.quickstep.views.RecentsView; @@ -101,9 +102,7 @@ public class ClipAnimationHelper { public ClipAnimationHelper(Context context) { mWindowCornerRadius = getWindowCornerRadius(context.getResources()); mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources()); - int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ? - R.dimen.task_corner_radius : R.dimen.task_corner_radius_small; - mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes); + mTaskCornerRadius = Themes.getDialogCornerRadius(context); } private void updateSourceStack(RemoteAnimationTargetCompat target) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java index d15a392635..c47e943bee 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java @@ -40,6 +40,7 @@ import com.android.launcher3.R; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; +import com.android.launcher3.util.Themes; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.TaskSystemShortcut; import com.android.quickstep.TaskUtils; @@ -270,7 +271,7 @@ public class TaskMenuView extends AbstractFloatingView { } private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() { - float radius = getResources().getDimension(R.dimen.task_corner_radius); + float radius = Themes.getDialogCornerRadius(getContext()); Rect fromRect = new Rect(0, 0, getWidth(), 0); Rect toRect = new Rect(0, 0, getWidth(), getHeight()); return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java index 10533ac3a5..7905230223 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java @@ -108,7 +108,7 @@ public class TaskThumbnailView extends View { public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - mCornerRadius = getResources().getDimension(R.dimen.task_corner_radius); + mCornerRadius = Themes.getDialogCornerRadius(context); mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this); mPaint.setFilterBitmap(true); mBackgroundPaint.setColor(Color.WHITE); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index bea705f810..ec0112d522 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -52,6 +52,7 @@ import com.android.launcher3.anim.Interpolators; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.PendingAnimation; +import com.android.launcher3.util.Themes; import com.android.launcher3.util.ViewPool.Reusable; import com.android.quickstep.RecentsModel; import com.android.quickstep.TaskIconCache; @@ -196,7 +197,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { fromContext(context).getStatsLogManager().logTaskLaunch(getRecentsView(), TaskUtils.getLaunchComponentKeyForTask(getTask().key)); }); - setOutlineProvider(new TaskOutlineProvider(getResources())); + setOutlineProvider(new TaskOutlineProvider(context, getResources())); } @Override @@ -514,9 +515,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private final int mMarginTop; private final float mRadius; - TaskOutlineProvider(Resources res) { + TaskOutlineProvider(Context context, Resources res) { mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin); - mRadius = res.getDimension(R.dimen.task_corner_radius); + mRadius = Themes.getDialogCornerRadius(context); } @Override diff --git a/quickstep/res/drawable/bg_wellbeing_toast.xml b/quickstep/res/drawable/bg_wellbeing_toast.xml index 22d6f8aa77..65730f6cc7 100644 --- a/quickstep/res/drawable/bg_wellbeing_toast.xml +++ b/quickstep/res/drawable/bg_wellbeing_toast.xml @@ -15,5 +15,5 @@ --> - + \ No newline at end of file diff --git a/quickstep/res/drawable/task_menu_bg.xml b/quickstep/res/drawable/task_menu_bg.xml index d5597a9dbe..7334d984f1 100644 --- a/quickstep/res/drawable/task_menu_bg.xml +++ b/quickstep/res/drawable/task_menu_bg.xml @@ -28,8 +28,8 @@ diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 97f2de7622..6cbadda382 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -19,9 +19,7 @@ 24dp 12dp 48dp - 8dp - - 2dp + 10dp 70dp 32dp @@ -61,7 +59,6 @@ docked_stack_divider_thickness - 2 * docked_stack_divider_insets --> 10dp - 16dp 24dp diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index d74e880a21..36521e5cc9 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -53,6 +53,9 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis // cover the whole screen private static final float SCRIM_CATCHUP_THRESHOLD = 0.2f; + // Temporarily needed until android.R.attr.bottomDialogCornerRadius becomes public + private static final float BOTTOM_CORNER_RADIUS_RATIO = 2f; + // In transposed layout, we simply draw a flat color. private boolean mDrawingFlatColor; @@ -87,7 +90,7 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255); mEndAlpha = Color.alpha(mEndScrim); - mRadius = mLauncher.getResources().getDimension(R.dimen.shelf_surface_radius); + mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mShelfOffset = context.getResources().getDimension(R.dimen.shelf_surface_offset); diff --git a/res/drawable-v28/round_rect_primary.xml b/res/drawable-v28/round_rect_primary.xml new file mode 100644 index 0000000000..53679ed1b1 --- /dev/null +++ b/res/drawable-v28/round_rect_primary.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/res/drawable-v28/top_round_rect_primary.xml b/res/drawable-v28/top_round_rect_primary.xml new file mode 100644 index 0000000000..5c40df76d4 --- /dev/null +++ b/res/drawable-v28/top_round_rect_primary.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 7804133bb4..469b176fb4 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -235,4 +235,8 @@ 26dp 194dp + + + 8dp + diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java index a229207d36..28000b977b 100644 --- a/src/com/android/launcher3/popup/ArrowPopup.java +++ b/src/com/android/launcher3/popup/ArrowPopup.java @@ -82,8 +82,7 @@ public abstract class ArrowPopup extends AbstractFloatingView { public ArrowPopup(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mInflater = LayoutInflater.from(context); - mOutlineRadius = Themes.getDialogCornerRadius(context, - getResources().getDimension(R.dimen.bg_round_rect_radius)); + mOutlineRadius = Themes.getDialogCornerRadius(context); mLauncher = Launcher.getLauncher(context); mIsRtl = Utilities.isRtl(getResources()); diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java index 17b7e8d673..59fd8595e0 100644 --- a/src/com/android/launcher3/util/Themes.java +++ b/src/com/android/launcher3/util/Themes.java @@ -32,8 +32,9 @@ import com.android.launcher3.R; */ public class Themes { - public static float getDialogCornerRadius(Context context, float defaultValue) { - return getDimension(context, android.R.attr.dialogCornerRadius, defaultValue); + public static float getDialogCornerRadius(Context context) { + return getDimension(context, android.R.attr.dialogCornerRadius, + context.getResources().getDimension(R.dimen.default_dialog_corner_radius)); } public static float getDimension(Context context, int attr, float defaultValue) {