package com.fyber.inneractive.sdk.ui; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.Color; import android.text.TextUtils; import android.util.Property; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import com.fyber.inneractive.sdk.R; import com.fyber.inneractive.sdk.config.IAConfigManager; import com.fyber.inneractive.sdk.config.global.features.a; import com.fyber.inneractive.sdk.config.global.s; import com.fyber.inneractive.sdk.network.h0; import com.fyber.inneractive.sdk.ui.IFyberAdIdentifier; import com.fyber.inneractive.sdk.util.IAlog; import com.fyber.inneractive.sdk.util.o; /* loaded from: classes2.dex */ public class FyberAdIdentifierLocal extends IFyberAdIdentifier implements View.OnClickListener { public ImageView n; public TextView o; public boolean p; public Animator q; public float r; public Bitmap s; public static /* synthetic */ class a { public static final /* synthetic */ int[] a; static { int[] iArr = new int[IFyberAdIdentifier.Corner.values().length]; a = iArr; try { iArr[IFyberAdIdentifier.Corner.TOP_LEFT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[IFyberAdIdentifier.Corner.TOP_RIGHT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[IFyberAdIdentifier.Corner.BOTTOM_LEFT.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[IFyberAdIdentifier.Corner.BOTTOM_RIGHT.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } } } public FyberAdIdentifierLocal(Context context, s sVar) { super(context, sVar); this.p = false; this.r = 0.0f; } @Override // com.fyber.inneractive.sdk.ui.IFyberAdIdentifier public final void a(ViewGroup viewGroup) { ViewGroup viewGroup2 = (ViewGroup) viewGroup.findViewById(R.id.ia_identifier_overlay); ViewGroup viewGroup3 = (ViewGroup) LayoutInflater.from(this.b).inflate(R.layout.ia_layout_fyber_ad_identifier, (ViewGroup) View.inflate(this.b, R.layout.ia_layout_fyber_ad_identifier_relative, null), false); this.n = (ImageView) viewGroup3.findViewById(R.id.ia_fyber_identifier_image); TextView textView = (TextView) viewGroup3.findViewById(R.id.ia_fyber_identifier_text); this.o = textView; if (this.k) { o.a(textView, this.c, this.d); o.a(this.n, this.e, this.f); TextView textView2 = this.o; int i = this.g; if (textView2 instanceof TextView) { textView2.setTextSize(i); } a(this.n, this.h); this.o.setOnClickListener(this); this.o.setText(this.i); String str = this.j; if (!TextUtils.isEmpty(str)) { IAConfigManager.L.r.a(new h0(new com.fyber.inneractive.sdk.ui.a(this), viewGroup2.getContext(), new com.fyber.inneractive.sdk.cache.b(str))); } } IFyberAdIdentifier.Corner corner = this.l; if (corner == IFyberAdIdentifier.Corner.TOP_LEFT || corner == IFyberAdIdentifier.Corner.BOTTOM_LEFT) { viewGroup3.removeView(this.o); viewGroup3.addView(this.o); } viewGroup3.addOnLayoutChangeListener(new b(this)); this.n.setOnClickListener(this); a(); viewGroup2.addView(viewGroup3); ViewGroup.LayoutParams layoutParams = viewGroup3.getLayoutParams(); if (layoutParams instanceof FrameLayout.LayoutParams) { FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams; int i2 = a.a[this.l.ordinal()]; layoutParams2.gravity = i2 != 1 ? i2 != 2 ? i2 != 3 ? 85 : 83 : 53 : 51; } } @Override // android.view.View.OnClickListener public final void onClick(View view) { if (view != this.n) { if (view == this.o && this.m == a.EnumC0063a.OPEN) { a(); IFyberAdIdentifier.ClickListener clickListener = this.a; if (clickListener != null) { clickListener.a(); return; } return; } return; } if (this.q != null) { return; } AnimatorSet animatorSet = new AnimatorSet(); ImageView imageView = this.n; Property property = View.ROTATION_X; ObjectAnimator ofFloat = ObjectAnimator.ofFloat(imageView, (Property) property, 90.0f); ObjectAnimator ofInt = ObjectAnimator.ofInt(this.n, "imageAlpha", 255, 25); AnimatorSet animatorSet2 = new AnimatorSet(); animatorSet2.playTogether(ofFloat, ofInt); animatorSet2.addListener(new c(this, animatorSet)); animatorSet2.setDuration(225L); this.q = animatorSet2; animatorSet2.start(); ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.n, (Property) property, 0.0f); ObjectAnimator ofInt2 = ObjectAnimator.ofInt(this.n, "imageAlpha", 25, 255); AnimatorSet animatorSet3 = new AnimatorSet(); animatorSet3.playTogether(ofFloat2, ofInt2); animatorSet3.setDuration(225L); TextView textView = this.o; Property property2 = View.TRANSLATION_X; float[] fArr = new float[1]; fArr[0] = this.p ? this.r : 0.0f; ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(textView, (Property) property2, fArr); ofFloat3.setDuration(450L); animatorSet.setDuration(450L); animatorSet.playTogether(ofFloat3, animatorSet3); animatorSet.addListener(new d(this)); } public final void a() { this.p = false; this.o.setTranslationX(0.0f); this.n.setImageResource(R.drawable.ia_fyber_info_button); a(this.n, this.h); Animator animator = this.q; if (animator != null) { animator.removeAllListeners(); this.q = null; } } public static void a(ImageView imageView, String str) { if (!TextUtils.isEmpty(str)) { try { com.fyber.inneractive.sdk.widget.a.a(imageView, ColorStateList.valueOf(Color.parseColor(str))); return; } catch (Exception unused) { IAlog.f("could not parse color %s", str); return; } } com.fyber.inneractive.sdk.widget.a.a(imageView, null); } }