Package com.cheetahdigital.uikit.widget
Class PhoneNumberFormattingTextWatcher
- java.lang.Object
-
- com.cheetahdigital.uikit.widget.PhoneNumberFormattingTextWatcher
-
- All Implemented Interfaces:
android.text.NoCopySpan
,android.text.TextWatcher
public class PhoneNumberFormattingTextWatcher extends java.lang.Object implements android.text.TextWatcher
ATextWatcher
used for formatting the phone number.
-
-
Constructor Summary
Constructors Constructor Description PhoneNumberFormattingTextWatcher(android.widget.EditText edTxtPhone)
Constructor forPhoneNumberFormattingTextWatcher
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterTextChanged(android.text.Editable s)
Called whenever a phone numbe has been changed somewhere in the EditText.void
beforeTextChanged(java.lang.CharSequence s, int start, int count, int after)
Called when the phone number is about to be changed with a new number.void
onTextChanged(java.lang.CharSequence s, int cursorPosition, int before, int count)
Called whenever a phone number is changed in the EditText.static java.lang.String
removeCharAt(java.lang.String s, int pos, int length)
Removes the character at the specified position.
-
-
-
Constructor Detail
-
PhoneNumberFormattingTextWatcher
public PhoneNumberFormattingTextWatcher(android.widget.EditText edTxtPhone)
Constructor forPhoneNumberFormattingTextWatcher
- Parameters:
edTxtPhone
- the EditText being observed.
-
-
Method Detail
-
onTextChanged
public void onTextChanged(java.lang.CharSequence s, int cursorPosition, int before, int count)
Called whenever a phone number is changed in the EditText.- Specified by:
onTextChanged
in interfaceandroid.text.TextWatcher
- Parameters:
s
- character sequencecursorPosition
- current positionbefore
- length of old textcount
- number of characters
-
beforeTextChanged
public void beforeTextChanged(java.lang.CharSequence s, int start, int count, int after)
Called when the phone number is about to be changed with a new number.- Specified by:
beforeTextChanged
in interfaceandroid.text.TextWatcher
- Parameters:
s
- character sequencestart
- starting positioncount
- number of charactersafter
- new text length
-
afterTextChanged
public void afterTextChanged(android.text.Editable s)
Called whenever a phone numbe has been changed somewhere in the EditText.- Specified by:
afterTextChanged
in interfaceandroid.text.TextWatcher
- Parameters:
s
- character sequence
-
removeCharAt
public static java.lang.String removeCharAt(java.lang.String s, int pos, int length)
Removes the character at the specified position.- Parameters:
s
- character sequencepos
- positionlength
- length of string- Returns:
- modified string with removed character
-
-