package com.applovin.impl; import android.app.Activity; import android.content.Context; import com.applovin.sdk.AppLovinSdkUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /* loaded from: classes.dex */ public class x4 extends ec { private com.applovin.impl.sdk.j f; private List g; private final AtomicBoolean h; private List i; public enum a { RECENT_ADS, COUNT } @Override // com.applovin.impl.ec public int b() { return a.COUNT.ordinal(); } @Override // com.applovin.impl.ec public List c(int i) { return this.i; } public List d() { return this.g; } public com.applovin.impl.sdk.j e() { return this.f; } public String toString() { return "CreativeDebuggerListAdapter{isInitialized=" + this.h.get() + "}"; } public x4(Context context) { super(context); this.h = new AtomicBoolean(); this.i = new ArrayList(); } public void g() { this.h.compareAndSet(true, false); } public boolean f() { return this.i.size() == 0; } @Override // com.applovin.impl.ec public dc e(int i) { return new fj("RECENT ADS"); } private List a(List list) { ArrayList arrayList = new ArrayList(list.size()); Iterator it = list.iterator(); while (it.hasNext()) { arrayList.add(new v6((w6) it.next(), this.a)); } return arrayList; } @Override // com.applovin.impl.ec public int d(int i) { return this.i.size(); } public void a(List list, com.applovin.impl.sdk.j jVar) { Activity n0; this.f = jVar; this.g = list; if (!(this.a instanceof Activity) && (n0 = jVar.n0()) != null) { this.a = n0; } if (list != null && this.h.compareAndSet(false, true)) { this.i = a(this.g); } AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.x4$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { x4.this.notifyDataSetChanged(); } }); } }