package com.google.android.material.transformation; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewTreeObserver; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.ViewCompat; import java.util.List; import o.rxp; @Deprecated /* loaded from: classes2.dex */ public abstract class ExpandableBehavior extends CoordinatorLayout.Sts { int d; protected abstract boolean a(View view, View view2, boolean z, boolean z2); public ExpandableBehavior() { this.d = 0; } public ExpandableBehavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.d = 0; } /* JADX WARN: Multi-variable type inference failed */ @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public final boolean c(CoordinatorLayout coordinatorLayout, View view, int i) { rxp rxpVar; if (!ViewCompat.G(view)) { List c = coordinatorLayout.c(view); int size = c.size(); int i2 = 0; while (true) { if (i2 >= size) { rxpVar = null; break; } View view2 = c.get(i2); if (e(view, view2)) { rxpVar = (rxp) view2; break; } i2++; } if (rxpVar != null && b(rxpVar.e())) { int i3 = rxpVar.e() ? 1 : 2; this.d = i3; view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(this, view, i3, rxpVar) { // from class: com.google.android.material.transformation.ExpandableBehavior.4 private int b; private rxp c; private View d; private ExpandableBehavior e; { this.e = this; this.d = view; this.b = i3; this.c = rxpVar; } /* JADX WARN: Multi-variable type inference failed */ @Override // android.view.ViewTreeObserver.OnPreDrawListener public final boolean onPreDraw() { this.d.getViewTreeObserver().removeOnPreDrawListener(this); if (this.e.d == this.b) { ExpandableBehavior expandableBehavior = this.e; rxp rxpVar2 = this.c; expandableBehavior.a((View) rxpVar2, this.d, rxpVar2.e(), false); } return false; } }); } } return false; } /* JADX WARN: Multi-variable type inference failed */ @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public final boolean e(CoordinatorLayout coordinatorLayout, View view, View view2) { rxp rxpVar = (rxp) view2; if (!b(rxpVar.e())) { return false; } this.d = rxpVar.e() ? 1 : 2; return a((View) rxpVar, view, rxpVar.e(), true); } private boolean b(boolean z) { if (!z) { return this.d == 1; } int i = this.d; return i == 0 || i == 2; } }