package com.google.android.material.bottomappbar;

import android.content.Context;
import android.graphics.Rect;
import android.support.v4.media.session.b;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.s0;
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.lang.ref.WeakReference;
import vi.k;

/* loaded from: classes3.dex */
public abstract class BottomAppBar extends Toolbar implements CoordinatorLayout.b {

    /* renamed from: j0, reason: collision with root package name */
    private static final int f12886j0 = k.f39902q;

    static /* synthetic */ void R(BottomAppBar bottomAppBar) {
        throw null;
    }

    static /* synthetic */ View S(BottomAppBar bottomAppBar) {
        throw null;
    }

    static /* synthetic */ void T(BottomAppBar bottomAppBar, FloatingActionButton floatingActionButton) {
        throw null;
    }

    /* loaded from: classes3.dex */
    public static class Behavior extends HideBottomViewOnScrollBehavior<BottomAppBar> {

        /* renamed from: e, reason: collision with root package name */
        private final Rect f12887e;

        /* renamed from: f, reason: collision with root package name */
        private WeakReference f12888f;

        /* renamed from: g, reason: collision with root package name */
        private int f12889g;

        /* renamed from: h, reason: collision with root package name */
        private final View.OnLayoutChangeListener f12890h;

        /* loaded from: classes3.dex */
        class a implements View.OnLayoutChangeListener {
            a() {
            }

            @Override // android.view.View.OnLayoutChangeListener
            public void onLayoutChange(View view, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17) {
                b.a(Behavior.this.f12888f.get());
                view.removeOnLayoutChangeListener(this);
            }
        }

        public Behavior() {
            this.f12890h = new a();
            this.f12887e = new Rect();
        }

        @Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public /* bridge */ /* synthetic */ boolean A(CoordinatorLayout coordinatorLayout, View view, View view2, View view3, int i10, int i11) {
            b.a(view);
            return O(coordinatorLayout, null, view2, view3, i10, i11);
        }

        public boolean N(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, int i10) {
            this.f12888f = new WeakReference(bottomAppBar);
            View S = BottomAppBar.S(bottomAppBar);
            if (S != null && !s0.Q(S)) {
                CoordinatorLayout.f fVar = (CoordinatorLayout.f) S.getLayoutParams();
                fVar.f3511d = 49;
                this.f12889g = ((ViewGroup.MarginLayoutParams) fVar).bottomMargin;
                if (S instanceof FloatingActionButton) {
                    FloatingActionButton floatingActionButton = (FloatingActionButton) S;
                    if (floatingActionButton.getShowMotionSpec() == null) {
                        floatingActionButton.setShowMotionSpecResource(vi.a.f39716b);
                    }
                    if (floatingActionButton.getHideMotionSpec() == null) {
                        floatingActionButton.setHideMotionSpecResource(vi.a.f39715a);
                    }
                    floatingActionButton.addOnLayoutChangeListener(this.f12890h);
                    BottomAppBar.T(bottomAppBar, floatingActionButton);
                }
                BottomAppBar.R(bottomAppBar);
            }
            coordinatorLayout.I(bottomAppBar, i10);
            return super.l(coordinatorLayout, bottomAppBar, i10);
        }

        public boolean O(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, View view, View view2, int i10, int i11) {
            throw null;
        }

        @Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public /* bridge */ /* synthetic */ boolean l(CoordinatorLayout coordinatorLayout, View view, int i10) {
            b.a(view);
            return N(coordinatorLayout, null, i10);
        }

        public Behavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.f12890h = new a();
            this.f12887e = new Rect();
        }
    }
}
