In this construction method you need to pass in three parameters, one is activity, the other is the total time millisinfuture,
One is the time of each reduction, the last one is the countdown button
Usage:
Timelastutil new Timelastutil (btn);
Timelastutil.start ();
Tool class:
public class TimelastutilExtends Countdowntimer {
Private Activitymactivity;
Private TextViewBtnButton
In this construction method you need to pass in three parameters, one is activity, the other is the total time millisinfuture,
One is Countdowninterval, and then you do this on which button, you can just pass this button over.
Public Timelastutil (Activity mactivity,Long Millisinfuture,
Long Countdowninterval, TextView btn) {
Super (Millisinfuture, countdowninterval);
This.mactivity = mactivity;
This.BTN = BTN;
}
@SuppressLint ("Newapi")
@Override
public void OnFinish () {
Btn.settext (r.string.Register_regetchecknum);
Btn.setclickable (true);Get a click again
Btn.setbackgroundcolor (Color.Parsecolor ("#00CCCC"));Restore background color
}
@Override
public void OnTick (Long millisuntilfinished) {
Btn.setclickable (FALSE);Settings cannot be clicked
Btn.settext (millisuntilfinished/1000 +"s can be re-sent after");Set the countdown time
The Set button is grayed out and is not clickable at this time
Btn.setbackgroundcolor (Color.new spannablestring (btn.gettext (). toString ()); //gets the text of the button
Span.setspan (new Foregroundcolorspan (Color.red), 0, 2,
Spannable.span_inclusive_exclusive); //The countdown time is shown in red
btn.settext (span);
}
}
Get Verification Code countdown tool used when registering