package b.a.n; import android.view.View; import android.view.WindowManager; import androidx.core.view.ViewCompat; import com.discord.overlay.OverlayManager; import com.discord.overlay.views.OverlayBubbleWrap; import d0.z.d.m; import kotlin.jvm.functions.Function1; /* compiled from: OverlayManager.kt */ public final class d implements View.OnClickListener { public final /* synthetic */ OverlayManager j; public final /* synthetic */ Function1 k; public final /* synthetic */ OverlayBubbleWrap l; public final /* synthetic */ Object m; /* compiled from: OverlayManager.kt */ public static final class a implements View.OnAttachStateChangeListener { public final /* synthetic */ d j; /* compiled from: View.kt */ /* renamed from: b.a.n.d$a$a reason: collision with other inner class name */ public static final class View$OnLayoutChangeListenerC0028a implements View.OnLayoutChangeListener { public final /* synthetic */ a j; public final /* synthetic */ View k; public View$OnLayoutChangeListenerC0028a(a aVar, View view) { this.j = aVar; this.k = view; } @Override // android.view.View.OnLayoutChangeListener public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) { m.checkNotNullParameter(view, "view"); view.removeOnLayoutChangeListener(this); View findViewWithTag = this.k.findViewWithTag(this.j.j.m); m.checkNotNullExpressionValue(findViewWithTag, "v.findViewWithTag(anchorViewTag)"); this.j.j.l.b(findViewWithTag); } } public a(d dVar) { this.j = dVar; } @Override // android.view.View.OnAttachStateChangeListener public void onViewAttachedToWindow(View view) { m.checkNotNullParameter(view, "v"); if (!ViewCompat.isLaidOut(view) || view.isLayoutRequested()) { view.addOnLayoutChangeListener(new View$OnLayoutChangeListenerC0028a(this, view)); return; } View findViewWithTag = view.findViewWithTag(this.j.m); m.checkNotNullExpressionValue(findViewWithTag, "v.findViewWithTag(anchorViewTag)"); this.j.l.b(findViewWithTag); } @Override // android.view.View.OnAttachStateChangeListener public void onViewDetachedFromWindow(View view) { if (ViewCompat.isAttachedToWindow(this.j.l)) { this.j.l.setBubbleTouchable(true); this.j.l.a(true); } } } public d(OverlayManager overlayManager, Function1 function1, OverlayBubbleWrap overlayBubbleWrap, Object obj) { this.j = overlayManager; this.k = function1; this.l = overlayBubbleWrap; this.m = obj; } @Override // android.view.View.OnClickListener public final void onClick(View view) { OverlayBubbleWrap overlayBubbleWrap = (OverlayBubbleWrap) this.k.invoke(this.l); overlayBubbleWrap.addOnAttachStateChangeListener(new a(this)); this.j.a(overlayBubbleWrap); this.l.setBubbleTouchable(false); this.j.f2725s.removeViewImmediate(this.l); WindowManager windowManager = this.j.f2725s; OverlayBubbleWrap overlayBubbleWrap2 = this.l; windowManager.addView(overlayBubbleWrap2, overlayBubbleWrap2.getWindowLayoutParams()); } }