TaskMenu in overview UI polish
Bug: 188168717 Test: TaskMenuLooks closer to mocks. Change-Id: I1560b66a48c4c70c7c79f7307b2b76f22e30c653
This commit is contained in:
parent
81f5ff3b3b
commit
063cb2d892
|
@ -16,5 +16,6 @@
|
|||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="?attr/popupColorPrimary" />
|
||||
<solid android:color="@android:color/transparent"/>
|
||||
<corners android:radius="@dimen/task_menu_corner_radius"/>
|
||||
</shape>
|
||||
|
|
|
@ -20,18 +20,20 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:background="@drawable/task_menu_bg"
|
||||
android:paddingBottom="@dimen/task_card_menu_shadow_height"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:background="?android:attr/textColorPrimary"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textSize="12sp"/>
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:textSize="24sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_option_layout"
|
||||
|
@ -39,6 +41,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/all_apps_divider"
|
||||
android:showDividers="beginning" />
|
||||
android:showDividers="middle" />
|
||||
|
||||
</com.android.quickstep.views.TaskMenuView>
|
|
@ -21,7 +21,7 @@
|
|||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:background="?android:attr/textColorPrimary"
|
||||
android:theme="@style/PopupItem" >
|
||||
|
||||
<View
|
||||
|
@ -30,7 +30,7 @@
|
|||
android:layout_height="@dimen/system_shortcut_icon_size"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:backgroundTint="?android:attr/textColorTertiary"/>
|
||||
android:backgroundTint="?android:attr/textColorPrimaryInverse"/>
|
||||
|
||||
<TextView
|
||||
style="@style/BaseIcon"
|
||||
|
@ -38,9 +38,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<!-- For Launchers that want to override the default dialog corner radius -->
|
||||
<dimen name="task_corner_radius_override">-1dp</dimen>
|
||||
|
||||
<!-- Task Menu View -->
|
||||
<dimen name="task_menu_corner_radius">22dp</dimen>
|
||||
<dimen name="overview_proactive_row_height">48dp</dimen>
|
||||
<dimen name="overview_proactive_row_bottom_margin">16dp</dimen>
|
||||
|
||||
|
@ -73,6 +75,7 @@
|
|||
<!-- Total space (start + end) between the task card and the edge of the screen
|
||||
in various configurations -->
|
||||
<dimen name="task_card_menu_option_vertical_padding">8dp</dimen>
|
||||
<dimen name="task_card_margin">8dp</dimen>
|
||||
<dimen name="task_card_menu_shadow_height">3dp</dimen>
|
||||
<dimen name="task_menu_option_start_margin">12dp</dimen>
|
||||
<!-- Copied from framework resource:
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.animation.AnimatorSet;
|
|||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
@ -195,7 +196,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
private void addMenuOptions(TaskView taskView) {
|
||||
mTaskName.setText(TaskUtils.getTitle(getContext(), taskView.getTask()));
|
||||
mTaskName.setOnClickListener(v -> close(true));
|
||||
|
||||
|
||||
TaskOverlayFactory.getEnabledShortcuts(taskView, mActivity.getDeviceProfile())
|
||||
.forEach(this::addMenuOption);
|
||||
}
|
||||
|
@ -227,18 +228,24 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
|||
private void orientAroundTaskView(TaskView taskView) {
|
||||
PagedOrientationHandler orientationHandler = taskView.getPagedOrientationHandler();
|
||||
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||
float taskInsetMargin = getResources().getDimension(R.dimen.task_card_margin);
|
||||
orientationHandler.setTaskMenuAroundTaskView(this, taskInsetMargin);
|
||||
mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect);
|
||||
Rect insets = mActivity.getDragLayer().getInsets();
|
||||
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
|
||||
// TODO(b/186583656) Move the entire menu to the center/make smaller than thumbnail width
|
||||
params.width = orientationHandler.getTaskMenuWidth(taskView.getThumbnail());
|
||||
int padding = getResources()
|
||||
.getDimensionPixelSize(R.dimen.task_card_menu_option_vertical_padding);
|
||||
params.width = orientationHandler.getTaskMenuWidth(taskView.getThumbnail()) - (2 * padding);
|
||||
// Gravity set to Left instead of Start as sTempRect.left measures Left distance not Start
|
||||
params.gravity = Gravity.LEFT;
|
||||
setLayoutParams(params);
|
||||
setScaleX(taskView.getScaleX());
|
||||
setScaleY(taskView.getScaleY());
|
||||
orientationHandler.setTaskMenuLayoutOrientation(
|
||||
orientationHandler.setTaskOptionsMenuLayoutOrientation(
|
||||
mActivity.getDeviceProfile(), mOptionLayout);
|
||||
PointF additionalInset = orientationHandler.getAdditionalInsetForTaskMenu(taskInsetMargin);
|
||||
insets.left += additionalInset.x;
|
||||
insets.top += additionalInset.y;
|
||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="?android:attr/colorControlHighlight" />
|
||||
<size android:height="1dp" />
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<size android:height="2dp" />
|
||||
</shape>
|
|
@ -41,6 +41,7 @@ import com.android.launcher3.DeviceProfile;
|
|||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -267,7 +268,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTaskMenuLayoutOrientation(DeviceProfile deviceProfile,
|
||||
public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile,
|
||||
LinearLayout taskMenuLayout) {
|
||||
taskMenuLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
}
|
||||
|
@ -284,6 +285,17 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||
Utilities.setStartMarginForView(viewGroup.findViewById(R.id.icon), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskMenuAroundTaskView(LinearLayout taskView, float margin) {
|
||||
BaseDragLayer.LayoutParams lp = (BaseDragLayer.LayoutParams) taskView.getLayoutParams();
|
||||
lp.topMargin += margin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF getAdditionalInsetForTaskMenu(float margin) {
|
||||
return new PointF(margin, 0);
|
||||
}
|
||||
|
||||
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,16 +109,37 @@ public interface PagedOrientationHandler {
|
|||
float getSecondaryValue(float x, float y);
|
||||
|
||||
boolean isLayoutNaturalToLauncher();
|
||||
FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile deviceProfile);
|
||||
int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect);
|
||||
List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp);
|
||||
|
||||
// Overview TaskMenuView methods
|
||||
float getTaskMenuX(float x, View thumbnailView, int overScroll);
|
||||
float getTaskMenuY(float y, View thumbnailView, int overScroll);
|
||||
int getTaskMenuWidth(View view);
|
||||
void setTaskMenuLayoutOrientation(DeviceProfile deviceProfile, LinearLayout taskMenuLayout);
|
||||
/**
|
||||
* Sets linear layout orientation for {@link com.android.launcher3.popup.SystemShortcut} items
|
||||
* inside task menu view.
|
||||
*/
|
||||
void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile,
|
||||
LinearLayout taskMenuLayout);
|
||||
/**
|
||||
* Sets layout param attributes for {@link com.android.launcher3.popup.SystemShortcut} child
|
||||
* views inside task menu view.
|
||||
*/
|
||||
void setLayoutParamsForTaskMenuOptionItem(LinearLayout.LayoutParams lp,
|
||||
LinearLayout viewGroup, DeviceProfile deviceProfile);
|
||||
int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect);
|
||||
List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp);
|
||||
FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile deviceProfile);
|
||||
/**
|
||||
* Adjusts margins for the entire task menu view itself, which comprises of both app title and
|
||||
* shortcut options.
|
||||
*/
|
||||
void setTaskMenuAroundTaskView(LinearLayout taskView, float margin);
|
||||
/**
|
||||
* Since the task menu layout is manually positioned on top of recents view, this method returns
|
||||
* additional adjustments to the positioning based on fake land/seascape
|
||||
*/
|
||||
PointF getAdditionalInsetForTaskMenu(float margin);
|
||||
|
||||
// The following are only used by TaskViewTouchHandler.
|
||||
/** @return Either VERTICAL or HORIZONTAL. */
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.android.launcher3.DeviceProfile;
|
|||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -272,7 +273,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTaskMenuLayoutOrientation(DeviceProfile deviceProfile,
|
||||
public void setTaskOptionsMenuLayoutOrientation(DeviceProfile deviceProfile,
|
||||
LinearLayout taskMenuLayout) {
|
||||
if (deviceProfile.isLandscape && !deviceProfile.isTablet) {
|
||||
// Phone landscape
|
||||
|
@ -302,6 +303,18 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||
lp.height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskMenuAroundTaskView(LinearLayout taskView, float margin) {
|
||||
BaseDragLayer.LayoutParams lp = (BaseDragLayer.LayoutParams) taskView.getLayoutParams();
|
||||
lp.topMargin += margin;
|
||||
lp.leftMargin += margin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF getAdditionalInsetForTaskMenu(float margin) {
|
||||
return new PointF(0, 0);
|
||||
}
|
||||
|
||||
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,11 +26,13 @@ import android.graphics.PointF;
|
|||
import android.graphics.Rect;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -88,6 +90,17 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
|||
return y + thumbnailView.getMeasuredHeight() + overScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskMenuAroundTaskView(LinearLayout taskView, float margin) {
|
||||
BaseDragLayer.LayoutParams lp = (BaseDragLayer.LayoutParams) taskView.getLayoutParams();
|
||||
lp.bottomMargin += margin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF getAdditionalInsetForTaskMenu(float margin) {
|
||||
return new PointF(-margin, margin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect) {
|
||||
return dp.widthPx - rect.right;
|
||||
|
|
Loading…
Reference in New Issue