Search in sources :

Example 21 with CountDownTimer

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();
        }
    });
}
Also used : CountDownTimer(android.os.CountDownTimer) TextView(android.widget.TextView)

Example 22 with CountDownTimer

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();
}
Also used : CountDownTimer(android.os.CountDownTimer)

Example 23 with CountDownTimer

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();
    }
}
Also used : EditText(android.widget.EditText) AVException(com.avos.avoscloud.AVException) CountDownTimer(android.os.CountDownTimer) RequestMobileCodeCallback(com.avos.avoscloud.RequestMobileCodeCallback)

Example 24 with CountDownTimer

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();
}
Also used : Timer(java.util.Timer) CountDownTimer(android.os.CountDownTimer) CountDownTimer(android.os.CountDownTimer)

Aggregations

CountDownTimer (android.os.CountDownTimer)24 TextView (android.widget.TextView)4 Test (org.junit.Test)2 SharedPreferences (android.content.SharedPreferences)1 TypedArray (android.content.res.TypedArray)1 View (android.view.View)1 WebSettingsClassic (android.webkit.WebSettingsClassic)1 CheckBox (android.widget.CheckBox)1 EditText (android.widget.EditText)1 SweetAlertDialog (cn.pedant.SweetAlert.SweetAlertDialog)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 AVException (com.avos.avoscloud.AVException)1 RequestMobileCodeCallback (com.avos.avoscloud.RequestMobileCodeCallback)1 HmsPicker (com.doomonafireball.betterpickers.hmspicker.HmsPicker)1 HmsView (com.doomonafireball.betterpickers.hmspicker.HmsView)1 MarkerUpdate (com.omkarmoghe.pokemap.models.events.MarkerUpdate)1 Timer (java.util.Timer)1 Before (org.junit.Before)1