Search in sources :

Example 1 with CountDownTimer

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

the class ProfiledWebView method startScrollTest.

/*
     * Called once the page is loaded to start scrolling for evaluating tiles.
     * If autoScrolling isn't set, stop must be called manually. Before
     * scrolling, invalidate all content and redraw it, measuring time taken.
     */
public void startScrollTest(ProfileCallback callback, boolean autoScrolling) {
    mCallback = callback;
    mIsTesting = false;
    mIsScrolling = false;
    WebSettingsClassic settings = getWebViewClassic().getSettings();
    settings.setProperty("tree_updates", "0");
    if (autoScrolling) {
        // after a while, force it to start even if the pages haven't swapped
        new CountDownTimer(LOAD_STALL_MILLIS, LOAD_STALL_MILLIS) {

            @Override
            public void onTick(long millisUntilFinished) {
            }

            @Override
            public void onFinish() {
                // invalidate all content, and kick off redraw
                Log.d("ProfiledWebView", "kicking off test with callback registration, and tile discard...");
                getWebViewClassic().discardAllTextures();
                invalidate();
                mIsScrolling = true;
                mContentInvalMillis = System.currentTimeMillis();
            }
        }.start();
    } else {
        mIsTesting = true;
        getWebViewClassic().tileProfilingStart();
    }
}
Also used : CountDownTimer(android.os.CountDownTimer) WebSettingsClassic(android.webkit.WebSettingsClassic)

Example 2 with CountDownTimer

use of android.os.CountDownTimer in project Pokemap by omkarmoghe.

the class MarkerRefreshController method startTimer.

public void startTimer(long duration) {
    if (mTimer != null) {
        mTimer.cancel();
    }
    if (duration <= 0) {
        return;
    }
    final MarkerUpdate event = new MarkerUpdate();
    mTimer = new CountDownTimer(duration, DEFAULT_UPDATE_INTERVAL) {

        @Override
        public void onTick(long l) {
            EventBus.getDefault().post(event);
        }

        @Override
        public void onFinish() {
            mTimer = null;
            EventBus.getDefault().post(event);
        }
    };
    mTimer.start();
}
Also used : MarkerUpdate(com.omkarmoghe.pokemap.models.events.MarkerUpdate) CountDownTimer(android.os.CountDownTimer)

Example 3 with CountDownTimer

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

the class ShadowCountDownTimerTest method testStart.

@Test
public void testStart() {
    assertThat(shadowCountDownTimer.hasStarted()).isFalse();
    CountDownTimer timer = shadowCountDownTimer.start();
    assertThat(timer).isNotNull();
    assertThat(shadowCountDownTimer.hasStarted()).isTrue();
}
Also used : CountDownTimer(android.os.CountDownTimer) Test(org.junit.Test)

Example 4 with CountDownTimer

use of android.os.CountDownTimer in project Notes by Elder-Wu.

the class CountDownView method start.

public void start() {
    if (listener != null) {
        listener.onStartCount();
    }
    if (countDownTimer == null) {
        countDownTimer = new CountDownTimer(3600, 36) {

            @Override
            public void onTick(long millisUntilFinished) {
                progress = ((3600 - millisUntilFinished) / 3600f) * 360;
                Log.d(TAG, "progress:" + progress);
                invalidate();
            }

            @Override
            public void onFinish() {
                progress = 360;
                invalidate();
                if (listener != null) {
                    listener.onFinishCount();
                }
            }
        };
    }
    countDownTimer.cancel();
    countDownTimer.start();
}
Also used : CountDownTimer(android.os.CountDownTimer)

Example 5 with CountDownTimer

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

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)

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