summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Ryden <wryden@google.com>2024-04-18 21:47:55 +0000
committerFredrik Ryden <wryden@google.com>2024-05-06 09:21:31 +0000
commit52098a139dd03271bef5a930470a4defe5d84daf (patch)
treee804f9377a93f855efb3c0ed634c7353b1117f9b
parente933e38c58304367de017c98bd77cc432ddc0ee2 (diff)
downloadbase-52098a139dd03271bef5a930470a4defe5d84daf.tar.gz
Fixed graphical glitch in lockpattern view
Fixed end point correctional animation for cell to cell animations during lock pattern drawing. In the lock pattern view, cells have an area of slop around them to allow for drawing the pattern without hitting the exact center of cells. When a cell is hit, the end point of the line drawn between that cell and the previous is adjusted with an animation from the hit coordinate and the exact center of the cell. With LockPatternView_keepDotActivated set to true, cell animations for the previous cell are recreated when a new cell is hit to allow changing how a cells color is updated as the pattern is drawn. This caused a glitch where the starting position of the end point correcting animation for said previous cell would be recreated with the current finger position coordinate, making it jump ahead to be closer to the current latest cell, and animating back towards the target. This fix makes the animation instead continue from where it was last, in the case where the animation is recreated. Test: manual, set a short, tight lock pattern, and try it in rapid motion. Bug: 328088937 Change-Id: Id445266cbc834fec7a514dbb227557f2ceae9dba
-rw-r--r--core/java/com/android/internal/widget/LockPatternView.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 66b0158fbd67..0734e6827d4d 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -886,9 +886,16 @@ public class LockPatternView extends View {
cellState.activationAnimator.cancel();
}
AnimatorSet animatorSet = new AnimatorSet();
+
+ // When running the line end animation (see doc for createLineEndAnimation), if cell is in:
+ // - activate state - use finger position at the time of hit detection
+ // - deactivate state - use current position where the end was last during initial animation
+ // Note that deactivate state will only come if mKeepDotActivated is themed true.
+ final float startX = activate == CELL_ACTIVATE ? mInProgressX : cellState.lineEndX;
+ final float startY = activate == CELL_ACTIVATE ? mInProgressY : cellState.lineEndY;
AnimatorSet.Builder animatorSetBuilder = animatorSet
.play(createLineDisappearingAnimation())
- .with(createLineEndAnimation(cellState, mInProgressX, mInProgressY,
+ .with(createLineEndAnimation(cellState, startX, startY,
getCenterXForColumn(cell.column), getCenterYForRow(cell.row)));
if (mDotSize != mDotSizeActivated) {
animatorSetBuilder.with(createDotRadiusAnimation(cellState));