- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
108 lines
2.9 KiB
Java
108 lines
2.9 KiB
Java
package com.mbridge.msdk.newreward.a.c;
|
|
|
|
import android.os.Handler;
|
|
import android.os.HandlerThread;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class a {
|
|
private static volatile a a;
|
|
private Map<String, c> b;
|
|
private Handler c;
|
|
|
|
/* renamed from: com.mbridge.msdk.newreward.a.c.a$a, reason: collision with other inner class name */
|
|
public interface InterfaceC0214a {
|
|
void a(String str, long j);
|
|
}
|
|
|
|
public a() {
|
|
HandlerThread handlerThread = new HandlerThread("MBridgeTimerThread");
|
|
handlerThread.start();
|
|
this.c = new Handler(handlerThread.getLooper());
|
|
this.b = new HashMap();
|
|
}
|
|
|
|
public static a a() {
|
|
if (a == null) {
|
|
synchronized (a.class) {
|
|
try {
|
|
if (a == null) {
|
|
a = new a();
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
public final void a(String str, long j, InterfaceC0214a interfaceC0214a) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("MBridgeTimer", "startTimer taskID: " + str + " timeout: " + j);
|
|
}
|
|
if (this.b.containsKey(str)) {
|
|
return;
|
|
}
|
|
c cVar = new c(new b(str, j), interfaceC0214a);
|
|
this.b.put(str, cVar);
|
|
this.c.postDelayed(cVar, j);
|
|
}
|
|
|
|
public final void a(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
c remove = this.b.remove(str);
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("MBridgeTimer", "stopTimer taskID: " + str);
|
|
}
|
|
if (remove != null) {
|
|
remove.a.c = true;
|
|
this.c.removeCallbacks(remove);
|
|
}
|
|
}
|
|
|
|
public static class c implements Runnable {
|
|
private final b a;
|
|
private final InterfaceC0214a b;
|
|
|
|
public c(b bVar, InterfaceC0214a interfaceC0214a) {
|
|
this.a = bVar;
|
|
this.b = interfaceC0214a;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
InterfaceC0214a interfaceC0214a;
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("MBridgeTimer", "TimerTask run taskID: " + this.a.a + " isStop: " + this.a.c);
|
|
}
|
|
if (this.a.c || (interfaceC0214a = this.b) == null) {
|
|
return;
|
|
}
|
|
try {
|
|
interfaceC0214a.a(this.a.a, this.a.b);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class b {
|
|
private final String a;
|
|
private final long b;
|
|
private boolean c;
|
|
|
|
public b(String str, long j) {
|
|
this.a = str;
|
|
this.b = j;
|
|
}
|
|
}
|
|
}
|