Package icyllis.modernui.text.method
Class PasswordTransformationMethod
java.lang.Object
icyllis.modernui.text.method.PasswordTransformationMethod
- All Implemented Interfaces:
TransformationMethod
,NoCopySpan
,TextWatcher
public class PasswordTransformationMethod
extends Object
implements TransformationMethod, TextWatcher
-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.text.NoCopySpan
NoCopySpan.Concrete
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called to notify you that, somewhere withins
, the text has been changed.void
beforeTextChanged
(CharSequence s, int start, int count, int after) This method is called to notify you that, withins
, thecount
characters beginning atstart
are about to be replaced by new text with lengthafter
.static PasswordTransformationMethod
getTransformation
(CharSequence source, View view) Returns a CharSequence that is a transformation of the source text -- for example, replacing each character with a dot in a password field.void
onFocusChanged
(View view, CharSequence sourceText, boolean focused, int direction, Rect previouslyFocusedRect) This method is called when the TextView that uses this TransformationMethod gains or loses focus.void
onTextChanged
(CharSequence s, int start, int before, int count) This method is called to notify you that, withins
, thecount
characters beginning atstart
have just replaced old text that had lengthbefore
.
-
Method Details
-
getInstance
-
getTransformation
Description copied from interface:TransformationMethod
Returns a CharSequence that is a transformation of the source text -- for example, replacing each character with a dot in a password field. Beware that the returned text must be exactly the same length as the source text, and that if the source text is Editable, the returned text must mirror it dynamically instead of doing a one-time copy.- Specified by:
getTransformation
in interfaceTransformationMethod
-
onFocusChanged
public void onFocusChanged(@Nonnull View view, @Nonnull CharSequence sourceText, boolean focused, int direction, @Nullable Rect previouslyFocusedRect) Description copied from interface:TransformationMethod
This method is called when the TextView that uses this TransformationMethod gains or loses focus.- Specified by:
onFocusChanged
in interfaceTransformationMethod
-
beforeTextChanged
Description copied from interface:TextWatcher
This method is called to notify you that, withins
, thecount
characters beginning atstart
are about to be replaced by new text with lengthafter
. It is an error to attempt to make changes tos
from this callback.- Specified by:
beforeTextChanged
in interfaceTextWatcher
-
onTextChanged
Description copied from interface:TextWatcher
This method is called to notify you that, withins
, thecount
characters beginning atstart
have just replaced old text that had lengthbefore
. It is an error to attempt to make changes tos
from this callback.- Specified by:
onTextChanged
in interfaceTextWatcher
-
afterTextChanged
Description copied from interface:TextWatcher
This method is called to notify you that, somewhere withins
, the text has been changed. It is legitimate to make further changes tos
from this callback, but be careful not to get yourself into an infinite loop, because any changes you make will cause this method to be called again recursively. (You are not told where the change took place because other afterTextChanged() methods may already have made other changes and invalidated the offsets. But if you need to know here, you can useSpannable.setSpan(java.lang.Object, int, int, int)
inTextWatcher.onTextChanged(java.lang.CharSequence, int, int, int)
to mark your place and then look up from here where the span ended up.- Specified by:
afterTextChanged
in interfaceTextWatcher
-