|
|
@@ -18,19 +18,26 @@ import com.huntersun.vkyes.etcopencard.R; |
|
|
|
public class CodeCountDown extends CountDownTimer { |
|
|
|
private Button mTextView; |
|
|
|
private Context context; |
|
|
|
int color; |
|
|
|
|
|
|
|
public CodeCountDown(Context context, Button textView, long millisInFuture, long countDownInterval) { |
|
|
|
super(millisInFuture, countDownInterval); |
|
|
|
this.mTextView = textView; |
|
|
|
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 |
|
|
|
public void onTick(long millisUntilFinished) { |
|
|
|
mTextView.setClickable(false); //设置不可点击 |
|
|
|
mTextView.setEnabled(false); |
|
|
|
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.setBackgroundResource(R.drawable.bg_identify_code_press); //设置按钮为灰色,这时是不能点击的 |
|
|
|
//mTextView.setBackgroundResource(R.drawable.boder_radius_5_white); //设置按钮为灰色,这时是不能点击的 |