Disable input while animating clear all on Go

Prevent janky things from happening by preventing user input from going
through while the clear all animation is occurring.

Bug: 114136250
Test: Hit clear all => try to clear all / tap task, nothing happens
Change-Id: If7bd6b54e4b1b8185fafda990561973ea17b9648
This commit is contained in:
Kevin 2019-03-22 17:11:47 -07:00
parent e3e1044aed
commit 1497112599
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 View mEmptyView;
private View mContentView;
private View mClearAllView;
private boolean mTransitionedFromApp;
public IconRecentsView(Context context, AttributeSet attrs) {
@ -125,12 +126,22 @@ public final class IconRecentsView extends FrameLayout {
updateContentViewVisibility();
}
});
View clearAllView = findViewById(R.id.clear_all_button);
clearAllView.setOnClickListener(v -> animateClearAllTasks());
mClearAllView = findViewById(R.id.clear_all_button);
mClearAllView.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.
*
@ -206,6 +217,7 @@ public final class IconRecentsView extends FrameLayout {
* Clear all tasks and animate out.
*/
private void animateClearAllTasks() {
setEnabled(false);
TaskItemView[] itemViews = getTaskViews();
AnimatorSet clearAnim = new AnimatorSet();
@ -251,6 +263,7 @@ public final class IconRecentsView extends FrameLayout {
itemView.setTranslationX(0);
itemView.setAlpha(1.0f);
}
setEnabled(true);
mContentView.setVisibility(GONE);
mTaskActionController.clearAllTasks();
}