43 lines
1.2 KiB
Java
43 lines
1.2 KiB
Java
package com.ubtrobot.analytics.event;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class Ticker {
|
|
private Handler a = new Handler(Looper.getMainLooper());
|
|
private ListenerRunnable b;
|
|
|
|
private class ListenerRunnable implements Runnable {
|
|
private TicktockListener a;
|
|
private int b;
|
|
private TimeUnit c;
|
|
|
|
public ListenerRunnable(TicktockListener ticktockListener, int i, TimeUnit timeUnit) {
|
|
this.a = ticktockListener;
|
|
this.b = i;
|
|
this.c = timeUnit;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
this.a.a();
|
|
Ticker.this.a.postDelayed(this, this.c.toMillis(this.b));
|
|
}
|
|
}
|
|
|
|
public void a(TicktockListener ticktockListener, int i, TimeUnit timeUnit) {
|
|
ListenerRunnable listenerRunnable = this.b;
|
|
if (listenerRunnable == null) {
|
|
listenerRunnable = new ListenerRunnable(ticktockListener, i, timeUnit);
|
|
}
|
|
this.b = listenerRunnable;
|
|
this.a.post(this.b);
|
|
}
|
|
|
|
public void a() {
|
|
this.a.removeCallbacks(this.b);
|
|
}
|
|
}
|