Search in sources :

Example 11 with CountDownTimer

use of android.os.CountDownTimer in project ride-read-android by Ride-Read.

the class RegisterFragment method initView.

@Override
public void initView() {
    mEdtInviteId.setOnEditorActionListener(this);
    mEdtCode.setOnEditorActionListener(this);
    mEdtPassword.setOnEditorActionListener(this);
    mEdtPasswordConfirm.setOnEditorActionListener(this);
    initGallery();
    mDownTimer = new CountDownTimer(60 * 1000, 1000) {

        @Override
        public void onTick(long l) {
            mTvSendCode.setClickable(false);
            mTvSendCode.setText((l / 1000) + "s后重新发送");
        }

        @Override
        public void onFinish() {
            mTvSendCode.setClickable(true);
            mTvSendCode.setText("重新发送");
        }
    };
}
Also used : CountDownTimer(android.os.CountDownTimer)

Example 12 with CountDownTimer

use of android.os.CountDownTimer in project android_frameworks_base by crdroidandroid.

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 13 with CountDownTimer

use of android.os.CountDownTimer in project android_frameworks_base by crdroidandroid.

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 14 with CountDownTimer

use of android.os.CountDownTimer in project sweet-alert-dialog by pedant.

the class SampleActivity method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.basic_test:
            // default title "Here's a message!"
            SweetAlertDialog sd = new SweetAlertDialog(this);
            sd.setCancelable(true);
            sd.setCanceledOnTouchOutside(true);
            sd.show();
            break;
        case R.id.under_text_test:
            new SweetAlertDialog(this).setContentText("It's pretty, isn't it?").show();
            break;
        case R.id.error_text_test:
            new SweetAlertDialog(this, SweetAlertDialog.ERROR_TYPE).setTitleText("Oops...").setContentText("Something went wrong!").show();
            break;
        case R.id.success_text_test:
            new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE).setTitleText("Good job!").setContentText("You clicked the button!").show();
            break;
        case R.id.warning_confirm_test:
            new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE).setTitleText("Are you sure?").setContentText("Won't be able to recover this file!").setConfirmText("Yes,delete it!").setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

                @Override
                public void onClick(SweetAlertDialog sDialog) {
                    // reuse previous dialog instance
                    sDialog.setTitleText("Deleted!").setContentText("Your imaginary file has been deleted!").setConfirmText("OK").setConfirmClickListener(null).changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
                }
            }).show();
            break;
        case R.id.warning_cancel_test:
            new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE).setTitleText("Are you sure?").setContentText("Won't be able to recover this file!").setCancelText("No,cancel plx!").setConfirmText("Yes,delete it!").showCancelButton(true).setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {

                @Override
                public void onClick(SweetAlertDialog sDialog) {
                    // reuse previous dialog instance, keep widget user state, reset them if you need
                    sDialog.setTitleText("Cancelled!").setContentText("Your imaginary file is safe :)").setConfirmText("OK").showCancelButton(false).setCancelClickListener(null).setConfirmClickListener(null).changeAlertType(SweetAlertDialog.ERROR_TYPE);
                // or you can new a SweetAlertDialog to show
                /* sDialog.dismiss();
                                new SweetAlertDialog(SampleActivity.this, SweetAlertDialog.ERROR_TYPE)
                                        .setTitleText("Cancelled!")
                                        .setContentText("Your imaginary file is safe :)")
                                        .setConfirmText("OK")
                                        .show();*/
                }
            }).setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {

                @Override
                public void onClick(SweetAlertDialog sDialog) {
                    sDialog.setTitleText("Deleted!").setContentText("Your imaginary file has been deleted!").setConfirmText("OK").showCancelButton(false).setCancelClickListener(null).setConfirmClickListener(null).changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
                }
            }).show();
            break;
        case R.id.custom_img_test:
            new SweetAlertDialog(this, SweetAlertDialog.CUSTOM_IMAGE_TYPE).setTitleText("Sweet!").setContentText("Here's a custom image.").setCustomImage(R.drawable.custom_img).show();
            break;
        case R.id.progress_dialog:
            final SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE).setTitleText("Loading");
            pDialog.show();
            pDialog.setCancelable(false);
            new CountDownTimer(800 * 7, 800) {

                public void onTick(long millisUntilFinished) {
                    // you can change the progress bar color by ProgressHelper every 800 millis
                    i++;
                    switch(i) {
                        case 0:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.blue_btn_bg_color));
                            break;
                        case 1:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.material_deep_teal_50));
                            break;
                        case 2:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.success_stroke_color));
                            break;
                        case 3:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.material_deep_teal_20));
                            break;
                        case 4:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.material_blue_grey_80));
                            break;
                        case 5:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.warning_stroke_color));
                            break;
                        case 6:
                            pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.success_stroke_color));
                            break;
                    }
                }

                public void onFinish() {
                    i = -1;
                    pDialog.setTitleText("Success!").setConfirmText("OK").changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
                }
            }.start();
            break;
    }
}
Also used : CountDownTimer(android.os.CountDownTimer) SweetAlertDialog(cn.pedant.SweetAlert.SweetAlertDialog)

Example 15 with CountDownTimer

use of android.os.CountDownTimer in project platform_frameworks_base by android.

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)

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