Merge "Prevent showing TaskMenuView if icon isn't present" into ub-launcher3-rvc-qpr-dev am: 4b1d1a0f18
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12130181 Change-Id: Iff8f2a973f2204e332f74f1af5499cdce6b9a5bd
This commit is contained in:
commit
3a80d76fac
4 files changed
+22
-8
No files matched your search
@@ -169,7 +169,9 @@ public class TaskMenuView extends AbstractFloatingView {
|
|||||||
}
|
}
|
||||||
if (mIsOpen) {
|
if (mIsOpen) {
|
||||||
mOptionLayout.removeAllViews();
|
mOptionLayout.removeAllViews();
|
||||||
populateAndLayoutMenu();
|
if (!populateAndLayoutMenu()) {
|
||||||
|
close(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,14 +188,22 @@ public class TaskMenuView extends AbstractFloatingView {
|
|||||||
}
|
}
|
||||||
mActivity.getDragLayer().addView(this);
|
mActivity.getDragLayer().addView(this);
|
||||||
mTaskView = taskView;
|
mTaskView = taskView;
|
||||||
populateAndLayoutMenu();
|
if (!populateAndLayoutMenu()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
post(this::animateOpen);
|
post(this::animateOpen);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateAndLayoutMenu() {
|
/** @return true if successfully able to populate task view menu, false otherwise */
|
||||||
|
private boolean populateAndLayoutMenu() {
|
||||||
|
if (mTaskView.getTask().icon == null) {
|
||||||
|
// Icon may not be loaded
|
||||||
|
return false;
|
||||||
|
}
|
||||||
addMenuOptions(mTaskView);
|
addMenuOptions(mTaskView);
|
||||||
orientAroundTaskView(mTaskView);
|
orientAroundTaskView(mTaskView);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMenuOptions(TaskView taskView) {
|
private void addMenuOptions(TaskView taskView) {
|
||||||
@@ -240,8 +250,10 @@ public class TaskMenuView extends AbstractFloatingView {
|
|||||||
setLayoutParams(params);
|
setLayoutParams(params);
|
||||||
setScaleX(taskView.getScaleX());
|
setScaleX(taskView.getScaleX());
|
||||||
setScaleY(taskView.getScaleY());
|
setScaleY(taskView.getScaleY());
|
||||||
|
boolean canActivityRotate = taskView.getRecentsView()
|
||||||
|
.mOrientationState.canRecentsActivityRotate();
|
||||||
mOptionLayout.setOrientation(orientationHandler
|
mOptionLayout.setOrientation(orientationHandler
|
||||||
.getTaskMenuLayoutOrientation(mOptionLayout));
|
.getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
|
||||||
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
|
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
|
||||||
taskView.getPagedOrientationHandler());
|
taskView.getPagedOrientationHandler());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout) {
|
public int getTaskMenuLayoutOrientation(boolean canRecentsActivityRotate,
|
||||||
|
LinearLayout taskMenuLayout) {
|
||||||
return LinearLayout.HORIZONTAL;
|
return LinearLayout.HORIZONTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public interface PagedOrientationHandler {
|
|||||||
float getTaskMenuX(float x, View thumbnailView);
|
float getTaskMenuX(float x, View thumbnailView);
|
||||||
float getTaskMenuY(float y, View thumbnailView);
|
float getTaskMenuY(float y, View thumbnailView);
|
||||||
int getTaskMenuWidth(View view);
|
int getTaskMenuWidth(View view);
|
||||||
int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout);
|
int getTaskMenuLayoutOrientation(boolean canRecentsActivityRotate, LinearLayout taskMenuLayout);
|
||||||
void setLayoutParamsForTaskMenuOptionItem(LinearLayout.LayoutParams lp);
|
void setLayoutParamsForTaskMenuOptionItem(LinearLayout.LayoutParams lp);
|
||||||
int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect);
|
int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect);
|
||||||
|
|
||||||
|
|||||||
@@ -237,8 +237,9 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout) {
|
public int getTaskMenuLayoutOrientation(boolean canRecentsActivityRotate,
|
||||||
return taskMenuLayout.getOrientation();
|
LinearLayout taskMenuLayout) {
|
||||||
|
return canRecentsActivityRotate ? taskMenuLayout.getOrientation() : LinearLayout.VERTICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user