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();
}
}
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();
}
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();
}
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();
}
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();
}
Aggregations