package com.google.android.material.floatingactionbutton;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.ifpdos.udi.service.core.pc.R;
import d.h.j.y;
import g.e.a.a.c.j;
import g.e.a.a.q.d;
import g.e.a.a.q.f;
import g.e.a.a.q.g;
import g.e.a.a.r.p;
import g.e.a.a.w.n;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: loaded from: classes.dex */
public class FloatingActionButton extends p implements g.e.a.a.p.a, n, CoordinatorLayout.b {

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public ColorStateList f1123m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public PorterDuff.Mode f1124n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public ColorStateList f1125o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public PorterDuff.Mode f1126p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public ColorStateList f1127q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f1128r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f1129s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public int f1130t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public boolean f1131u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public d f1132v;

    public static class BaseBehavior<T extends FloatingActionButton> extends CoordinatorLayout.c<T> {
        public Rect a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public boolean f1133b;

        public BaseBehavior() {
            this.f1133b = true;
        }

        public BaseBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, g.e.a.a.b.f3543h);
            this.f1133b = typedArrayObtainStyledAttributes.getBoolean(0, true);
            typedArrayObtainStyledAttributes.recycle();
        }

        public boolean B(FloatingActionButton floatingActionButton, Rect rect) {
            Objects.requireNonNull(floatingActionButton);
            floatingActionButton.getLeft();
            throw null;
        }

        public final boolean C(View view, FloatingActionButton floatingActionButton) {
            return this.f1133b && ((CoordinatorLayout.f) floatingActionButton.getLayoutParams()).f642f == view.getId() && floatingActionButton.getUserSetVisibility() == 0;
        }

        public final boolean D(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, FloatingActionButton floatingActionButton) {
            if (!C(appBarLayout, floatingActionButton)) {
                return false;
            }
            if (this.a == null) {
                this.a = new Rect();
            }
            Rect rect = this.a;
            g.e.a.a.r.d.a(coordinatorLayout, appBarLayout, rect);
            if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) {
                floatingActionButton.i(null, false);
                return true;
            }
            floatingActionButton.m(null, false);
            return true;
        }

        public final boolean E(View view, FloatingActionButton floatingActionButton) {
            if (!C(view, floatingActionButton)) {
                return false;
            }
            if (view.getTop() < (floatingActionButton.getHeight() / 2) + ((ViewGroup.MarginLayoutParams) ((CoordinatorLayout.f) floatingActionButton.getLayoutParams())).topMargin) {
                floatingActionButton.i(null, false);
                return true;
            }
            floatingActionButton.m(null, false);
            return true;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public /* bridge */ /* synthetic */ boolean a(CoordinatorLayout coordinatorLayout, View view, Rect rect) {
            return B((FloatingActionButton) view, rect);
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public void f(CoordinatorLayout.f fVar) {
            if (fVar.f644h == 0) {
                fVar.f644h = 80;
            }
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean g(CoordinatorLayout coordinatorLayout, View view, View view2) {
            FloatingActionButton floatingActionButton = (FloatingActionButton) view;
            if (view2 instanceof AppBarLayout) {
                D(coordinatorLayout, (AppBarLayout) view2, floatingActionButton);
            } else {
                ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
                if (layoutParams instanceof CoordinatorLayout.f ? ((CoordinatorLayout.f) layoutParams).a instanceof BottomSheetBehavior : false) {
                    E(view2, floatingActionButton);
                }
            }
            return false;
        }

        @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.c
        public boolean k(CoordinatorLayout coordinatorLayout, View view, int i2) {
            FloatingActionButton floatingActionButton = (FloatingActionButton) view;
            List<View> listD = coordinatorLayout.d(floatingActionButton);
            int size = listD.size();
            for (int i3 = 0; i3 < size; i3++) {
                View view2 = listD.get(i3);
                if (!(view2 instanceof AppBarLayout)) {
                    ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
                    if ((layoutParams instanceof CoordinatorLayout.f ? ((CoordinatorLayout.f) layoutParams).a instanceof BottomSheetBehavior : false) && E(view2, floatingActionButton)) {
                        break;
                    }
                } else {
                    if (D(coordinatorLayout, (AppBarLayout) view2, floatingActionButton)) {
                        break;
                    }
                }
            }
            coordinatorLayout.r(floatingActionButton, i2);
            return true;
        }
    }

    public static class Behavior extends BaseBehavior<FloatingActionButton> {
        public Behavior() {
        }

        public Behavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }
    }

    public static abstract class a {
        public void a(FloatingActionButton floatingActionButton) {
        }

        public void b(FloatingActionButton floatingActionButton) {
        }
    }

    public class b implements g.e.a.a.v.b {
        public b() {
        }
    }

    public class c<T extends FloatingActionButton> implements d.e {
        public final j<T> a;

        public c(j<T> jVar) {
            this.a = jVar;
        }

        @Override // g.e.a.a.q.d.e
        public void a() {
            this.a.b(FloatingActionButton.this);
        }

        @Override // g.e.a.a.q.d.e
        public void b() {
            this.a.a(FloatingActionButton.this);
        }

        public boolean equals(Object obj) {
            return (obj instanceof c) && ((c) obj).a.equals(this.a);
        }

        public int hashCode() {
            return this.a.hashCode();
        }
    }

    private d getImpl() {
        if (this.f1132v == null) {
            this.f1132v = new g(this, new b());
        }
        return this.f1132v;
    }

    @Override // g.e.a.a.p.a
    public boolean a() {
        throw null;
    }

    public void d(Animator.AnimatorListener animatorListener) {
        d impl = getImpl();
        if (impl.f3759x == null) {
            impl.f3759x = new ArrayList<>();
        }
        impl.f3759x.add(null);
    }

    @Override // android.widget.ImageView, android.view.View
    public void drawableStateChanged() {
        super.drawableStateChanged();
        getImpl().i(getDrawableState());
    }

    public void e(Animator.AnimatorListener animatorListener) {
        d impl = getImpl();
        if (impl.f3758w == null) {
            impl.f3758w = new ArrayList<>();
        }
        impl.f3758w.add(animatorListener);
    }

    public void f(j<? extends FloatingActionButton> jVar) {
        d impl = getImpl();
        c cVar = new c(null);
        if (impl.f3760y == null) {
            impl.f3760y = new ArrayList<>();
        }
        impl.f3760y.add(cVar);
    }

    @Deprecated
    public boolean g(Rect rect) {
        AtomicInteger atomicInteger = y.a;
        if (!y.f.c(this)) {
            return false;
        }
        rect.set(0, 0, getWidth(), getHeight());
        throw null;
    }

    @Override // android.view.View
    public ColorStateList getBackgroundTintList() {
        return this.f1123m;
    }

    @Override // android.view.View
    public PorterDuff.Mode getBackgroundTintMode() {
        return this.f1124n;
    }

    @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.b
    public CoordinatorLayout.c<FloatingActionButton> getBehavior() {
        return new Behavior();
    }

    public float getCompatElevation() {
        return getImpl().c();
    }

    public float getCompatHoveredFocusedTranslationZ() {
        return getImpl().f3747l;
    }

    public float getCompatPressedTranslationZ() {
        return getImpl().f3748m;
    }

    public Drawable getContentBackground() {
        Objects.requireNonNull(getImpl());
        return null;
    }

    public int getCustomSize() {
        return this.f1129s;
    }

    public int getExpandedComponentIdHint() {
        throw null;
    }

    public g.e.a.a.c.g getHideMotionSpec() {
        return getImpl().f3754s;
    }

    @Deprecated
    public int getRippleColor() {
        ColorStateList colorStateList = this.f1127q;
        if (colorStateList != null) {
            return colorStateList.getDefaultColor();
        }
        return 0;
    }

    public ColorStateList getRippleColorStateList() {
        return this.f1127q;
    }

    public g.e.a.a.w.j getShapeAppearanceModel() {
        g.e.a.a.w.j jVar = getImpl().f3743h;
        Objects.requireNonNull(jVar);
        return jVar;
    }

    public g.e.a.a.c.g getShowMotionSpec() {
        return getImpl().f3753r;
    }

    public int getSize() {
        return this.f1128r;
    }

    public int getSizeDimension() {
        return h(this.f1128r);
    }

    public ColorStateList getSupportBackgroundTintList() {
        return getBackgroundTintList();
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        return getBackgroundTintMode();
    }

    public ColorStateList getSupportImageTintList() {
        return this.f1125o;
    }

    public PorterDuff.Mode getSupportImageTintMode() {
        return this.f1126p;
    }

    public boolean getUseCompatPadding() {
        return this.f1131u;
    }

    public final int h(int i2) {
        int i3 = this.f1129s;
        if (i3 != 0) {
            return i3;
        }
        Resources resources = getResources();
        if (i2 != -1) {
            return resources.getDimensionPixelSize(i2 != 1 ? R.dimen.design_fab_size_normal : R.dimen.design_fab_size_mini);
        }
        return Math.max(resources.getConfiguration().screenWidthDp, resources.getConfiguration().screenHeightDp) < 470 ? h(1) : h(0);
    }

    public void i(a aVar, boolean z2) {
        d impl = getImpl();
        g.e.a.a.q.a aVar2 = aVar == null ? null : new g.e.a.a.q.a(this, aVar);
        if (impl.e()) {
            return;
        }
        Animator animator = impl.f3752q;
        if (animator != null) {
            animator.cancel();
        }
        if (!impl.p()) {
            impl.f3761z.b(z2 ? 8 : 4, z2);
            if (aVar2 != null) {
                aVar2.a.a(aVar2.f3731b);
                return;
            }
            return;
        }
        g.e.a.a.c.g gVar = impl.f3754s;
        if (gVar == null) {
            if (impl.f3751p == null) {
                impl.f3751p = g.e.a.a.c.g.b(impl.f3761z.getContext(), R.animator.design_fab_hide_motion_spec);
            }
            gVar = impl.f3751p;
            Objects.requireNonNull(gVar);
        }
        AnimatorSet animatorSetA = impl.a(gVar, 0.0f, 0.0f, 0.0f);
        animatorSetA.addListener(new g.e.a.a.q.b(impl, z2, aVar2));
        ArrayList<Animator.AnimatorListener> arrayList = impl.f3759x;
        if (arrayList != null) {
            Iterator<Animator.AnimatorListener> it = arrayList.iterator();
            while (it.hasNext()) {
                animatorSetA.addListener(it.next());
            }
        }
        animatorSetA.start();
    }

    public boolean j() {
        return getImpl().e();
    }

    @Override // android.widget.ImageView, android.view.View
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        getImpl().g();
    }

    public boolean k() {
        return getImpl().f();
    }

    public final void l() {
        Drawable drawable = getDrawable();
        if (drawable == null) {
            return;
        }
        ColorStateList colorStateList = this.f1125o;
        if (colorStateList == null) {
            drawable.clearColorFilter();
            return;
        }
        int colorForState = colorStateList.getColorForState(getDrawableState(), 0);
        PorterDuff.Mode mode = this.f1126p;
        if (mode == null) {
            mode = PorterDuff.Mode.SRC_IN;
        }
        drawable.mutate().setColorFilter(d.b.g.j.c(colorForState, mode));
    }

    public void m(a aVar, boolean z2) {
        d impl = getImpl();
        g.e.a.a.q.a aVar2 = aVar == null ? null : new g.e.a.a.q.a(this, aVar);
        if (impl.f()) {
            return;
        }
        Animator animator = impl.f3752q;
        if (animator != null) {
            animator.cancel();
        }
        if (!impl.p()) {
            impl.f3761z.b(0, z2);
            impl.f3761z.setAlpha(1.0f);
            impl.f3761z.setScaleY(1.0f);
            impl.f3761z.setScaleX(1.0f);
            impl.m(1.0f);
            if (aVar2 != null) {
                aVar2.a.b(aVar2.f3731b);
                return;
            }
            return;
        }
        if (impl.f3761z.getVisibility() != 0) {
            impl.f3761z.setAlpha(0.0f);
            impl.f3761z.setScaleY(0.0f);
            impl.f3761z.setScaleX(0.0f);
            impl.m(0.0f);
        }
        g.e.a.a.c.g gVar = impl.f3753r;
        if (gVar == null) {
            if (impl.f3750o == null) {
                impl.f3750o = g.e.a.a.c.g.b(impl.f3761z.getContext(), R.animator.design_fab_show_motion_spec);
            }
            gVar = impl.f3750o;
            Objects.requireNonNull(gVar);
        }
        AnimatorSet animatorSetA = impl.a(gVar, 1.0f, 1.0f, 1.0f);
        animatorSetA.addListener(new g.e.a.a.q.c(impl, z2, aVar2));
        ArrayList<Animator.AnimatorListener> arrayList = impl.f3758w;
        if (arrayList != null) {
            Iterator<Animator.AnimatorListener> it = arrayList.iterator();
            while (it.hasNext()) {
                animatorSetA.addListener(it.next());
            }
        }
        animatorSetA.start();
    }

    @Override // android.widget.ImageView, android.view.View
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        d impl = getImpl();
        Objects.requireNonNull(impl);
        if (!(impl instanceof g)) {
            ViewTreeObserver viewTreeObserver = impl.f3761z.getViewTreeObserver();
            if (impl.F == null) {
                impl.F = new f(impl);
            }
            viewTreeObserver.addOnPreDrawListener(impl.F);
        }
    }

    @Override // android.widget.ImageView, android.view.View
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        d impl = getImpl();
        ViewTreeObserver viewTreeObserver = impl.f3761z.getViewTreeObserver();
        ViewTreeObserver.OnPreDrawListener onPreDrawListener = impl.F;
        if (onPreDrawListener != null) {
            viewTreeObserver.removeOnPreDrawListener(onPreDrawListener);
            impl.F = null;
        }
    }

    @Override // android.widget.ImageView, android.view.View
    public void onMeasure(int i2, int i3) {
        this.f1130t = (getSizeDimension() + 0) / 2;
        getImpl().s();
        throw null;
    }

    @Override // android.view.View
    public void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof g.e.a.a.y.a)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        g.e.a.a.y.a aVar = (g.e.a.a.y.a) parcelable;
        super.onRestoreInstanceState(aVar.f2846m);
        Objects.requireNonNull(aVar.f3950n.getOrDefault("expandableWidgetHelper", null));
        throw null;
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        if (super.onSaveInstanceState() == null) {
            new Bundle();
        }
        d.j.a.a aVar = d.j.a.a.f2845f;
        throw null;
    }

    @Override // android.view.View
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            g(null);
        }
        return super.onTouchEvent(motionEvent);
    }

    @Override // android.view.View
    public void setBackgroundColor(int i2) {
        Log.i("FloatingActionButton", "Setting a custom background is not supported.");
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        Log.i("FloatingActionButton", "Setting a custom background is not supported.");
    }

    @Override // android.view.View
    public void setBackgroundResource(int i2) {
        Log.i("FloatingActionButton", "Setting a custom background is not supported.");
    }

    @Override // android.view.View
    public void setBackgroundTintList(ColorStateList colorStateList) {
        if (this.f1123m != colorStateList) {
            this.f1123m = colorStateList;
            Objects.requireNonNull(getImpl());
        }
    }

    @Override // android.view.View
    public void setBackgroundTintMode(PorterDuff.Mode mode) {
        if (this.f1124n != mode) {
            this.f1124n = mode;
            Objects.requireNonNull(getImpl());
        }
    }

    public void setCompatElevation(float f2) {
        d impl = getImpl();
        if (impl.f3746k != f2) {
            impl.f3746k = f2;
            impl.j(f2, impl.f3747l, impl.f3748m);
        }
    }

    public void setCompatElevationResource(int i2) {
        setCompatElevation(getResources().getDimension(i2));
    }

    public void setCompatHoveredFocusedTranslationZ(float f2) {
        d impl = getImpl();
        if (impl.f3747l != f2) {
            impl.f3747l = f2;
            impl.j(impl.f3746k, f2, impl.f3748m);
        }
    }

    public void setCompatHoveredFocusedTranslationZResource(int i2) {
        setCompatHoveredFocusedTranslationZ(getResources().getDimension(i2));
    }

    public void setCompatPressedTranslationZ(float f2) {
        d impl = getImpl();
        if (impl.f3748m != f2) {
            impl.f3748m = f2;
            impl.j(impl.f3746k, impl.f3747l, f2);
        }
    }

    public void setCompatPressedTranslationZResource(int i2) {
        setCompatPressedTranslationZ(getResources().getDimension(i2));
    }

    public void setCustomSize(int i2) {
        if (i2 < 0) {
            throw new IllegalArgumentException("Custom size must be non-negative");
        }
        if (i2 != this.f1129s) {
            this.f1129s = i2;
            requestLayout();
        }
    }

    @Override // android.view.View
    public void setElevation(float f2) {
        super.setElevation(f2);
        Objects.requireNonNull(getImpl());
    }

    public void setEnsureMinTouchTargetSize(boolean z2) {
        if (z2 != getImpl().f3744i) {
            getImpl().f3744i = z2;
            requestLayout();
        }
    }

    public void setExpandedComponentIdHint(int i2) {
        throw null;
    }

    public void setHideMotionSpec(g.e.a.a.c.g gVar) {
        getImpl().f3754s = gVar;
    }

    public void setHideMotionSpecResource(int i2) {
        setHideMotionSpec(g.e.a.a.c.g.b(getContext(), i2));
    }

    @Override // android.widget.ImageView
    public void setImageDrawable(Drawable drawable) {
        if (getDrawable() != drawable) {
            super.setImageDrawable(drawable);
            d impl = getImpl();
            impl.m(impl.f3756u);
            if (this.f1125o != null) {
                l();
            }
        }
    }

    @Override // android.widget.ImageView
    public void setImageResource(int i2) {
        throw null;
    }

    public void setRippleColor(int i2) {
        setRippleColor(ColorStateList.valueOf(i2));
    }

    public void setRippleColor(ColorStateList colorStateList) {
        if (this.f1127q != colorStateList) {
            this.f1127q = colorStateList;
            getImpl().n(this.f1127q);
        }
    }

    @Override // android.view.View
    public void setScaleX(float f2) {
        super.setScaleX(f2);
        getImpl().k();
    }

    @Override // android.view.View
    public void setScaleY(float f2) {
        super.setScaleY(f2);
        getImpl().k();
    }

    public void setShadowPaddingEnabled(boolean z2) {
        d impl = getImpl();
        impl.f3745j = z2;
        impl.s();
        throw null;
    }

    @Override // g.e.a.a.w.n
    public void setShapeAppearanceModel(g.e.a.a.w.j jVar) {
        getImpl().f3743h = jVar;
    }

    public void setShowMotionSpec(g.e.a.a.c.g gVar) {
        getImpl().f3753r = gVar;
    }

    public void setShowMotionSpecResource(int i2) {
        setShowMotionSpec(g.e.a.a.c.g.b(getContext(), i2));
    }

    public void setSize(int i2) {
        this.f1129s = 0;
        if (i2 != this.f1128r) {
            this.f1128r = i2;
            requestLayout();
        }
    }

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        setBackgroundTintList(colorStateList);
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        setBackgroundTintMode(mode);
    }

    public void setSupportImageTintList(ColorStateList colorStateList) {
        if (this.f1125o != colorStateList) {
            this.f1125o = colorStateList;
            l();
        }
    }

    public void setSupportImageTintMode(PorterDuff.Mode mode) {
        if (this.f1126p != mode) {
            this.f1126p = mode;
            l();
        }
    }

    @Override // android.view.View
    public void setTranslationX(float f2) {
        super.setTranslationX(f2);
        getImpl().l();
    }

    @Override // android.view.View
    public void setTranslationY(float f2) {
        super.setTranslationY(f2);
        getImpl().l();
    }

    @Override // android.view.View
    public void setTranslationZ(float f2) {
        super.setTranslationZ(f2);
        getImpl().l();
    }

    public void setUseCompatPadding(boolean z2) {
        if (this.f1131u != z2) {
            this.f1131u = z2;
            getImpl().h();
        }
    }

    @Override // g.e.a.a.r.p, android.widget.ImageView, android.view.View
    public void setVisibility(int i2) {
        super.setVisibility(i2);
    }
}
