[FIX] disable context menu when long click,fix number disorder when click index.
This commit is contained in:
@@ -12,7 +12,9 @@ import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
|
||||
/**
|
||||
@@ -120,6 +122,17 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
||||
setMeasuredDimension(widthResult, heightResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
requestFocus();
|
||||
setSelection(getText().length());
|
||||
showKeyBoard(getContext());
|
||||
return false;
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
mCurrentPosition = getText().length();
|
||||
@@ -260,4 +273,9 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
||||
wm.getDefaultDisplay().getMetrics(metrics);
|
||||
return metrics.widthPixels;
|
||||
}
|
||||
|
||||
public void showKeyBoard(Context context) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user