Cancel selection animation when new selection arrives

The onAnimationEnd callback will set the selection but there is a race
condition that the new selection may arrive during animation.
The later selection should be honored, so cancel the ongoing animation
before starting new selection.

Bug: 244273440
Test: Manually done on the Pixel 5 with wireless mouse
Change-Id: I977f6cc9244e571caddfe0d79e10ee1c6c8a413d
This commit is contained in:
Seigo Nonaka
2022-09-08 18:03:04 +09:00
parent 266bef4617
commit 9a13cec9a1

View File

@@ -148,6 +148,9 @@ public final class SelectionActionModeHelper {
startSelectionActionMode(null);
} else {
resetTextClassificationHelper();
if (mSmartSelectSprite != null && mSmartSelectSprite.isAnimationActive()) {
mSmartSelectSprite.cancelAnimation();
}
mTextClassificationAsyncTask = new TextClassificationAsyncTask(
mTextView,
mTextClassificationHelper.getTimeoutDuration(),