package com.skydoves.balloon; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.os.Handler; import android.os.Looper; import android.text.Html; import android.text.Spanned; import android.text.method.MovementMethod; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewParent; import android.view.animation.Animation; import android.widget.FrameLayout; import android.widget.PopupWindow; import android.widget.TextView; import androidx.appcompat.widget.AppCompatImageView; import androidx.core.view.ViewCompat; import androidx.lifecycle.DefaultLifecycleObserver; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.skydoves.balloon.Balloon; import com.skydoves.balloon.overlay.BalloonAnchorOverlayView; import com.skydoves.balloon.radius.RadiusLayout; import com.skydoves.balloon.vectortext.VectorTextView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import kotlin.NoWhenBranchMatchedException; import o.AbstractC14853gaL; import o.AbstractC14961gcz; import o.C12951fML; import o.C12952fMM; import o.C12973fMu; import o.C12992fNe; import o.C14866gag; import o.C14875gap; import o.C14957gcv; import o.C14973gde; import o.C14977gdi; import o.C16034kdZ; import o.EnumC12963fMk; import o.EnumC12965fMm; import o.EnumC12966fMn; import o.EnumC12974fMv; import o.EnumC12975fMw; import o.EnumC12977fMy; import o.EnumC12978fMz; import o.InterfaceC12950fMD; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC16186lzC; import o.InterfaceC16541pFg; import o.RunnableC12964fMl; import o.fMA; import o.fMB; import o.fMC; import o.fME; import o.fMF; import o.fMG; import o.fMH; import o.fMI; import o.fMJ; import o.fMK; import o.fMN; import o.fMQ; import o.fMV; import o.fMW; import o.fZR; import o.fZX; import o.qeC; import o.wdQ; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes5.dex */ public final class Balloon implements DefaultLifecycleObserver { public final fMN a; public final PopupWindow b; final RVV c; final InterfaceC13393fZL d; final InterfaceC13393fZL e; private final Context f; private boolean g; private final InterfaceC13393fZL h; final PopupWindow i; private boolean j; private final C12952fMM m; /* renamed from: o */ private InterfaceC12950fMD f8086o; /* loaded from: classes5.dex */ public static final class HBt implements Runnable { private InterfaceC14890gbN b; private long c; private View e; @Override // java.lang.Runnable public final void run() { if (this.e.isAttachedToWindow()) { View view = this.e; Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, (view.getLeft() + this.e.getRight()) / 2, (this.e.getTop() + this.e.getBottom()) / 2, Math.max(this.e.getWidth(), this.e.getHeight()), BitmapDescriptorFactory.HUE_RED); createCircularReveal.setDuration(this.c); createCircularReveal.start(); createCircularReveal.addListener(new AnimatorListenerAdapter(this.b) { // from class: com.skydoves.balloon.Balloon.HBt.1 private InterfaceC14890gbN a; public AnonymousClass1(InterfaceC14890gbN interfaceC14890gbN) { this.a = interfaceC14890gbN; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { super.onAnimationEnd(animator); this.a.invoke(); } }); } } /* renamed from: com.skydoves.balloon.Balloon$HBt$1 */ /* loaded from: classes5.dex */ public static final class AnonymousClass1 extends AnimatorListenerAdapter { private InterfaceC14890gbN a; public AnonymousClass1(InterfaceC14890gbN interfaceC14890gbN) { this.a = interfaceC14890gbN; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { super.onAnimationEnd(animator); this.a.invoke(); } } public HBt(View view, long j, InterfaceC14890gbN interfaceC14890gbN) { this.e = view; this.c = j; this.b = interfaceC14890gbN; } } /* JADX WARN: Multi-variable type inference failed */ private Balloon(Context context, RVV rvv) { wdQ lifecycle; Spanned spanned; C14866gag c14866gag; this.f = context; this.c = rvv; View inflate = LayoutInflater.from(context).inflate(fMH.RVV.balloon_layout_body, (ViewGroup) null, false); FrameLayout frameLayout = (FrameLayout) inflate; int i = fMH.IeS.balloon_arrow; AppCompatImageView appCompatImageView = (AppCompatImageView) qeC.e(inflate, i); if (appCompatImageView != null) { i = fMH.IeS.balloon_card; RadiusLayout radiusLayout = (RadiusLayout) qeC.e(inflate, i); if (radiusLayout != null) { i = fMH.IeS.balloon_content; FrameLayout frameLayout2 = (FrameLayout) qeC.e(inflate, i); if (frameLayout2 != null) { i = fMH.IeS.balloon_text; VectorTextView vectorTextView = (VectorTextView) qeC.e(inflate, i); if (vectorTextView != null) { i = fMH.IeS.balloon_wrapper; FrameLayout frameLayout3 = (FrameLayout) qeC.e(inflate, i); if (frameLayout3 != null) { fMN fmn = new fMN(frameLayout, frameLayout, appCompatImageView, radiusLayout, frameLayout2, vectorTextView, frameLayout3); C14957gcv.c(fmn, ""); this.a = fmn; View inflate2 = LayoutInflater.from(context).inflate(fMH.RVV.balloon_layout_overlay, (ViewGroup) null, false); if (inflate2 == null) { throw new NullPointerException("rootView"); } BalloonAnchorOverlayView balloonAnchorOverlayView = (BalloonAnchorOverlayView) inflate2; C12952fMM c12952fMM = new C12952fMM(balloonAnchorOverlayView, balloonAnchorOverlayView); C14957gcv.c(c12952fMM, ""); this.m = c12952fMM; PopupWindow popupWindow = new PopupWindow(fmn.f, -2, -2); this.b = popupWindow; PopupWindow popupWindow2 = new PopupWindow(c12952fMM.a, -1, -1); this.i = popupWindow2; this.f8086o = rvv.an; this.d = fZR.e(fZX.NONE, tOB.c); this.e = fZR.e(fZX.NONE, new LWm(this)); this.h = fZR.e(fZX.NONE, new Sts(this)); RadiusLayout radiusLayout2 = fmn.c; radiusLayout2.setAlpha(rvv.a); radiusLayout2.setRadius(rvv.z); ViewCompat.e(radiusLayout2, rvv.K); Drawable drawable = rvv.r; GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setColor(rvv.s); gradientDrawable.setCornerRadius(rvv.z); radiusLayout2.setBackground(gradientDrawable); int i2 = rvv.ax; int i3 = rvv.ay; int i4 = rvv.aB; int i5 = rvv.az; radiusLayout2.setPadding(0, 0, 0, 0); ViewGroup.LayoutParams layoutParams = fmn.j.getLayoutParams(); C14957gcv.d(layoutParams, ""); int i6 = rvv.ag; int i7 = rvv.ad; int i8 = rvv.ae; int i9 = rvv.Y; ((ViewGroup.MarginLayoutParams) layoutParams).setMargins(0, 0, 0, 0); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(rvv.V); popupWindow.setBackgroundDrawable(new ColorDrawable(0)); popupWindow.setElevation(rvv.K); popupWindow.setAttachedInDecor(rvv.P); if (rvv.Z == null) { View view = rvv.ab; VectorTextView vectorTextView2 = fmn.d; fMC fmc = rvv.J; C14957gcv.c(vectorTextView2, ""); Context context2 = vectorTextView2.getContext(); C14957gcv.c(context2, ""); fMC.RVV rvv2 = new fMC.RVV(context2); Drawable drawable2 = rvv.L; rvv2.c = null; rvv2.j = rvv.Q; rvv2.b = rvv.S; rvv2.e = rvv.M; rvv2.h = rvv.R; fMB fmb = rvv.O; C14957gcv.e(fmb, ""); rvv2.d = fmb; fMC fmc2 = new fMC(rvv2, (byte) 0); C14957gcv.e(vectorTextView2, ""); C14957gcv.e(fmc2, ""); if (fmc2.a != null) { int i10 = fmc2.h; int i11 = fmc2.e; int i12 = fmc2.g; Integer valueOf = Integer.valueOf(fmc2.d); C12992fNe c12992fNe = new C12992fNe(null, null, null, null, Integer.valueOf(i12), Integer.valueOf(i10), Integer.valueOf(i11), null, valueOf.intValue() != Integer.MIN_VALUE ? valueOf : null, null, null, null, 119295); int i13 = fMK.Sts.e[fmc2.b.ordinal()]; if (i13 == 1) { c12992fNe.i = fmc2.a; c12992fNe.f = fmc2.c; } else if (i13 == 2) { c12992fNe.j = fmc2.a; c12992fNe.h = fmc2.c; } else if (i13 == 3) { c12992fNe.a = fmc2.a; c12992fNe.d = fmc2.c; } else if (i13 == 4) { c12992fNe.e = fmc2.a; c12992fNe.g = fmc2.c; } vectorTextView2.setDrawableTextViewParams(c12992fNe); } boolean z = rvv.X; C12992fNe c12992fNe2 = vectorTextView2.b; if (c12992fNe2 != null) { c12992fNe2.n = z; fMK.aAX_(vectorTextView2, c12992fNe2); } VectorTextView vectorTextView3 = fmn.d; fMF fmf = rvv.aF; C14957gcv.c(vectorTextView3, ""); VectorTextView vectorTextView4 = vectorTextView3; Context context3 = vectorTextView3.getContext(); C14957gcv.c(context3, ""); fMF.LWm lWm = new fMF.LWm(context3); CharSequence charSequence = rvv.aE; C14957gcv.e(charSequence, ""); lWm.e = charSequence; lWm.g = rvv.aK; lWm.b = rvv.aG; lWm.d = rvv.aL; lWm.a = rvv.aI; int i14 = rvv.aJ; lWm.h = 0; Typeface typeface = rvv.aH; lWm.i = null; vectorTextView3.setMovementMethod(rvv.am); fMF fmf2 = new fMF(lWm, (byte) 0); C14957gcv.e(vectorTextView4, ""); C14957gcv.e(fmf2, ""); boolean z2 = fmf2.d; if (z2) { spanned = Html.fromHtml(fmf2.e.toString(), 0); } else if (!z2) { spanned = fmf2.e; } else { throw new NoWhenBranchMatchedException(); } vectorTextView4.setText(spanned); vectorTextView4.setTextSize(fmf2.i); vectorTextView4.setGravity(fmf2.b); vectorTextView4.setTextColor(fmf2.a); Typeface typeface2 = fmf2.f; if (typeface2 != null) { vectorTextView4.setTypeface(typeface2); c14866gag = C14866gag.c; } else { c14866gag = null; } if (c14866gag == null) { vectorTextView4.setTypeface(vectorTextView4.getTypeface(), fmf2.j); } MovementMethod movementMethod = fmf2.c; if (movementMethod != null) { vectorTextView4.setMovementMethod(movementMethod); } C14957gcv.c(vectorTextView3, ""); RadiusLayout radiusLayout3 = fmn.c; C14957gcv.c(radiusLayout3, ""); aAT_(vectorTextView4, radiusLayout3); } else { Integer num = rvv.Z; if (num != null) { View inflate3 = LayoutInflater.from(context).inflate(num.intValue(), (ViewGroup) fmn.c, false); if (inflate3 != null) { ViewParent parent = inflate3.getParent(); ViewGroup viewGroup = parent instanceof ViewGroup ? (ViewGroup) parent : null; if (viewGroup != null) { viewGroup.removeView(inflate3); } fmn.c.removeAllViews(); fmn.c.addView(inflate3); RadiusLayout radiusLayout4 = fmn.c; C14957gcv.c(radiusLayout4, ""); aAU_(radiusLayout4); } } View view2 = rvv.ab; throw new IllegalArgumentException("The custom layout is null."); } c(); if (rvv.W) { BalloonAnchorOverlayView balloonAnchorOverlayView2 = c12952fMM.d; balloonAnchorOverlayView2.setOverlayColor(rvv.at); balloonAnchorOverlayView2.setOverlayPadding(rvv.au); balloonAnchorOverlayView2.setOverlayPosition(rvv.as); balloonAnchorOverlayView2.setBalloonOverlayShape(rvv.aw); balloonAnchorOverlayView2.setOverlayPaddingColor(rvv.av); popupWindow2.setClippingEnabled(false); } fME fme = rvv.ak; fmn.j.setOnClickListener(new View.OnClickListener(null, this) { // from class: o.fMo private fME b = null; private Balloon e; @Override // android.view.View.OnClickListener public final void onClick(View view3) { Balloon.d(this.b, this.e, view3); } { this.e = this; } }); fMA fma = rvv.ai; popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener(this, 0 == true ? 1 : 0) { // from class: o.fMt private Balloon a; private fMA d = null; @Override // android.widget.PopupWindow.OnDismissListener public final void onDismiss() { Balloon.c(this.a); } { this.a = this; } }); fMI fmi = rvv.ao; popupWindow.setTouchInterceptor(new jbe(this, null)); View.OnTouchListener onTouchListener = rvv.ap; fMJ fmj = rvv.aq; c12952fMM.a.setOnClickListener(new View.OnClickListener(0 == true ? 1 : 0, this) { // from class: o.fMq private Balloon b; private fMJ d = null; @Override // android.view.View.OnClickListener public final void onClick(View view3) { Balloon.b(this.b); } { this.b = this; } }); View.OnTouchListener onTouchListener2 = rvv.ar; FrameLayout frameLayout4 = fmn.f; C14957gcv.c(frameLayout4, ""); aAS_(frameLayout4); if (rvv.ac == null && (context instanceof InterfaceC16541pFg)) { rvv.ac = (InterfaceC16541pFg) context; wdQ lifecycle2 = ((InterfaceC16541pFg) context).getLifecycle(); InterfaceC16186lzC interfaceC16186lzC = rvv.aa; lifecycle2.e(this); return; } InterfaceC16541pFg interfaceC16541pFg = rvv.ac; if (interfaceC16541pFg == null || (lifecycle = interfaceC16541pFg.getLifecycle()) == null) { return; } InterfaceC16186lzC interfaceC16186lzC2 = rvv.aa; lifecycle.e(this); return; } } } } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i))); } public static final /* synthetic */ Handler aAP_(Balloon balloon) { return (Handler) balloon.d.e(); } public static final /* synthetic */ void c(Balloon balloon, View view) { AppCompatImageView appCompatImageView = balloon.a.a; appCompatImageView.setLayoutParams(new FrameLayout.LayoutParams(balloon.c.m, balloon.c.m)); appCompatImageView.setAlpha(balloon.c.a); Drawable drawable = balloon.c.i; int i = balloon.c.g; int i2 = balloon.c.q; int i3 = balloon.c.k; int i4 = balloon.c.b; appCompatImageView.setPadding(0, 0, 0, 0); if (balloon.c.e != Integer.MIN_VALUE) { C16034kdZ.vs_(appCompatImageView, ColorStateList.valueOf(balloon.c.e)); } else { C16034kdZ.vs_(appCompatImageView, ColorStateList.valueOf(balloon.c.s)); } appCompatImageView.setOutlineProvider(ViewOutlineProvider.BOUNDS); balloon.a.c.post(new Runnable(balloon, view, appCompatImageView) { // from class: o.fMp private AppCompatImageView a; private Balloon c; private View d; @Override // java.lang.Runnable public final void run() { Balloon.d(this.c, this.d, this.a); } { this.c = balloon; this.d = view; this.a = appCompatImageView; } }); } public static final /* synthetic */ void d(Balloon balloon) { if (balloon.c.x == Integer.MIN_VALUE) { int i = IeS.d[balloon.c.t.ordinal()]; if (i == 1) { balloon.b.setAnimationStyle(fMH.LWm.Balloon_Elastic_Anim); return; } if (i == 2) { View contentView = balloon.b.getContentView(); C14957gcv.c(contentView, ""); long j = balloon.c.A; C14957gcv.e(contentView, ""); contentView.setVisibility(4); contentView.post(new Runnable(contentView, j) { // from class: o.fMU private View b; private long c; @Override // java.lang.Runnable public final void run() { View view = this.b; long j2 = this.c; C14957gcv.e(view, ""); if (view.isAttachedToWindow()) { view.setVisibility(0); Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, (view.getLeft() + view.getRight()) / 2, (view.getTop() + view.getBottom()) / 2, BitmapDescriptorFactory.HUE_RED, Math.max(view.getWidth(), view.getHeight())); createCircularReveal.setDuration(j2); createCircularReveal.start(); } } { this.b = contentView; this.c = j; } }); balloon.b.setAnimationStyle(fMH.LWm.Balloon_Normal_Dispose_Anim); return; } if (i == 3) { balloon.b.setAnimationStyle(fMH.LWm.Balloon_Fade_Anim); return; } else if (i == 4) { balloon.b.setAnimationStyle(fMH.LWm.Balloon_Overshoot_Anim); return; } else { if (i == 5) { balloon.b.setAnimationStyle(fMH.LWm.Balloon_Normal_Anim); return; } return; } } balloon.b.setAnimationStyle(balloon.c.x); } public static final /* synthetic */ void e(Balloon balloon, View... viewArr) { if (balloon.c.W) { View view = viewArr[0]; if (viewArr.length == 1) { balloon.m.d.setAnchorView(view); } else { balloon.m.d.setAnchorViewList(C14875gap.d(viewArr)); } balloon.i.showAtLocation(view, 17, 0, 0); } } public static final /* synthetic */ void h(Balloon balloon) { if (balloon.c.C == Integer.MIN_VALUE) { if (IeS.c[balloon.c.v.ordinal()] == 1) { balloon.i.setAnimationStyle(fMH.LWm.Balloon_Fade_Anim); return; } else { balloon.i.setAnimationStyle(fMH.LWm.Balloon_Normal_Anim); return; } } balloon.i.setAnimationStyle(balloon.c.x); } public static final /* synthetic */ RunnableC12964fMl j(Balloon balloon) { return (RunnableC12964fMl) balloon.e.e(); } public static final /* synthetic */ boolean k(Balloon balloon) { if (balloon.c.Z != null) { return true; } View view = balloon.c.ab; return false; } public static final /* synthetic */ void l(Balloon balloon) { boolean z = balloon.c.aA; } public static final /* synthetic */ void n(Balloon balloon) { balloon.a.b.post(new Runnable(balloon) { // from class: o.fMr private Balloon b; @Override // java.lang.Runnable public final void run() { Balloon.a(this.b); } { this.b = balloon; } }); } private final void aAS_(ViewGroup viewGroup) { Iterable c14973gde; viewGroup.setFitsSystemWindows(false); int childCount = viewGroup.getChildCount(); if (childCount <= Integer.MIN_VALUE) { C14973gde.LWm lWm = C14973gde.c; c14973gde = C14973gde.f; } else { c14973gde = new C14973gde(0, childCount - 1); } Iterable iterable = c14973gde; C14957gcv.e(iterable, ""); ArrayList arrayList = new ArrayList(iterable instanceof Collection ? ((Collection) iterable).size() : 10); Iterator it = iterable.iterator(); while (it.hasNext()) { arrayList.add(viewGroup.getChildAt(((AbstractC14853gaL) it).a())); } for (View view : arrayList) { view.setFitsSystemWindows(false); if (view instanceof ViewGroup) { aAS_((ViewGroup) view); } } } private final float d(View view) { FrameLayout frameLayout = this.a.e; C14957gcv.c(frameLayout, ""); int i = C12951fML.aAY_(frameLayout).x; int i2 = C12951fML.aAY_(view).x; float e = e(); float d = d(); int i3 = this.c.ae; int i4 = this.c.ag; int i5 = IeS.e[this.c.n.ordinal()]; if (i5 == 1) { return (this.a.j.getWidth() * this.c.l) - (this.c.m * 0.5f); } if (i5 == 2) { if (view.getWidth() + i2 < i) { return e; } if (d() + i >= i2) { float width = (((view.getWidth() * this.c.l) + i2) - i) - (this.c.m * 0.5f); if (width <= (this.c.m << 1)) { return e; } if (width <= d() - (this.c.m << 1)) { return width; } } return d - e; } throw new NoWhenBranchMatchedException(); } /* loaded from: classes5.dex */ public static final class ZqN implements Runnable { private View a; private View[] b; private View d; private Balloon f; private Balloon h; private int c = 0; private int e = 0; @Override // java.lang.Runnable public final void run() { int measuredHeight; int measuredHeight2; Boolean valueOf = Boolean.valueOf(this.f.a(this.a)); if (!valueOf.booleanValue()) { valueOf = null; } if (valueOf != null) { String str = this.f.c.aD; this.f.j = true; long j = this.f.c.p; if (j != -1) { Balloon balloon = this.f; ((Handler) balloon.d.e()).postDelayed((RunnableC12964fMl) balloon.e.e(), j); } if (Balloon.k(this.f)) { Balloon balloon2 = this.f; RadiusLayout radiusLayout = balloon2.a.c; C14957gcv.c(radiusLayout, ""); balloon2.aAU_(radiusLayout); } else { Balloon balloon3 = this.f; VectorTextView vectorTextView = balloon3.a.d; C14957gcv.c(vectorTextView, ""); RadiusLayout radiusLayout2 = this.f.a.c; C14957gcv.c(radiusLayout2, ""); balloon3.aAT_(vectorTextView, radiusLayout2); } this.f.a.f.measure(0, 0); this.f.b.setWidth(this.f.d()); PopupWindow popupWindow = this.f.b; Balloon balloon4 = this.f; if (balloon4.c.N == Integer.MIN_VALUE) { measuredHeight = balloon4.a.f.getMeasuredHeight(); } else { measuredHeight = balloon4.c.N; } popupWindow.setHeight(measuredHeight); this.f.a.d.setLayoutParams(new FrameLayout.LayoutParams(-1, -1)); Balloon.c(this.f, this.a); this.f.c(); Balloon.h(this.f); Balloon balloon5 = this.f; View[] viewArr = this.b; Balloon.e(balloon5, (View[]) Arrays.copyOf(viewArr, viewArr.length)); Balloon.l(this.f); Balloon.d(this.f); Balloon.n(this.f); PopupWindow popupWindow2 = this.h.b; View view = this.d; int i = this.h.c.aC; int measuredWidth = this.d.getMeasuredWidth() / 2; int d = this.h.d() / 2; Balloon balloon6 = this.h; if (balloon6.c.N == Integer.MIN_VALUE) { measuredHeight2 = balloon6.a.f.getMeasuredHeight(); } else { measuredHeight2 = balloon6.c.N; } popupWindow2.showAsDropDown(view, i * (measuredWidth - d), (-measuredHeight2) - this.d.getMeasuredHeight()); } } public ZqN(Balloon balloon, View view, View[] viewArr, Balloon balloon2, View view2) { this.f = balloon; this.a = view; this.b = viewArr; this.h = balloon2; this.d = view2; } } public static /* synthetic */ void a(Balloon balloon, View view) { C14957gcv.e(view, ""); View[] viewArr = {view}; if (!balloon.a(view)) { boolean z = balloon.c.I; } else { view.post(new ZqN(balloon, view, viewArr, balloon, view)); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes5.dex */ public static final class tOB extends AbstractC14961gcz implements InterfaceC14890gbN { public static final tOB c = new tOB(); @Override // o.InterfaceC14890gbN public final /* synthetic */ Handler invoke() { return new Handler(Looper.getMainLooper()); } tOB() { super(0); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes5.dex */ public static final class LWm extends AbstractC14961gcz implements InterfaceC14890gbN { private Balloon c; @Override // o.InterfaceC14890gbN public final /* synthetic */ RunnableC12964fMl invoke() { return new RunnableC12964fMl(this.c); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ LWm(Balloon balloon) { super(0); this.c = balloon; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes5.dex */ public static final class Sts extends AbstractC14961gcz implements InterfaceC14890gbN { private Balloon d; @Override // o.InterfaceC14890gbN public final /* synthetic */ C12973fMu invoke() { return C12973fMu.a.a(this.d.f); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ Sts(Balloon balloon) { super(0); this.d = balloon; } } /* loaded from: classes5.dex */ public static final class ojQ extends AbstractC14961gcz implements InterfaceC14890gbN { private Balloon c; @Override // o.InterfaceC14890gbN public final /* synthetic */ C14866gag invoke() { this.c.j = false; this.c.b.dismiss(); this.c.i.dismiss(); Balloon.aAP_(this.c).removeCallbacks(Balloon.j(this.c)); return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ ojQ(Balloon balloon) { super(0); this.c = balloon; } } public final void b() { if (this.j) { ojQ ojq = new ojQ(this); if (this.c.t == EnumC12975fMw.CIRCULAR) { View contentView = this.b.getContentView(); C14957gcv.c(contentView, ""); contentView.post(new HBt(contentView, this.c.A, ojq)); return; } ojq.invoke(); } } /* loaded from: classes5.dex */ public static final class jbe implements View.OnTouchListener { private Balloon c; private fMI e = null; jbe(Balloon balloon, fMI fmi) { this.c = balloon; } @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { C14957gcv.e(view, ""); C14957gcv.e(motionEvent, ""); if (motionEvent.getAction() != 4) { return false; } if (!this.c.c.F) { return true; } this.c.b(); return true; } } public final void aAT_(TextView textView, View view) { int intrinsicWidth; int compoundPaddingStart; int compoundPaddingEnd; int measureText = (int) textView.getPaint().measureText(textView.getText().toString()); Drawable[] compoundDrawablesRelative = textView.getCompoundDrawablesRelative(); C14957gcv.c(compoundDrawablesRelative, ""); C14957gcv.e(compoundDrawablesRelative, ""); if (compoundDrawablesRelative[0] != null || compoundDrawablesRelative[2] != null) { Drawable[] compoundDrawablesRelative2 = textView.getCompoundDrawablesRelative(); C14957gcv.c(compoundDrawablesRelative2, ""); C14957gcv.e(compoundDrawablesRelative2, ""); Drawable drawable = compoundDrawablesRelative2[0]; int intrinsicHeight = drawable != null ? drawable.getIntrinsicHeight() : 0; Drawable drawable2 = compoundDrawablesRelative2[2]; int intrinsicHeight2 = drawable2 != null ? drawable2.getIntrinsicHeight() : 0; if (intrinsicHeight < intrinsicHeight2) { intrinsicHeight = intrinsicHeight2; } textView.setMinHeight(intrinsicHeight); Drawable[] compoundDrawablesRelative3 = textView.getCompoundDrawablesRelative(); C14957gcv.c(compoundDrawablesRelative3, ""); C14957gcv.e(compoundDrawablesRelative3, ""); Drawable drawable3 = compoundDrawablesRelative3[0]; int intrinsicWidth2 = drawable3 != null ? drawable3.getIntrinsicWidth() : 0; Drawable drawable4 = compoundDrawablesRelative3[2]; intrinsicWidth = intrinsicWidth2 + (drawable4 != null ? drawable4.getIntrinsicWidth() : 0); compoundPaddingStart = textView.getCompoundPaddingStart(); compoundPaddingEnd = textView.getCompoundPaddingEnd(); } else { Drawable[] compoundDrawables = textView.getCompoundDrawables(); C14957gcv.c(compoundDrawables, ""); C14957gcv.e(compoundDrawables, ""); if (compoundDrawables[0] != null || compoundDrawables[2] != null) { Drawable[] compoundDrawables2 = textView.getCompoundDrawables(); C14957gcv.c(compoundDrawables2, ""); C14957gcv.e(compoundDrawables2, ""); Drawable drawable5 = compoundDrawables2[0]; int intrinsicHeight3 = drawable5 != null ? drawable5.getIntrinsicHeight() : 0; Drawable drawable6 = compoundDrawables2[2]; int intrinsicHeight4 = drawable6 != null ? drawable6.getIntrinsicHeight() : 0; if (intrinsicHeight3 < intrinsicHeight4) { intrinsicHeight3 = intrinsicHeight4; } textView.setMinHeight(intrinsicHeight3); Drawable[] compoundDrawables3 = textView.getCompoundDrawables(); C14957gcv.c(compoundDrawables3, ""); C14957gcv.e(compoundDrawables3, ""); Drawable drawable7 = compoundDrawables3[0]; int intrinsicWidth3 = drawable7 != null ? drawable7.getIntrinsicWidth() : 0; Drawable drawable8 = compoundDrawables3[2]; intrinsicWidth = intrinsicWidth3 + (drawable8 != null ? drawable8.getIntrinsicWidth() : 0); compoundPaddingStart = textView.getCompoundPaddingStart(); compoundPaddingEnd = textView.getCompoundPaddingEnd(); } textView.setMaxWidth(b(measureText, view)); } measureText += intrinsicWidth + compoundPaddingStart + compoundPaddingEnd; textView.setMaxWidth(b(measureText, view)); } @Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR public final void onPause(InterfaceC16541pFg interfaceC16541pFg) { C14957gcv.e(interfaceC16541pFg, ""); super.onPause(interfaceC16541pFg); boolean z = this.c.H; } @Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR public final void onDestroy(InterfaceC16541pFg interfaceC16541pFg) { wdQ lifecycle; C14957gcv.e(interfaceC16541pFg, ""); super.onDestroy(interfaceC16541pFg); this.g = true; this.i.dismiss(); this.b.dismiss(); InterfaceC16541pFg interfaceC16541pFg2 = this.c.ac; if (interfaceC16541pFg2 == null || (lifecycle = interfaceC16541pFg2.getLifecycle()) == null) { return; } lifecycle.a(this); } /* loaded from: classes5.dex */ public static final class RVV { long A; fMG B; int C; public final Context D; boolean E; public boolean F; boolean G; boolean H; boolean I; fMC J; float K; Drawable L; int M; public int N; fMB O; boolean P; int Q; int R; int S; boolean T; boolean U; public boolean V; public boolean W; boolean X; int Y; public Integer Z; float a; boolean aA; int aB; int aC; String aD; CharSequence aE; fMF aF; int aG; Typeface aH; int aI; int aJ; float aK; public boolean aL; float aO; private int aP; public int aQ; InterfaceC16186lzC aa; View ab; public InterfaceC16541pFg ac; int ad; int ae; float af; int ag; int ah; fMA ai; int aj; fME ak; float al; MovementMethod am; InterfaceC12950fMD an; fMI ao; View.OnTouchListener ap; fMJ aq; View.OnTouchListener ar; Point as; public int at; float au; int av; public fMW aw; int ax; int ay; int az; int b; float c; int d; int e; EnumC12965fMm f; int g; float h; Drawable i; boolean j; int k; public float l; public int m; EnumC12966fMn n; /* renamed from: o */ EnumC12963fMk f8087o; public long p; int q; Drawable r; public int s; public EnumC12975fMw t; long u; fMQ v; int w; int x; EnumC12977fMy y; public float z; public RVV(Context context) { C14957gcv.e(context, ""); this.D = context; this.aQ = PKIFailureInfo.systemUnavail; this.ah = new Point(Resources.getSystem().getDisplayMetrics().widthPixels, Resources.getSystem().getDisplayMetrics().heightPixels).x; this.N = PKIFailureInfo.systemUnavail; this.T = true; this.e = PKIFailureInfo.systemUnavail; float applyDimension = TypedValue.applyDimension(1, 12.0f, Resources.getSystem().getDisplayMetrics()); if (!Float.isNaN(applyDimension)) { this.m = Math.round(applyDimension); this.l = 0.5f; this.n = EnumC12966fMn.ALIGN_BALLOON; this.f8087o = EnumC12963fMk.ALIGN_ANCHOR; this.f = EnumC12965fMm.BOTTOM; this.c = 2.5f; this.s = -16777216; this.z = TypedValue.applyDimension(1, 5.0f, Resources.getSystem().getDisplayMetrics()); this.aE = ""; this.aG = -1; this.aK = 12.0f; this.aI = 17; this.O = fMB.START; float applyDimension2 = TypedValue.applyDimension(1, 28.0f, Resources.getSystem().getDisplayMetrics()); if (!Float.isNaN(applyDimension2)) { this.Q = Math.round(applyDimension2); float applyDimension3 = TypedValue.applyDimension(1, 28.0f, Resources.getSystem().getDisplayMetrics()); if (!Float.isNaN(applyDimension3)) { this.S = Math.round(applyDimension3); float applyDimension4 = TypedValue.applyDimension(1, 8.0f, Resources.getSystem().getDisplayMetrics()); if (!Float.isNaN(applyDimension4)) { this.R = Math.round(applyDimension4); this.M = PKIFailureInfo.systemUnavail; this.a = 1.0f; this.K = TypedValue.applyDimension(1, 2.0f, Resources.getSystem().getDisplayMetrics()); this.aw = fMV.b; this.F = true; this.G = true; this.p = -1L; this.x = PKIFailureInfo.systemUnavail; this.C = PKIFailureInfo.systemUnavail; this.t = EnumC12975fMw.FADE; this.v = fMQ.FADE; this.A = 500L; this.y = EnumC12977fMy.NONE; this.w = PKIFailureInfo.systemUnavail; this.aP = 1; boolean z = context.getResources().getConfiguration().getLayoutDirection() == 1; this.X = z; this.aC = z ? -1 : 1; this.V = true; this.U = true; this.P = true; return; } throw new IllegalArgumentException("Cannot round NaN value."); } throw new IllegalArgumentException("Cannot round NaN value."); } throw new IllegalArgumentException("Cannot round NaN value."); } throw new IllegalArgumentException("Cannot round NaN value."); } } public final boolean a(View view) { if (!this.j && !this.g) { Context context = this.f; if ((!(context instanceof Activity) || !((Activity) context).isFinishing()) && this.b.getContentView().getParent() == null && ViewCompat.H(view)) { return true; } } return false; } public final int d() { int i = new Point(Resources.getSystem().getDisplayMetrics().widthPixels, Resources.getSystem().getDisplayMetrics().heightPixels).x; float f = this.c.aO; float f2 = this.c.al; float f3 = this.c.af; if (this.c.aQ == Integer.MIN_VALUE) { return C14977gdi.e(this.a.f.getMeasuredWidth(), this.c.aj, this.c.ah); } int i2 = this.c.aQ; return i2 > i ? i : i2; } public final void aAU_(ViewGroup viewGroup) { int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View childAt = viewGroup.getChildAt(i); C14957gcv.a(childAt, ""); if (childAt instanceof TextView) { aAT_((TextView) childAt, viewGroup); } else if (childAt instanceof ViewGroup) { aAU_((ViewGroup) childAt); } } } private final int b(int i, View view) { int i2 = new Point(Resources.getSystem().getDisplayMetrics().widthPixels, Resources.getSystem().getDisplayMetrics().heightPixels).x; int paddingLeft = view.getPaddingLeft(); int paddingRight = view.getPaddingRight(); Drawable drawable = this.c.L; int i3 = this.c.ae; int i4 = this.c.ag; int i5 = paddingLeft + paddingRight + (this.c.m << 1); int i6 = this.c.ah; float f = this.c.aO; float f2 = this.c.al; float f3 = this.c.af; if (this.c.aQ != Integer.MIN_VALUE && this.c.aQ <= i2) { return this.c.aQ - i5; } int i7 = i6 - i5; return i > i7 ? i7 : i; } public static /* synthetic */ void d(fME fme, Balloon balloon, View view) { C14957gcv.e(balloon, ""); if (fme != null) { C14957gcv.c(view, ""); } boolean z = balloon.c.E; } public static /* synthetic */ void d(Balloon balloon, View view, AppCompatImageView appCompatImageView) { C14957gcv.e(balloon, ""); C14957gcv.e(view, ""); C14957gcv.e(appCompatImageView, ""); if (balloon.f8086o != null) { C14957gcv.c(balloon.a.c, ""); } if (balloon.c.f8087o != EnumC12963fMk.ALIGN_FIXED) { Rect rect = new Rect(); view.getGlobalVisibleRect(rect); int[] iArr = {0, 0}; balloon.b.getContentView().getLocationOnScreen(iArr); if (balloon.c.f == EnumC12965fMm.TOP && iArr[1] < rect.bottom) { RVV rvv = balloon.c; EnumC12965fMm enumC12965fMm = EnumC12965fMm.BOTTOM; C14957gcv.e(enumC12965fMm, ""); rvv.f = enumC12965fMm; } else if (balloon.c.f == EnumC12965fMm.BOTTOM && iArr[1] > rect.top) { RVV rvv2 = balloon.c; EnumC12965fMm enumC12965fMm2 = EnumC12965fMm.TOP; C14957gcv.e(enumC12965fMm2, ""); rvv2.f = enumC12965fMm2; } balloon.c(); } EnumC12965fMm.IeS ieS = EnumC12965fMm.Companion; int i = IeS.b[EnumC12965fMm.IeS.d(balloon.c.f, balloon.c.X).ordinal()]; if (i == 1) { appCompatImageView.setRotation(180.0f); appCompatImageView.setX(balloon.d(view)); appCompatImageView.setY((balloon.a.c.getY() + balloon.a.c.getHeight()) - 1.0f); ViewCompat.e(appCompatImageView, balloon.c.h); boolean z = balloon.c.j; } else if (i == 2) { appCompatImageView.setRotation(BitmapDescriptorFactory.HUE_RED); appCompatImageView.setX(balloon.d(view)); appCompatImageView.setY((balloon.a.c.getY() - balloon.c.m) + 1.0f); boolean z2 = balloon.c.j; } else if (i == 3) { appCompatImageView.setRotation(-90.0f); appCompatImageView.setX((balloon.a.c.getX() - balloon.c.m) + 1.0f); appCompatImageView.setY(balloon.c(view)); boolean z3 = balloon.c.j; } else if (i == 4) { appCompatImageView.setRotation(90.0f); appCompatImageView.setX((balloon.a.c.getX() + balloon.a.c.getWidth()) - 1.0f); appCompatImageView.setY(balloon.c(view)); boolean z4 = balloon.c.j; } AppCompatImageView appCompatImageView2 = appCompatImageView; boolean z5 = balloon.c.T; C14957gcv.e(appCompatImageView2, ""); appCompatImageView2.setVisibility(z5 ? 0 : 8); } public static /* synthetic */ void c(Balloon balloon) { C14957gcv.e(balloon, ""); FrameLayout frameLayout = balloon.a.b; Animation animation = frameLayout.getAnimation(); if (animation != null) { C14957gcv.c(animation, ""); animation.cancel(); animation.reset(); } frameLayout.clearAnimation(); balloon.b(); } public static /* synthetic */ void b(Balloon balloon) { C14957gcv.e(balloon, ""); if (balloon.c.G) { balloon.b(); } } public static /* synthetic */ void a(Balloon balloon) { C14957gcv.e(balloon, ""); Handler handler = new Handler(Looper.getMainLooper()); Runnable runnable = new Runnable(balloon) { // from class: o.fMs private Balloon c; @Override // java.lang.Runnable public final void run() { Balloon.e(this.c); } { this.c = balloon; } }; long j = balloon.c.u; handler.postDelayed(runnable, 0L); } /* JADX WARN: Removed duplicated region for block: B:11:0x0092 */ /* JADX WARN: Removed duplicated region for block: B:14:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static /* synthetic */ void e(com.skydoves.balloon.Balloon r6) { /* java.lang.String r0 = "" o.C14957gcv.e(r6, r0) com.skydoves.balloon.Balloon$RVV r0 = r6.c int r0 = r0.w r1 = -2147483648(0xffffffff80000000, float:-0.0) if (r0 != r1) goto L86 com.skydoves.balloon.Balloon$RVV r0 = r6.c o.fMy r0 = r0.y int[] r1 = com.skydoves.balloon.Balloon.IeS.a int r0 = r0.ordinal() r0 = r1[r0] r1 = 4 r2 = 3 r3 = 2 r4 = 1 if (r0 == r4) goto L57 if (r0 == r3) goto L31 if (r0 == r2) goto L2e r2 = 0 if (r0 == r1) goto L28 goto L90 L28: com.skydoves.balloon.Balloon$RVV r0 = r6.c o.fMG r0 = r0.B goto L90 L2e: int r0 = o.fMH.HBt.balloon_fade goto L8a L31: com.skydoves.balloon.Balloon$RVV r0 = r6.c o.fMm r0 = r0.f int[] r5 = com.skydoves.balloon.Balloon.IeS.b int r0 = r0.ordinal() r0 = r5[r0] if (r0 == r4) goto L54 if (r0 == r3) goto L51 if (r0 == r2) goto L4e if (r0 != r1) goto L48 int r0 = o.fMH.HBt.balloon_shake_left goto L8a L48: kotlin.NoWhenBranchMatchedException r6 = new kotlin.NoWhenBranchMatchedException r6.() throw r6 L4e: int r0 = o.fMH.HBt.balloon_shake_right goto L8a L51: int r0 = o.fMH.HBt.balloon_shake_bottom goto L8a L54: int r0 = o.fMH.HBt.balloon_shake_top goto L8a L57: com.skydoves.balloon.Balloon$RVV r0 = r6.c boolean r0 = r0.T if (r0 == 0) goto L83 com.skydoves.balloon.Balloon$RVV r0 = r6.c o.fMm r0 = r0.f int[] r5 = com.skydoves.balloon.Balloon.IeS.b int r0 = r0.ordinal() r0 = r5[r0] if (r0 == r4) goto L80 if (r0 == r3) goto L7d if (r0 == r2) goto L7a if (r0 != r1) goto L74 int r0 = o.fMH.HBt.balloon_heartbeat_left goto L8a L74: kotlin.NoWhenBranchMatchedException r6 = new kotlin.NoWhenBranchMatchedException r6.() throw r6 L7a: int r0 = o.fMH.HBt.balloon_heartbeat_right goto L8a L7d: int r0 = o.fMH.HBt.balloon_heartbeat_bottom goto L8a L80: int r0 = o.fMH.HBt.balloon_heartbeat_top goto L8a L83: int r0 = o.fMH.HBt.balloon_heartbeat_center goto L8a L86: com.skydoves.balloon.Balloon$RVV r0 = r6.c int r0 = r0.w L8a: android.content.Context r1 = r6.f android.view.animation.Animation r2 = android.view.animation.AnimationUtils.loadAnimation(r1, r0) L90: if (r2 == 0) goto L99 o.fMN r6 = r6.a android.widget.FrameLayout r6 = r6.b r6.startAnimation(r2) L99: return */ throw new UnsupportedOperationException("Method not decompiled: com.skydoves.balloon.Balloon.e(com.skydoves.balloon.Balloon):void"); } private final float c(View view) { int d = C12951fML.d(view, this.c.U); FrameLayout frameLayout = this.a.e; C14957gcv.c(frameLayout, ""); int i = C12951fML.aAY_(frameLayout).y - d; int i2 = C12951fML.aAY_(view).y - d; float e = e(); float measuredHeight = this.c.N != Integer.MIN_VALUE ? this.c.N : this.a.f.getMeasuredHeight(); int i3 = this.c.ad; int i4 = this.c.Y; int i5 = this.c.m / 2; int i6 = IeS.e[this.c.n.ordinal()]; if (i6 == 1) { return (this.a.j.getHeight() * this.c.l) - i5; } if (i6 != 2) { throw new NoWhenBranchMatchedException(); } if (view.getHeight() + i2 < i) { return e; } if ((this.c.N != Integer.MIN_VALUE ? this.c.N : this.a.f.getMeasuredHeight()) + i >= i2) { float height = (((view.getHeight() * this.c.l) + i2) - i) - i5; if (height <= (this.c.m << 1)) { return e; } if (height <= (this.c.N != Integer.MIN_VALUE ? this.c.N : this.a.f.getMeasuredHeight()) - (this.c.m << 1)) { return height; } } return measuredHeight - e; } private final float e() { float f = this.c.m * this.c.c; int i = this.c.d; return f + BitmapDescriptorFactory.HUE_RED; } public final void c() { int i = this.c.m - 1; int i2 = (int) this.c.K; FrameLayout frameLayout = this.a.e; int i3 = IeS.b[this.c.f.ordinal()]; if (i3 == 1) { frameLayout.setPadding(i2, i, i2, i < i2 ? i2 : i); return; } if (i3 == 2) { frameLayout.setPadding(i2, i, i2, i < i2 ? i2 : i); } else if (i3 == 3) { frameLayout.setPadding(i, i2, i, i2); } else if (i3 == 4) { frameLayout.setPadding(i, i2, i, i2); } } /* loaded from: classes5.dex */ public final /* synthetic */ class IeS { public static final int[] a; public static final int[] b; public static final int[] c; public static final int[] d; public static final int[] e; static { int[] iArr = new int[EnumC12965fMm.values().length]; iArr[EnumC12965fMm.BOTTOM.ordinal()] = 1; iArr[EnumC12965fMm.TOP.ordinal()] = 2; iArr[EnumC12965fMm.START.ordinal()] = 3; iArr[EnumC12965fMm.END.ordinal()] = 4; b = iArr; int[] iArr2 = new int[EnumC12966fMn.values().length]; iArr2[EnumC12966fMn.ALIGN_BALLOON.ordinal()] = 1; iArr2[EnumC12966fMn.ALIGN_ANCHOR.ordinal()] = 2; e = iArr2; int[] iArr3 = new int[EnumC12975fMw.values().length]; iArr3[EnumC12975fMw.ELASTIC.ordinal()] = 1; iArr3[EnumC12975fMw.CIRCULAR.ordinal()] = 2; iArr3[EnumC12975fMw.FADE.ordinal()] = 3; iArr3[EnumC12975fMw.OVERSHOOT.ordinal()] = 4; iArr3[EnumC12975fMw.NONE.ordinal()] = 5; d = iArr3; int[] iArr4 = new int[fMQ.values().length]; iArr4[fMQ.FADE.ordinal()] = 1; c = iArr4; int[] iArr5 = new int[EnumC12977fMy.values().length]; iArr5[EnumC12977fMy.HEARTBEAT.ordinal()] = 1; iArr5[EnumC12977fMy.SHAKE.ordinal()] = 2; iArr5[EnumC12977fMy.BREATH.ordinal()] = 3; iArr5[EnumC12977fMy.ROTATE.ordinal()] = 4; a = iArr5; int[] iArr6 = new int[EnumC12978fMz.values().length]; iArr6[EnumC12978fMz.TOP.ordinal()] = 1; iArr6[EnumC12978fMz.BOTTOM.ordinal()] = 2; iArr6[EnumC12978fMz.START.ordinal()] = 3; iArr6[EnumC12978fMz.END.ordinal()] = 4; int[] iArr7 = new int[EnumC12974fMv.values().length]; iArr7[EnumC12974fMv.TOP.ordinal()] = 1; iArr7[EnumC12974fMv.BOTTOM.ordinal()] = 2; iArr7[EnumC12974fMv.END.ordinal()] = 3; iArr7[EnumC12974fMv.START.ordinal()] = 4; } } public /* synthetic */ Balloon(Context context, RVV rvv, byte b) { this(context, rvv); } }