mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Merge "Open taskMenu based on TaskIdAttributeContainer" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
988a87526e
@@ -76,7 +76,7 @@ public class GroupedTaskView extends TaskView {
|
||||
mSecondaryTask = secondary;
|
||||
mTaskIdContainer[1] = secondary.key.id;
|
||||
mTaskIdAttributeContainer[1] = new TaskIdAttributeContainer(secondary, mSnapshotView2,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT);
|
||||
mIconView2, STAGE_POSITION_BOTTOM_OR_RIGHT);
|
||||
mTaskIdAttributeContainer[0].setStagePosition(STAGE_POSITION_TOP_OR_LEFT);
|
||||
mSnapshotView2.bind(secondary);
|
||||
mSplitBoundsConfig = splitBoundsConfig;
|
||||
@@ -117,14 +117,6 @@ public class GroupedTaskView extends TaskView {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean showTaskMenuWithContainer(IconView iconView) {
|
||||
if (mActivity.getDeviceProfile().overviewShowAsGrid) {
|
||||
return TaskMenuViewWithArrow.Companion.showForTask(mTaskIdAttributeContainer[0]);
|
||||
} else {
|
||||
return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSplitBoundsConfig(StagedSplitBounds stagedSplitBounds) {
|
||||
mSplitBoundsConfig = stagedSplitBounds;
|
||||
invalidate();
|
||||
|
||||
@@ -80,7 +80,6 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
|
||||
private val menuWidth = context.resources.getDimensionPixelSize(R.dimen.task_menu_width_grid)
|
||||
|
||||
private lateinit var taskView: TaskView
|
||||
private lateinit var optionLayout: LinearLayout
|
||||
private lateinit var taskContainer: TaskIdAttributeContainer
|
||||
|
||||
@@ -94,7 +93,7 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
override fun isOfType(type: Int): Boolean = type and TYPE_TASK_MENU != 0
|
||||
|
||||
override fun getTargetObjectLocation(outPos: Rect?) {
|
||||
popupContainer.getDescendantRectRelativeToSelf(taskView.iconView, outPos)
|
||||
popupContainer.getDescendantRectRelativeToSelf(taskContainer.iconView, outPos)
|
||||
}
|
||||
|
||||
override fun onControllerInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
@@ -117,7 +116,6 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
return false
|
||||
}
|
||||
|
||||
taskView = taskContainer.taskView
|
||||
this.taskContainer = taskContainer
|
||||
if (!populateMenu()) return false
|
||||
show()
|
||||
@@ -137,7 +135,8 @@ class TaskMenuViewWithArrow<T : BaseDraggingActivity> : ArrowPopup<T> {
|
||||
private fun addMenuOptions() {
|
||||
// Add the options
|
||||
TaskOverlayFactory
|
||||
.getEnabledShortcuts(taskView, mActivityContext.deviceProfile, taskContainer)
|
||||
.getEnabledShortcuts(taskContainer.taskView, mActivityContext.deviceProfile,
|
||||
taskContainer)
|
||||
.forEach { this.addMenuOption(it) }
|
||||
|
||||
// Add the spaces between items
|
||||
|
||||
@@ -539,7 +539,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
mTask = task;
|
||||
mTaskIdContainer[0] = mTask.key.id;
|
||||
mTaskIdAttributeContainer[0] = new TaskIdAttributeContainer(task, mSnapshotView,
|
||||
STAGE_POSITION_UNDEFINED);
|
||||
mIconView, STAGE_POSITION_UNDEFINED);
|
||||
mSnapshotView.bind(task);
|
||||
setOrientationState(orientedState);
|
||||
}
|
||||
@@ -837,10 +837,12 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
|
||||
protected boolean showTaskMenuWithContainer(IconView iconView) {
|
||||
TaskIdAttributeContainer menuContainer =
|
||||
mTaskIdAttributeContainer[iconView == mIconView ? 0 : 1];
|
||||
if (mActivity.getDeviceProfile().overviewShowAsGrid) {
|
||||
return TaskMenuViewWithArrow.Companion.showForTask(mTaskIdAttributeContainer[0]);
|
||||
return TaskMenuViewWithArrow.Companion.showForTask(menuContainer);
|
||||
} else {
|
||||
return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
|
||||
return TaskMenuView.showForTask(menuContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1562,13 +1564,15 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
public class TaskIdAttributeContainer {
|
||||
private final TaskThumbnailView mThumbnailView;
|
||||
private final Task mTask;
|
||||
private final IconView mIconView;
|
||||
/** Defaults to STAGE_POSITION_UNDEFINED if in not a split screen task view */
|
||||
private @SplitConfigurationOptions.StagePosition int mStagePosition;
|
||||
|
||||
public TaskIdAttributeContainer(Task task, TaskThumbnailView thumbnailView,
|
||||
int stagePosition) {
|
||||
IconView iconView, int stagePosition) {
|
||||
this.mTask = task;
|
||||
this.mThumbnailView = thumbnailView;
|
||||
this.mIconView = iconView;
|
||||
this.mStagePosition = stagePosition;
|
||||
}
|
||||
|
||||
@@ -1588,6 +1592,10 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
return TaskView.this;
|
||||
}
|
||||
|
||||
public IconView getIconView() {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
public int getStagePosition() {
|
||||
return mStagePosition;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user