- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
155 lines
5.7 KiB
Java
155 lines
5.7 KiB
Java
package com.fyber.inneractive.sdk.util;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.graphics.Rect;
|
|
import android.util.Pair;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewTreeObserver;
|
|
import com.fyber.inneractive.sdk.util.l;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.WeakHashMap;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class b0 {
|
|
public final WeakHashMap<Context, WeakHashMap<View, d>> b = new WeakHashMap<>();
|
|
public final WeakHashMap a = new WeakHashMap();
|
|
public final l<Rect> c = new l<>(16, new a());
|
|
public final l<HashSet<View>> d = new l<>(16, new b());
|
|
|
|
public class a implements l.a<Rect> {
|
|
@Override // com.fyber.inneractive.sdk.util.l.a
|
|
public final Rect a() {
|
|
return new Rect();
|
|
}
|
|
}
|
|
|
|
public class b implements l.a<HashSet<View>> {
|
|
@Override // com.fyber.inneractive.sdk.util.l.a
|
|
public final HashSet<View> a() {
|
|
return new HashSet<>();
|
|
}
|
|
}
|
|
|
|
public static class c {
|
|
public static final b0 a = new b0();
|
|
}
|
|
|
|
public interface d {
|
|
void a(float f, Rect rect);
|
|
}
|
|
|
|
public static b0 b() {
|
|
return c.a;
|
|
}
|
|
|
|
public final void a(Context context, ViewGroup viewGroup, d dVar) {
|
|
View rootView;
|
|
ViewTreeObserver viewTreeObserver;
|
|
IAlog.a("%strackView called with context: %s view: %s", "IAVisibilityTracker: ", context, viewGroup);
|
|
if (context == null) {
|
|
throw new IllegalStateException("View must be attached to an Activity context");
|
|
}
|
|
Context applicationContext = context.getApplicationContext();
|
|
WeakHashMap<View, d> weakHashMap = this.b.get(applicationContext);
|
|
if (weakHashMap == null) {
|
|
weakHashMap = new WeakHashMap<>();
|
|
this.b.put(applicationContext, weakHashMap);
|
|
if (context instanceof Activity) {
|
|
Activity activity = (Activity) context;
|
|
if (activity.getWindow() != null) {
|
|
rootView = activity.getWindow().getDecorView();
|
|
viewTreeObserver = rootView.getViewTreeObserver();
|
|
if (viewTreeObserver != null && viewTreeObserver.isAlive()) {
|
|
c0 c0Var = new c0(this, applicationContext);
|
|
viewTreeObserver.addOnPreDrawListener(c0Var);
|
|
this.a.put(applicationContext, new Pair(viewTreeObserver, c0Var));
|
|
}
|
|
}
|
|
}
|
|
rootView = viewGroup.getRootView();
|
|
viewTreeObserver = rootView.getViewTreeObserver();
|
|
if (viewTreeObserver != null) {
|
|
c0 c0Var2 = new c0(this, applicationContext);
|
|
viewTreeObserver.addOnPreDrawListener(c0Var2);
|
|
this.a.put(applicationContext, new Pair(viewTreeObserver, c0Var2));
|
|
}
|
|
}
|
|
weakHashMap.put(viewGroup, dVar);
|
|
c();
|
|
}
|
|
|
|
public final void c() {
|
|
for (Context context : this.b.keySet()) {
|
|
IAlog.a("%stracking context: %s", "IAVisibilityTracker: ", context);
|
|
WeakHashMap<View, d> weakHashMap = this.b.get(context);
|
|
if (weakHashMap != null) {
|
|
Iterator<View> it = weakHashMap.keySet().iterator();
|
|
while (it.hasNext()) {
|
|
IAlog.a("%stracking view: %s", "IAVisibilityTracker: ", it.next());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a(ViewGroup viewGroup) {
|
|
IAlog.a("%sunTrackView called with view", "IAVisibilityTracker: ");
|
|
if (viewGroup == null) {
|
|
IAlog.a("%sunTrackView called with a null view!", "IAVisibilityTracker: ");
|
|
return;
|
|
}
|
|
Context context = viewGroup.getContext();
|
|
if (context == null) {
|
|
IAlog.a("%sview.getContext() returned null!", "IAVisibilityTracker: ");
|
|
return;
|
|
}
|
|
WeakHashMap<View, d> weakHashMap = this.b.get(context);
|
|
if (weakHashMap != null) {
|
|
a(context, weakHashMap, viewGroup);
|
|
} else {
|
|
Iterator it = new HashSet(this.b.keySet()).iterator();
|
|
while (it.hasNext()) {
|
|
Context context2 = (Context) it.next();
|
|
WeakHashMap<View, d> weakHashMap2 = this.b.get(context2);
|
|
if (weakHashMap2 != null) {
|
|
a(context2, weakHashMap2, viewGroup);
|
|
}
|
|
}
|
|
}
|
|
c();
|
|
}
|
|
|
|
public final void a(Context context, Map map, ViewGroup viewGroup) {
|
|
if (map.remove(viewGroup) != null) {
|
|
if (IAlog.a <= 2) {
|
|
IAlog.e("removeViewFromContext found view for removal!", new Object[0]);
|
|
}
|
|
if (map.isEmpty()) {
|
|
this.b.remove(context);
|
|
Pair pair = (Pair) this.a.get(context);
|
|
if (pair != null) {
|
|
if (((ViewTreeObserver) pair.first).isAlive()) {
|
|
((ViewTreeObserver) pair.first).removeOnPreDrawListener((ViewTreeObserver.OnPreDrawListener) pair.second);
|
|
}
|
|
this.a.remove(context);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
this.b.clear();
|
|
Iterator it = this.a.keySet().iterator();
|
|
while (it.hasNext()) {
|
|
Pair pair = (Pair) this.a.get((Context) it.next());
|
|
if (pair != null && ((ViewTreeObserver) pair.first).isAlive()) {
|
|
((ViewTreeObserver) pair.first).removeOnPreDrawListener((ViewTreeObserver.OnPreDrawListener) pair.second);
|
|
}
|
|
}
|
|
this.a.clear();
|
|
}
|
|
}
|