use of com.siberiadante.androidutil.widget.textview.SDBlackCirclePsdView in project AndroidUtilLib by SiberiaDante.
the class SDVerificationCodeView method initTextViews.
private void initTextViews(Context context, int etNumber, int etWidth, Drawable etDividerDrawable, float etTextSize, int etTextColor) {
edtTransparent.setCursorVisible(false);
// maximum input length
edtTransparent.setFilters(new InputFilter[] { new InputFilter.LengthFilter(etNumber) });
// setting division line width
if (etDividerDrawable != null) {
etDividerDrawable.setBounds(0, 0, etDividerDrawable.getMinimumWidth(), etDividerDrawable.getMinimumHeight());
containerEt.setDividerDrawable(etDividerDrawable);
}
mPwdTextViews = new SDBlackCirclePsdView[etNumber];
for (int i = 0; i < mPwdTextViews.length; i++) {
SDBlackCirclePsdView textView = new SDBlackCirclePsdView(context);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, etTextSize);
textView.setTextColor(etTextColor);
textView.setWidth(etWidth);
textView.setHeight(etWidth);
if (i == 0) {
textView.setBackgroundDrawable(mEtBackgroundDrawableFocus);
} else {
textView.setBackgroundDrawable(mEtBackgroundDrawableNormal);
}
textView.setGravity(Gravity.CENTER);
textView.setFocusable(false);
mPwdTextViews[i] = textView;
}
}
use of com.siberiadante.androidutil.widget.textview.SDBlackCirclePsdView in project AndroidUtilLib by SiberiaDante.
the class SDVerificationCodeView method setText.
// 给TextView 设置文字
private void setText(String inputContent) {
for (int i = 0; i < mPwdTextViews.length; i++) {
SDBlackCirclePsdView tv = mPwdTextViews[i];
if (tv.getText().toString().trim().equals("")) {
if (mEtPwd) {
tv.drawPwd(mEtPwdRadius);
tv.setTextSize(0);
}
tv.setText(inputContent);
// 添加输入完成的监听
if (inputCompleteListener != null) {
inputCompleteListener.inputComplete();
}
tv.setBackgroundDrawable(mEtBackgroundDrawableComplete);
// tv.setBackgroundDrawable(mEtBackgroundDrawableNormal);
if (i < mEtNumber - 1) {
mPwdTextViews[i + 1].setBackgroundDrawable(mEtBackgroundDrawableFocus);
}
break;
}
}
}
use of com.siberiadante.androidutil.widget.textview.SDBlackCirclePsdView in project AndroidUtilLib by SiberiaDante.
the class SDVerificationCodeView method onKeyDelete.
private void onKeyDelete() {
for (int i = mPwdTextViews.length - 1; i >= 0; i--) {
SDBlackCirclePsdView tv = mPwdTextViews[i];
if (!tv.getText().toString().trim().equals("")) {
if (mEtPwd) {
tv.clearPwd();
}
tv.setText("");
tv.setBackgroundResource(R.drawable.shape_vcv_bg_normal);
if (inputCompleteListener != null) {
inputCompleteListener.deleteContent();
}
tv.setBackgroundDrawable(mEtBackgroundDrawableFocus);
if (i < mEtNumber - 1) {
mPwdTextViews[i + 1].setBackgroundDrawable(mEtBackgroundDrawableNormal);
}
break;
}
}
}
Aggregations