Interface TransformationMethod

All Known Implementing Classes:
PasswordTransformationMethod, ReplacementTransformationMethod, SingleLineTransformationMethod

public interface TransformationMethod
TextView uses TransformationMethods to do things like replacing the characters of passwords with dots, or keeping the newline characters from causing line breaks in single-line text fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • Method Details

    • getTransformation

      @Nonnull CharSequence getTransformation(@Nonnull CharSequence source, @Nonnull 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. 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.
    • onFocusChanged

      void onFocusChanged(@Nonnull View view, @Nonnull CharSequence sourceText, boolean focused, int direction, @Nullable Rect previouslyFocusedRect)
      This method is called when the TextView that uses this TransformationMethod gains or loses focus.