package com.mbridge.msdk.dycreator.baseview; import android.animation.Animator; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.FrameLayout; import androidx.annotation.Nullable; import com.fyber.inneractive.sdk.external.InneractiveMediationDefs; import com.mbridge.msdk.dycreator.a.b; import com.mbridge.msdk.dycreator.baseview.inter.InterBase; import com.mbridge.msdk.dycreator.baseview.inter.InterEffect; import com.mbridge.msdk.dycreator.e.a; import com.mbridge.msdk.dycreator.e.c; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.same.report.k; import com.mbridge.msdk.foundation.tools.af; import java.util.HashMap; import java.util.Map; /* loaded from: classes4.dex */ public class MBFrameLayout extends FrameLayout implements InterBase, InterEffect { private Animator a; private Map b; private Map c; private String d; @Override // com.mbridge.msdk.dycreator.baseview.inter.InterEffect public void setAnimator(Animator animator) { this.a = animator; } public MBFrameLayout(Context context, AttributeSet attributeSet) { super(context); this.d = ""; try { this.b = c.a(context, attributeSet); a.a(this, attributeSet); setLayoutParams(generateLayoutParams(attributeSet)); c.a(this.b, this); } catch (Exception e) { af.b("MBFrameLayout", e.getMessage()); } } @Override // android.view.ViewGroup, android.view.View public void onAttachedToWindow() { super.onAttachedToWindow(); try { Animator animator = this.a; if (animator != null) { animator.start(); } } catch (Exception e) { af.b("MBFrameLayout", e.getMessage()); } Map map = this.c; if (map != null && map.containsKey("mbridgeAttached") && this.c.get("mbridgeAttached").booleanValue()) { new k.a("mbridgeAttached").a().a(this.d); } } @Override // android.view.ViewGroup, android.view.View public void onDetachedFromWindow() { super.onDetachedFromWindow(); try { Animator animator = this.a; if (animator != null) { animator.cancel(); } } catch (Exception e) { af.b("MBFrameLayout", e.getMessage()); } Map map = this.c; if (map != null && map.containsKey("mbridgeDetached") && this.c.get("mbridgeDetached").booleanValue()) { new k.a("mbridgeDetached").a().a(this.d); } } @Override // android.view.View public void setOnClickListener(@Nullable View.OnClickListener onClickListener) { super.setOnClickListener(onClickListener); } @Override // android.widget.FrameLayout, android.view.ViewGroup public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) { FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(0, 0); HashMap b = b.a().b(); layoutParams.width = -2; layoutParams.height = -2; int attributeCount = attributeSet.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { com.mbridge.msdk.dycreator.a.c cVar = (com.mbridge.msdk.dycreator.a.c) b.get(attributeSet.getAttributeName(i)); if (cVar != null) { int i2 = AnonymousClass1.a[cVar.ordinal()]; if (i2 == 1) { String attributeValue = attributeSet.getAttributeValue(i); if (attributeValue.startsWith(InneractiveMediationDefs.GENDER_FEMALE) || attributeValue.startsWith(InneractiveMediationDefs.GENDER_MALE)) { layoutParams.width = -1; } else if (attributeValue.startsWith("w")) { layoutParams.width = -2; } else { layoutParams.width = b.a().b(attributeValue); } } else if (i2 == 2) { String attributeValue2 = attributeSet.getAttributeValue(i); if (attributeValue2.startsWith(InneractiveMediationDefs.GENDER_FEMALE) || attributeValue2.startsWith(InneractiveMediationDefs.GENDER_MALE)) { layoutParams.width = -1; } else if (attributeValue2.startsWith("w")) { layoutParams.width = -2; } else { layoutParams.height = b.a().b(attributeValue2); } } else if (i2 == 3) { layoutParams.gravity = b.a().c(attributeSet.getAttributeValue(i)); } else if (i2 == 4) { layoutParams.leftMargin = b.a().b(attributeSet.getAttributeValue(i)); } else if (i2 == 5) { int b2 = b.a().b(attributeSet.getAttributeValue(i)); layoutParams.setMargins(b2, b2, b2, b2); } } } return layoutParams; } /* renamed from: com.mbridge.msdk.dycreator.baseview.MBFrameLayout$1, reason: invalid class name */ public static /* synthetic */ class AnonymousClass1 { static final /* synthetic */ int[] a; static { int[] iArr = new int[com.mbridge.msdk.dycreator.a.c.values().length]; a = iArr; try { iArr[com.mbridge.msdk.dycreator.a.c.layout_width.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[com.mbridge.msdk.dycreator.a.c.layout_height.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[com.mbridge.msdk.dycreator.a.c.layout_gravity.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[com.mbridge.msdk.dycreator.a.c.layout_marginLeft.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { a[com.mbridge.msdk.dycreator.a.c.layout_margin.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } } } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public String getBindDataDes() { Map map = this.b; return (map == null || !map.containsKey("mbridgeData")) ? "" : this.b.get("mbridgeData"); } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public String getActionDes() { Map map = this.b; return (map == null || !map.containsKey("mbridgeAction")) ? "" : this.b.get("mbridgeAction"); } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public String getStrategyDes() { Map map = this.b; return (map == null || !map.containsKey("mbridgeStrategy")) ? "" : this.b.get("mbridgeStrategy"); } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public String getEffectDes() { Map map = this.b; return (map == null || !map.containsKey("mbridgeEffect")) ? "" : this.b.get("mbridgeEffect"); } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public String getReportDes() { Map map = this.b; return (map == null || !map.containsKey("mbridgeReport")) ? "" : this.b.get("mbridgeReport"); } @Override // com.mbridge.msdk.dycreator.baseview.inter.InterBase public void setDynamicReport(String str, CampaignEx campaignEx) { this.c = c.a(str); if (campaignEx != null) { this.d = campaignEx.getCampaignUnitId(); } } }