Search in sources :

Example 1 with MarkerUpdate

use of com.omkarmoghe.pokemap.models.events.MarkerUpdate 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)

Aggregations

CountDownTimer (android.os.CountDownTimer)1 MarkerUpdate (com.omkarmoghe.pokemap.models.events.MarkerUpdate)1