Merge "Remove char state cache." into tm-qpr-dev am: 4300a958fe am: c033d9049a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21036773

Change-Id: Ia77e3ead5ac6e44cf2f4ba6427496b3f9c6d310b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Aaron Liu
2023-01-23 23:04:36 +00:00
committed by Automerger Merge Worker

View File

@@ -47,7 +47,6 @@ import com.android.settingslib.Utils;
import com.android.systemui.R;
import java.util.ArrayList;
import java.util.Stack;
/**
* A View similar to a textView which contains password text and can animate when the text is
@@ -92,7 +91,6 @@ public class PasswordTextView extends View {
private final int mGravity;
private ArrayList<CharState> mTextChars = new ArrayList<>();
private String mText = "";
private Stack<CharState> mCharPool = new Stack<>();
private int mDotSize;
private PowerManager mPM;
private int mCharPadding;
@@ -310,13 +308,7 @@ public class PasswordTextView extends View {
}
private CharState obtainCharState(char c) {
CharState charState;
if(mCharPool.isEmpty()) {
charState = new CharState();
} else {
charState = mCharPool.pop();
charState.reset();
}
CharState charState = new CharState();
charState.whichChar = c;
return charState;
}
@@ -343,8 +335,6 @@ public class PasswordTextView extends View {
maxDelay = Math.min(maxDelay, RESET_MAX_DELAY) + DISAPPEAR_DURATION;
charState.startRemoveAnimation(startDelay, maxDelay);
charState.removeDotSwapCallbacks();
} else {
mCharPool.push(charState);
}
}
if (!animated) {
@@ -421,8 +411,6 @@ public class PasswordTextView extends View {
public void onAnimationEnd(Animator animation) {
if (!mCancelled) {
mTextChars.remove(CharState.this);
mCharPool.push(CharState.this);
reset();
cancelAnimator(textTranslateAnimator);
textTranslateAnimator = null;
}
@@ -518,21 +506,6 @@ public class PasswordTextView extends View {
}
};
void reset() {
whichChar = 0;
currentTextSizeFactor = 0.0f;
currentDotSizeFactor = 0.0f;
currentWidthFactor = 0.0f;
cancelAnimator(textAnimator);
textAnimator = null;
cancelAnimator(dotAnimator);
dotAnimator = null;
cancelAnimator(widthAnimator);
widthAnimator = null;
currentTextTranslationY = 1.0f;
removeDotSwapCallbacks();
}
void startRemoveAnimation(long startDelay, long widthDelay) {
boolean dotNeedsAnimation = (currentDotSizeFactor > 0.0f && dotAnimator == null)
|| (dotAnimator != null && dotAnimationIsGrowing);