diff --git a/quickstep/res/layout/task_menu.xml b/quickstep/res/layout/task_menu.xml index 3a47e99517..a5c944540b 100644 --- a/quickstep/res/layout/task_menu.xml +++ b/quickstep/res/layout/task_menu.xml @@ -40,7 +40,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:divider="@drawable/all_apps_divider" android:showDividers="middle" /> \ No newline at end of file diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 1f86d62d31..6cc64e0aa7 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -25,6 +25,7 @@ 22dp 4dp + 2dp 48dp 16dp diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java index 2c6533c079..906e854127 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java @@ -26,6 +26,8 @@ import android.content.Context; import android.graphics.Outline; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.RectShape; import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; @@ -237,6 +239,8 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange PagedOrientationHandler orientationHandler = taskView.getPagedOrientationHandler(); measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); orientationHandler.setTaskMenuAroundTaskView(this, mTaskInsetMargin); + + // Get Position mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect); Rect insets = mActivity.getDragLayer().getInsets(); BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams(); @@ -248,8 +252,15 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange setLayoutParams(params); setScaleX(taskView.getScaleX()); setScaleY(taskView.getScaleY()); + + // Set divider spacing + ShapeDrawable divider = new ShapeDrawable(new RectShape()); + divider.getPaint().setColor(getResources().getColor(android.R.color.transparent)); + int dividerSpacing = (int) getResources().getDimension(R.dimen.task_menu_spacing); + mOptionLayout.setShowDividers(SHOW_DIVIDER_MIDDLE); + orientationHandler.setTaskOptionsMenuLayoutOrientation( - mActivity.getDeviceProfile(), mOptionLayout); + mActivity.getDeviceProfile(), mOptionLayout, dividerSpacing, divider); setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0); } diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 11c9649279..d047eca29e 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -29,6 +29,7 @@ import android.content.res.Resources; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; import android.view.MotionEvent; import android.view.Surface; @@ -269,8 +270,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile, - LinearLayout taskMenuLayout) { + LinearLayout taskMenuLayout, int dividerSpacing, + ShapeDrawable dividerDrawable) { taskMenuLayout.setOrientation(LinearLayout.HORIZONTAL); + dividerDrawable.setIntrinsicWidth(dividerSpacing); + taskMenuLayout.setDividerDrawable(dividerDrawable); } @Override diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index e0b89c7ffe..266e05fee1 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -22,6 +22,7 @@ import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -123,7 +124,8 @@ public interface PagedOrientationHandler { * inside task menu view. */ void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile, - LinearLayout taskMenuLayout); + LinearLayout taskMenuLayout, int dividerSpacing, + ShapeDrawable dividerDrawable); /** * Sets layout param attributes for {@link com.android.launcher3.popup.SystemShortcut} child * views inside task menu view. diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index dcbb7ca6e8..dd97af5d76 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; import android.view.MotionEvent; import android.view.Surface; @@ -274,14 +275,18 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile, - LinearLayout taskMenuLayout) { + LinearLayout taskMenuLayout, int dividerSpacing, + ShapeDrawable dividerDrawable) { if (deviceProfile.isLandscape && !deviceProfile.isTablet) { // Phone landscape taskMenuLayout.setOrientation(LinearLayout.HORIZONTAL); + dividerDrawable.setIntrinsicWidth(dividerSpacing); } else { // Phone Portrait, LargeScreen Landscape/Portrait taskMenuLayout.setOrientation(LinearLayout.VERTICAL); + dividerDrawable.setIntrinsicHeight(dividerSpacing); } + taskMenuLayout.setDividerDrawable(dividerDrawable); } @Override