Change TaskIconMenu to lay out vertically
Still lays out horizontally when in phone landscape. TODO(b/186583656), need to center view. Also have all layout be dynamic instead of having some cases be in XML and some in code. Bug: 181704764 Test: Task menu visible with all options in portrait/landscape tablet portrait phone fake/real landscape phone Change-Id: I3632eeb174f3e4baf2c9d69d51c1815c3c512e59
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
-->
|
||||
<com.android.quickstep.views.TaskMenuView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:background="@drawable/task_menu_bg"
|
||||
@@ -35,12 +35,10 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_option_layout"
|
||||
style="@style/TaskMenu"
|
||||
android:divider="@drawable/all_apps_divider"
|
||||
android:showDividers="beginning"
|
||||
android:paddingStart="@dimen/task_card_menu_horizontal_padding"
|
||||
android:paddingEnd="@dimen/task_card_menu_horizontal_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/all_apps_divider"
|
||||
android:showDividers="beginning" />
|
||||
|
||||
</com.android.quickstep.views.TaskMenuView>
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/TaskMenu.Option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||
@@ -29,22 +28,19 @@
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/system_shortcut_icon_size"
|
||||
android:layout_height="@dimen/system_shortcut_icon_size"
|
||||
android:layout_marginTop="@dimen/system_shortcut_header_icon_padding"
|
||||
android:layout_marginBottom="@dimen/deep_shortcut_drawable_padding"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:backgroundTint="?android:attr/textColorTertiary"/>
|
||||
|
||||
<TextView
|
||||
style="@style/BaseIcon"
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/popup_padding_end"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -15,7 +15,5 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="task_card_menu_horizontal_padding">24dp</dimen>
|
||||
|
||||
<dimen name="overview_task_margin">8dp</dimen>
|
||||
</resources>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task Menu layout styles. -->
|
||||
<style name="TaskMenu">
|
||||
<item name="android:orientation">horizontal</item>
|
||||
</style>
|
||||
|
||||
<!-- Task Menu Option layout styles. -->
|
||||
<style name="TaskMenu.Option">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -67,7 +67,7 @@
|
||||
in various configurations -->
|
||||
<dimen name="task_card_menu_option_vertical_padding">8dp</dimen>
|
||||
<dimen name="task_card_menu_shadow_height">3dp</dimen>
|
||||
<dimen name="task_card_menu_horizontal_padding">0dp</dimen>
|
||||
<dimen name="task_menu_option_start_margin">12dp</dimen>
|
||||
<!-- Copied from framework resource:
|
||||
docked_stack_divider_thickness - 2 * docked_stack_divider_insets -->
|
||||
<dimen name="multi_window_task_divider_size">10dp</dimen>
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task Menu layout styles. -->
|
||||
<style name="TaskMenu">
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<!-- Task Menu Option layout styles. -->
|
||||
<style name="TaskMenu.Option">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.GestureTutorial"
|
||||
parent="android:TextAppearance.Material.Body1" />
|
||||
|
||||
@@ -201,12 +201,13 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
||||
}
|
||||
|
||||
private void addMenuOption(SystemShortcut menuOption) {
|
||||
ViewGroup menuOptionView = (ViewGroup) mActivity.getLayoutInflater().inflate(
|
||||
LinearLayout menuOptionView = (LinearLayout) mActivity.getLayoutInflater().inflate(
|
||||
R.layout.task_view_menu_option, this, false);
|
||||
menuOption.setIconAndLabelFor(
|
||||
menuOptionView.findViewById(R.id.icon), menuOptionView.findViewById(R.id.text));
|
||||
LayoutParams lp = (LayoutParams) menuOptionView.getLayoutParams();
|
||||
mTaskView.getPagedOrientationHandler().setLayoutParamsForTaskMenuOptionItem(lp);
|
||||
mTaskView.getPagedOrientationHandler().setLayoutParamsForTaskMenuOptionItem(lp,
|
||||
menuOptionView, mActivity.getDeviceProfile());
|
||||
menuOptionView.setEnabled(menuOption.isEnabled());
|
||||
menuOptionView.setAlpha(menuOption.isEnabled() ? 1 : 0.5f);
|
||||
menuOptionView.setOnClickListener(view -> {
|
||||
@@ -228,16 +229,15 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
||||
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());
|
||||
// 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());
|
||||
boolean canActivityRotate = taskView.getRecentsView()
|
||||
.mOrientationState.isRecentsActivityRotationAllowed();
|
||||
mOptionLayout.setOrientation(orientationHandler
|
||||
.getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
|
||||
orientationHandler.setTaskMenuLayoutOrientation(
|
||||
mActivity.getDeviceProfile(), mOptionLayout);
|
||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user