Merge "Disable input while animating clear all on Go" into ub-launcher3-master

This commit is contained in:
TreeHugger Robot 2019-04-02 00:41:55 +00:00 committed by Android (Google) Code Review
commit 3388e34799
1 changed files with 16 additions and 3 deletions

View File

@ -89,6 +89,7 @@ public final class IconRecentsView extends FrameLayout {
private RecyclerView mTaskRecyclerView; private RecyclerView mTaskRecyclerView;
private View mEmptyView; private View mEmptyView;
private View mContentView; private View mContentView;
private View mClearAllView;
private boolean mTransitionedFromApp; private boolean mTransitionedFromApp;
public IconRecentsView(Context context, AttributeSet attrs) { public IconRecentsView(Context context, AttributeSet attrs) {
@ -125,12 +126,22 @@ public final class IconRecentsView extends FrameLayout {
updateContentViewVisibility(); updateContentViewVisibility();
} }
}); });
mClearAllView = findViewById(R.id.clear_all_button);
View clearAllView = findViewById(R.id.clear_all_button); mClearAllView.setOnClickListener(v -> animateClearAllTasks());
clearAllView.setOnClickListener(v -> animateClearAllTasks());
} }
} }
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
TaskItemView[] itemViews = getTaskViews();
for (TaskItemView itemView : itemViews) {
itemView.setEnabled(enabled);
}
mClearAllView.setEnabled(enabled);
}
/** /**
* Set activity helper for the view to callback to. * Set activity helper for the view to callback to.
* *
@ -204,6 +215,7 @@ public final class IconRecentsView extends FrameLayout {
* Clear all tasks and animate out. * Clear all tasks and animate out.
*/ */
private void animateClearAllTasks() { private void animateClearAllTasks() {
setEnabled(false);
TaskItemView[] itemViews = getTaskViews(); TaskItemView[] itemViews = getTaskViews();
AnimatorSet clearAnim = new AnimatorSet(); AnimatorSet clearAnim = new AnimatorSet();
@ -249,6 +261,7 @@ public final class IconRecentsView extends FrameLayout {
itemView.setTranslationX(0); itemView.setTranslationX(0);
itemView.setAlpha(1.0f); itemView.setAlpha(1.0f);
} }
setEnabled(true);
mContentView.setVisibility(GONE); mContentView.setVisibility(GONE);
mTaskActionController.clearAllTasks(); mTaskActionController.clearAllTasks();
} }