- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
67 lines
1.8 KiB
Java
67 lines
1.8 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.net.NetworkInfo;
|
|
import android.os.Bundle;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class bg extends BroadcastReceiver {
|
|
private final List a = Collections.synchronizedList(new ArrayList());
|
|
|
|
public interface a {
|
|
void a();
|
|
|
|
void b();
|
|
}
|
|
|
|
public bg(Context context) {
|
|
context.getApplicationContext().registerReceiver(this, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
|
|
}
|
|
|
|
public void b(a aVar) {
|
|
this.a.remove(aVar);
|
|
}
|
|
|
|
@Override // android.content.BroadcastReceiver
|
|
public void onReceive(Context context, Intent intent) {
|
|
if (intent.getAction() == null || !intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE") || isInitialStickyBroadcast()) {
|
|
return;
|
|
}
|
|
ArrayList arrayList = new ArrayList(this.a);
|
|
if (a(intent)) {
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
((a) it.next()).a();
|
|
}
|
|
} else {
|
|
Iterator it2 = arrayList.iterator();
|
|
while (it2.hasNext()) {
|
|
((a) it2.next()).b();
|
|
}
|
|
}
|
|
}
|
|
|
|
private static boolean a(Intent intent) {
|
|
Bundle extras = intent.getExtras();
|
|
if (extras == null) {
|
|
return false;
|
|
}
|
|
Object obj = extras.get("networkInfo");
|
|
if (obj instanceof NetworkInfo) {
|
|
return ((NetworkInfo) obj).isConnected();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void a(a aVar) {
|
|
this.a.add(aVar);
|
|
}
|
|
}
|