use of android.os.CountDownTimer in project android_frameworks_base by DirtyUnicorns.
the class UserInactivityCountdownDialog method show.
@Override
public void show() {
super.show();
final TextView messageView = (TextView) findViewById(R.id.message);
messageView.post(new Runnable() {
@Override
public void run() {
mCountDownTimer = new CountDownTimer(mCountDownDuration, mRefreshInterval) {
@Override
public void onTick(long millisUntilFinished) {
String msg = getContext().getString(R.string.demo_user_inactivity_timeout_countdown, millisUntilFinished / 1000);
messageView.setText(msg);
}
@Override
public void onFinish() {
dismiss();
if (mOnCountDownExpiredListener != null)
mOnCountDownExpiredListener.onCountDownExpired();
}
}.start();
}
});
}
use of android.os.CountDownTimer in project android_frameworks_base by DirtyUnicorns.
the class KeyguardAbsKeyInputView method handleAttemptLockout.
// Prevent user from using the PIN/Password entry until scheduled deadline.
protected void handleAttemptLockout(long elapsedRealtimeDeadline) {
setPasswordEntryEnabled(false);
long elapsedRealtime = SystemClock.elapsedRealtime();
new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int secondsRemaining = (int) (millisUntilFinished / 1000);
mSecurityMessageDisplay.setMessage(R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining);
}
@Override
public void onFinish() {
mSecurityMessageDisplay.setMessage("", false);
resetState();
}
}.start();
}
use of android.os.CountDownTimer in project ride-read-android by Ride-Read.
the class RegisterFragment method onSendIdentCode.
//发送验证码
private void onSendIdentCode() {
EditText registerPhone = (EditText) phoneNumView.findViewById(R.id.register_edt_phone);
telPhone = registerPhone.getText().toString().trim();
if (telPhone != null && (!telPhone.isEmpty())) {
Log.i("手机号码:", telPhone);
AVOSCloud.requestSMSCodeInBackground(telPhone, "骑阅", "注册", 1, new RequestMobileCodeCallback() {
@Override
public void done(AVException e) {
if (e == null) {
new CountDownTimer(60000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
indentfyCodeTv.setText(millisUntilFinished / 1000 + "s后重新发送");
indentfyCodeTv.setClickable(false);
}
@Override
public void onFinish() {
indentfyCodeTv.setText("发送验证码");
indentfyCodeTv.setClickable(true);
}
}.start();
} else {
Toast.makeText(getActivity(), "验证码发送失败", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "未填手机号码", Toast.LENGTH_SHORT).show();
}
}
use of android.os.CountDownTimer in project iNGAGE by davis123123.
the class ChatActivity method timer.
private void timer(long initialCooldown) {
Timer t = new Timer();
timerTv = (TextView) findViewById(R.id.timertv);
//Set the schedule function and rate
mCountDownTimer = new CountDownTimer(initialCooldown, 1000) {
public void onTick(long millisUntilFinished) {
blockMSG();
//keeps track of current cooldown
currentCooldown = millisUntilFinished;
timerTv.setText(millisUntilFinished / 1000 + " s");
}
public void onFinish() {
unblockMSG();
}
}.start();
}
Aggregations