mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
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:
@@ -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