register fixes
This commit is contained in:
@@ -4,7 +4,9 @@ import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@@ -77,6 +79,10 @@ public class PizzalinkEditText extends LinearLayout implements View.OnClickListe
|
||||
if (inputType == null)
|
||||
inputType = "text";
|
||||
switch (inputType){
|
||||
case "name":
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
break;
|
||||
case "password":
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
break;
|
||||
@@ -86,8 +92,32 @@ public class PizzalinkEditText extends LinearLayout implements View.OnClickListe
|
||||
case "email":
|
||||
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
break;
|
||||
case "number":
|
||||
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_NUMBER);
|
||||
break;
|
||||
case "address":
|
||||
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
|
||||
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
// if edittext has 10chars & this is not called yet, add new line
|
||||
if(editText.getText().length() == 40 * editText.getLineCount()) {
|
||||
editText.append("\n");
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT);
|
||||
editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user