diff --git a/quickstep/res/drawable/ic_split_screen.xml b/quickstep/res/drawable/ic_split_screen.xml index 77bd3336d2..110af914c5 100644 --- a/quickstep/res/drawable/ic_split_screen.xml +++ b/quickstep/res/drawable/ic_split_screen.xml @@ -13,33 +13,16 @@ See the License for the specific language governing permissions and limitations under the License. --> - + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> - \ No newline at end of file + android:fillColor="@android:color/white" + android:pathData="M18,4v5H6V4H18 M18,2H6C4.9,2,4,2.9,4,4v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2L18,2z" /> + + diff --git a/quickstep/res/drawable/task_menu_bg.xml b/quickstep/res/drawable/task_menu_bg.xml new file mode 100644 index 0000000000..d5597a9dbe --- /dev/null +++ b/quickstep/res/drawable/task_menu_bg.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/quickstep/res/layout/task_menu.xml b/quickstep/res/layout/task_menu.xml index b8466652e5..bf55ece44b 100644 --- a/quickstep/res/layout/task_menu.xml +++ b/quickstep/res/layout/task_menu.xml @@ -16,21 +16,31 @@ --> - + android:visibility="invisible"> + + + + + \ No newline at end of file diff --git a/quickstep/res/layout/task_view_menu_option.xml b/quickstep/res/layout/task_view_menu_option.xml new file mode 100644 index 0000000000..102ae9bc23 --- /dev/null +++ b/quickstep/res/layout/task_view_menu_option.xml @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/quickstep/res/values-land/dimens.xml b/quickstep/res/values-land/dimens.xml new file mode 100644 index 0000000000..c03eaa2cf1 --- /dev/null +++ b/quickstep/res/values-land/dimens.xml @@ -0,0 +1,19 @@ + + + + 24dp + \ No newline at end of file diff --git a/quickstep/res/values-land/styles.xml b/quickstep/res/values-land/styles.xml new file mode 100644 index 0000000000..0824b4f555 --- /dev/null +++ b/quickstep/res/values-land/styles.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index ed18bf5e3a..acfc180ada 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -18,7 +18,6 @@ 24dp 48dp - 12dp 2dp 10dp 20dp @@ -41,6 +40,9 @@ 40dp + 8dp + 3dp + 0dp 136dp 200dp 100dp diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml new file mode 100644 index 0000000000..bb364ff6de --- /dev/null +++ b/quickstep/res/values/styles.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java index dd90c8867d..39f532320d 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java @@ -16,19 +16,19 @@ package com.android.quickstep.views; +import static com.android.quickstep.views.TaskThumbnailView.DIM_ALPHA; + import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; -import android.graphics.Outline; -import android.graphics.Point; +import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.MotionEvent; -import android.view.View; -import android.view.ViewOutlineProvider; -import android.view.animation.AccelerateDecelerateInterpolator; +import android.view.ViewGroup; +import android.widget.LinearLayout; import android.widget.TextView; import com.android.launcher3.AbstractFloatingView; @@ -37,8 +37,8 @@ import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; -import com.android.launcher3.shortcuts.DeepShortcutView; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.TaskSystemShortcut; import com.android.quickstep.TaskUtils; @@ -58,12 +58,14 @@ public class TaskMenuView extends AbstractFloatingView { new TaskSystemShortcut.Install(), }; - private static final long OPEN_CLOSE_DURATION = 220; + private static final int REVEAL_OPEN_DURATION = 150; + private static final int REVEAL_CLOSE_DURATION = 100; private BaseDraggingActivity mActivity; private TextView mTaskIconAndName; private AnimatorSet mOpenCloseAnimator; private TaskView mTaskView; + private LinearLayout mOptionLayout; public TaskMenuView(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -73,20 +75,13 @@ public class TaskMenuView extends AbstractFloatingView { super(context, attrs, defStyleAttr); mActivity = BaseDraggingActivity.fromContext(context); - setClipToOutline(true); - setOutlineProvider(new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - float r = getResources().getDimensionPixelSize(R.dimen.task_menu_background_radius); - outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), r); - } - }); } @Override protected void onFinishInflate() { super.onFinishInflate(); mTaskIconAndName = findViewById(R.id.task_icon_and_name); + mOptionLayout = findViewById(R.id.menu_option_layout); } @Override @@ -148,6 +143,12 @@ public class TaskMenuView extends AbstractFloatingView { mTaskIconAndName.setText(TaskUtils.getTitle(getContext(), taskView.getTask())); mTaskIconAndName.setOnClickListener(v -> close(true)); + // Move the icon and text up half an icon size to lay over the TaskView + LinearLayout.LayoutParams params = + (LinearLayout.LayoutParams) mTaskIconAndName.getLayoutParams(); + params.topMargin = (int) -getResources().getDimension(R.dimen.task_thumbnail_top_margin); + mTaskIconAndName.setLayoutParams(params); + for (TaskSystemShortcut menuOption : MENU_OPTIONS) { OnClickListener onClickListener = menuOption.getOnClickListener(mActivity, taskView); if (onClickListener != null) { @@ -157,21 +158,24 @@ public class TaskMenuView extends AbstractFloatingView { } private void addMenuOption(TaskSystemShortcut menuOption, OnClickListener onClickListener) { - DeepShortcutView menuOptionView = (DeepShortcutView) mActivity.getLayoutInflater().inflate( - R.layout.system_shortcut, this, false); - menuOptionView.getIconView().setBackgroundResource(menuOption.iconResId); - menuOptionView.getBubbleText().setText(menuOption.labelResId); + ViewGroup menuOptionView = (ViewGroup) mActivity.getLayoutInflater().inflate( + R.layout.task_view_menu_option, this, false); + menuOptionView.findViewById(R.id.icon).setBackgroundResource(menuOption.iconResId); + ((TextView) menuOptionView.findViewById(R.id.text)).setText(menuOption.labelResId); menuOptionView.setOnClickListener(onClickListener); - addView(menuOptionView); + mOptionLayout.addView(menuOptionView); } private void orientAroundTaskView(TaskView taskView) { measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect); Rect insets = mActivity.getDragLayer().getInsets(); - int x = sTempRect.left + (sTempRect.width() - getMeasuredWidth()) / 2 - insets.left; - setX(Utilities.isRtl(getResources()) ? -x : x); - setY(sTempRect.top - mTaskIconAndName.getPaddingTop() - insets.top); + BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams(); + params.width = sTempRect.width(); + setLayoutParams(params); + setX(Utilities.isRtl(getResources()) ? -sTempRect.left : sTempRect.left); + setY(sTempRect.top + getResources().getDimension(R.dimen.task_thumbnail_top_margin) + - insets.top); } private void animateOpen() { @@ -188,8 +192,13 @@ public class TaskMenuView extends AbstractFloatingView { return; } mOpenCloseAnimator = LauncherAnimUtils.createAnimatorSet(); - mOpenCloseAnimator.play(createOpenCloseOutlineProvider() - .createRevealAnimator(this, closing)); + + final Animator revealAnimator = createOpenCloseOutlineProvider() + .createRevealAnimator(this, closing); + revealAnimator.setInterpolator(Interpolators.DEACCEL); + mOpenCloseAnimator.play(revealAnimator); + mOpenCloseAnimator.play(ObjectAnimator.ofFloat(mTaskView.getThumbnail(), DIM_ALPHA, + closing ? 0 : TaskView.MAX_PAGE_SCRIM_ALPHA)); mOpenCloseAnimator.addListener(new AnimationSuccessListener() { @Override public void onAnimationStart(Animator animation) { @@ -204,8 +213,7 @@ public class TaskMenuView extends AbstractFloatingView { } }); mOpenCloseAnimator.play(ObjectAnimator.ofFloat(this, ALPHA, closing ? 0 : 1)); - mOpenCloseAnimator.setDuration(OPEN_CLOSE_DURATION); - mOpenCloseAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); + mOpenCloseAnimator.setDuration(closing ? REVEAL_CLOSE_DURATION: REVEAL_OPEN_DURATION); mOpenCloseAnimator.start(); } @@ -215,18 +223,9 @@ public class TaskMenuView extends AbstractFloatingView { } private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() { - int iconSize = getResources().getDimensionPixelSize(R.dimen.task_thumbnail_icon_size); - float fromRadius = iconSize / 2; - float toRadius = getResources().getDimensionPixelSize( - R.dimen.task_menu_background_radius); - Point iconCenter = new Point(getWidth() / 2, mTaskIconAndName.getPaddingTop() + iconSize / 2); - Rect fromRect = new Rect(iconCenter.x, iconCenter.y, iconCenter.x, iconCenter.y); + float radius = getResources().getDimension(R.dimen.task_corner_radius); + Rect fromRect = new Rect(0, 0, getWidth(), 0); Rect toRect = new Rect(0, 0, getWidth(), getHeight()); - return new RoundedRectRevealOutlineProvider(fromRadius, toRadius, fromRect, toRect) { - @Override - public boolean shouldRemoveElevationDuringAnimation() { - return true; - } - }; + return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect); } } diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java index d9dfd1815d..07f22aada4 100644 --- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java @@ -29,7 +29,6 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Shader; -import android.support.v4.graphics.ColorUtils; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Property; @@ -68,6 +67,19 @@ public class TaskThumbnailView extends View { } }; + public static final Property DIM_ALPHA = + new FloatProperty("dimAlpha") { + @Override + public void setValue(TaskThumbnailView thumbnail, float dimAlpha) { + thumbnail.setDimAlpha(dimAlpha); + } + + @Override + public Float get(TaskThumbnailView thumbnailView) { + return thumbnailView.mDimAlpha; + } + }; + private final float mCornerRadius; private final BaseActivity mActivity; diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index a7690e1e38..468efd8f92 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -71,7 +71,7 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback * The alpha of a black scrim on a page in the carousel as it leaves the screen. * In the resting position of the carousel, the adjacent pages have about half this scrim. */ - private static final float MAX_PAGE_SCRIM_ALPHA = 0.4f; + public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f; /** * How much to scale down pages near the edge of the screen. diff --git a/res/drawable/ic_info_no_shadow.xml b/res/drawable/ic_info_no_shadow.xml index b5512c3132..d816f12b7e 100644 --- a/res/drawable/ic_info_no_shadow.xml +++ b/res/drawable/ic_info_no_shadow.xml @@ -16,12 +16,17 @@ + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?android:attr/textColorPrimary"> + + android:fillColor="#FFFFFF" + android:pathData="M 11 7 H 13 V 9 H 11 V 7 Z" /> + +