Browse Source

style

master
huting 2 years ago
parent
commit
7838f4bb52

+ 8
- 1
app/src/main/java/com/huntersun/vkyes/etcopencard/src/other/CodeCountDown.java View File

public class CodeCountDown extends CountDownTimer { public class CodeCountDown extends CountDownTimer {
private Button mTextView; private Button mTextView;
private Context context; private Context context;
int color;


public CodeCountDown(Context context, Button textView, long millisInFuture, long countDownInterval) { public CodeCountDown(Context context, Button textView, long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval); super(millisInFuture, countDownInterval);
this.mTextView = textView; this.mTextView = textView;
this.context = context; this.context = context;
} }
public CodeCountDown(Context context, Button textView, long millisInFuture, long countDownInterval,int color) {
super(millisInFuture, countDownInterval);
this.mTextView = textView;
this.context = context;
this.color = color;
}


@Override @Override
public void onTick(long millisUntilFinished) { public void onTick(long millisUntilFinished) {
mTextView.setClickable(false); //设置不可点击 mTextView.setClickable(false); //设置不可点击
mTextView.setEnabled(false); mTextView.setEnabled(false);
mTextView.setText(millisUntilFinished / 1000 + "s后重发"); //设置倒计时时间 mTextView.setText(millisUntilFinished / 1000 + "s后重发"); //设置倒计时时间
ColorStateList colors = context.getResources().getColorStateList(R.color.white);
ColorStateList colors = context.getResources().getColorStateList(color != 0 ? color : R.color.white);
mTextView.setTextColor(colors); mTextView.setTextColor(colors);
//mTextView.setBackgroundResource(R.drawable.bg_identify_code_press); //设置按钮为灰色,这时是不能点击的 //mTextView.setBackgroundResource(R.drawable.bg_identify_code_press); //设置按钮为灰色,这时是不能点击的
//mTextView.setBackgroundResource(R.drawable.boder_radius_5_white); //设置按钮为灰色,这时是不能点击的 //mTextView.setBackgroundResource(R.drawable.boder_radius_5_white); //设置按钮为灰色,这时是不能点击的

+ 1
- 1
app/src/main/java/com/huntersun/vkyes/etcopencard/src/ui/activity/LoginActivity.java View File

public void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { public void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) {
hideDialog(); hideDialog();
toast("验证码发送成功!"); toast("验证码发送成功!");
mCountDownTimerUtils = new CodeCountDown(LoginActivity.this, mGetCodeBtn, 60000, 1000);
mCountDownTimerUtils = new CodeCountDown(LoginActivity.this, mGetCodeBtn, 60000, 1000,R.color.common_accent_color);
mCountDownTimerUtils.start(); mCountDownTimerUtils.start();
} }



Loading…
Cancel
Save