2

Currently I am implementing a custom textView for passcode entry. I'm using a custom transformation to show the last number entered like so:

public class PinCodePasswordTransformationMethod extends PasswordTransformationMethod {

char passwordBullet = '\u26aa';

@Override
public CharSequence getTransformation(CharSequence source, View view) {
    return new PasswordCharSequence(source);
}

private class PasswordCharSequence implements CharSequence {
    private CharSequence mSource;

    public PasswordCharSequence(CharSequence source) {
        mSource = source; // Store char sequence
    }
    public char charAt(int index) {
        if(index != mSource.length()-1)
            return passwordBullet;
        else
            return mSource.charAt(index);

    }
    public int length() {
        return mSource.length(); // Return default
    }
    public CharSequence subSequence(int start, int end) {
        return mSource.subSequence(start, end); // Return default
    }
}
}

and apply it on the textview as so:

mTextView.setTransformationMethod(new PinCodePasswordTransformationMethod());

Right now each letter appears instantly when inputed. How can I animate changes so that the entry of new pin number and change of second last number to the password bullet character is animated?

ColonD
  • 954
  • 10
  • 28
  • refer to the sources of your base class and see how they implemented hiding the entered letter (class `Visible`) – pskink Aug 20 '17 at 06:41
  • TextView looks like a behemoth, with around 10000 lines of code I don't even know where to look. where does the redrawing occur? – ColonD Aug 21 '17 at 03:37
  • i mean base class of your `PinCodePasswordTransformationMethod` - that is `PasswordTransformationMethod` – pskink Aug 21 '17 at 05:29
  • btw i like the word "behemoth" ;-) – pskink Aug 21 '17 at 07:14
  • hehe. thanks. I checked out `PasswordTransformationMethod` and It mostly deals with `Strings` and `CharSequences`, but i did see a `Spannable` there. Lemme see if i can do something with that – ColonD Aug 21 '17 at 07:35

0 Answers0