package com.google.android.material.behavior;

import android.view.MotionEvent;
import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import java.util.WeakHashMap;
import o.AbstractC0375Om;
import o.C0;
import o.Oj0;
import o.Sj0;
import o.WT;
import o.Xb0;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class SwipeDismissBehavior<V extends View> extends AbstractC0375Om {
    public Sj0 a;
    public boolean b;
    public boolean c;
    public int d = 2;
    public float e = 0.0f;
    public float f = 0.5f;
    public final Xb0 g = new Xb0(this);

    @Override // o.AbstractC0375Om
    public boolean f(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
        boolean zN = this.b;
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 0) {
            zN = coordinatorLayout.n(view, (int) motionEvent.getX(), (int) motionEvent.getY());
            this.b = zN;
        } else if (actionMasked == 1 || actionMasked == 3) {
            this.b = false;
        }
        if (zN) {
            if (this.a == null) {
                this.a = new Sj0(coordinatorLayout.getContext(), coordinatorLayout, this.g);
            }
            if (!this.c && this.a.o(motionEvent)) {
                return true;
            }
        }
        return false;
    }

    @Override // o.AbstractC0375Om
    public final boolean g(CoordinatorLayout coordinatorLayout, View view, int i) {
        WeakHashMap weakHashMap = Oj0.a;
        if (view.getImportantForAccessibility() == 0) {
            view.setImportantForAccessibility(1);
            Oj0.j(view, 1048576);
            Oj0.h(view, 0);
            if (r(view)) {
                Oj0.k(view, C0.l, new WT(20, this));
            }
        }
        return false;
    }

    @Override // o.AbstractC0375Om
    public final boolean q(View view, MotionEvent motionEvent) {
        if (this.a == null) {
            return false;
        }
        if (this.c && motionEvent.getActionMasked() == 3) {
            return true;
        }
        this.a.i(motionEvent);
        return true;
    }

    public boolean r(View view) {
        return true;
    }
}
