Merge "Do not switch to screenshot and finish recents animation for menu options that already do so" into sc-dev

This commit is contained in:
Tracy Zhou 2021-07-01 19:32:39 +00:00 committed by Android (Google) Code Review
commit e54f789de9
3 changed files with 13 additions and 1 deletions

View File

@ -88,6 +88,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
SystemShortcut screenshotShortcut = TaskShortcutFactory.SCREENSHOT
.getShortcut(activity, taskView);
if (screenshotShortcut != null) {
screenshotShortcut.setHasFinishRecentsInAction(true);
shortcuts.add(screenshotShortcut);
}
@ -96,6 +97,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
SystemShortcut modalShortcut = TaskShortcutFactory.MODAL
.getShortcut(activity, taskView);
if (modalShortcut != null) {
modalShortcut.setHasFinishRecentsInAction(true);
shortcuts.add(modalShortcut);
}
}

View File

@ -220,7 +220,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
menuOptionView.setEnabled(menuOption.isEnabled());
menuOptionView.setAlpha(menuOption.isEnabled() ? 1 : 0.5f);
menuOptionView.setOnClickListener(view -> {
if (LIVE_TILE.get()) {
if (LIVE_TILE.get() && !menuOption.hasFinishRecentsInAction()) {
RecentsView recentsView = mTaskView.getRecentsView();
recentsView.switchToScreenshot(null,
() -> recentsView.finishRecentsAnimation(true /* toRecents */,

View File

@ -50,6 +50,8 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
*/
private boolean isEnabled = true;
private boolean mHasFinishRecentsInAction = false;
public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo) {
mIconResId = iconResId;
mLabelResId = labelResId;
@ -100,6 +102,14 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
return mAccessibilityActionId == action;
}
public void setHasFinishRecentsInAction(boolean hasFinishRecentsInAction) {
mHasFinishRecentsInAction = hasFinishRecentsInAction;
}
public boolean hasFinishRecentsInAction() {
return mHasFinishRecentsInAction;
}
public interface Factory<T extends BaseDraggingActivity> {
@Nullable SystemShortcut<T> getShortcut(T activity, ItemInfo itemInfo);