package l;

import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;

/* JADX INFO: loaded from: classes.dex */
public abstract class y1 implements View.OnTouchListener, View.OnAttachStateChangeListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final float f29910a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f29911b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f29912c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final View f29913d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public x1 f29914e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public x1 f29915f;

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

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

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final int[] f29918i = new int[2];

    public y1(View view) {
        this.f29913d = view;
        view.setLongClickable(true);
        view.addOnAttachStateChangeListener(this);
        this.f29910a = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
        int tapTimeout = ViewConfiguration.getTapTimeout();
        this.f29911b = tapTimeout;
        this.f29912c = (ViewConfiguration.getLongPressTimeout() + tapTimeout) / 2;
    }

    public final void a() {
        x1 x1Var = this.f29915f;
        View view = this.f29913d;
        if (x1Var != null) {
            view.removeCallbacks(x1Var);
        }
        x1 x1Var2 = this.f29914e;
        if (x1Var2 != null) {
            view.removeCallbacks(x1Var2);
        }
    }

    public abstract k.f0 b();

    public abstract boolean c();

    public abstract boolean d();

    /* JADX WARN: Removed duplicated region for block: B:22:0x005e  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x0064  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00cd  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x0100  */
    @Override // android.view.View.OnTouchListener
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean onTouch(View view, MotionEvent motionEvent) {
        boolean z10;
        v1 v1Var;
        boolean z11 = this.f29916g;
        View view2 = this.f29913d;
        if (z11) {
            k.f0 f0VarB = b();
            if (f0VarB == null || !f0VarB.a() || (v1Var = (v1) f0VarB.getListView()) == null || !v1Var.isShown()) {
                z10 = !d();
            } else {
                MotionEvent motionEventObtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
                int[] iArr = this.f29918i;
                view2.getLocationOnScreen(iArr);
                motionEventObtainNoHistory.offsetLocation(iArr[0], iArr[1]);
                v1Var.getLocationOnScreen(iArr);
                motionEventObtainNoHistory.offsetLocation(-iArr[0], -iArr[1]);
                boolean zB = v1Var.b(motionEventObtainNoHistory, this.f29917h);
                motionEventObtainNoHistory.recycle();
                int actionMasked = motionEvent.getActionMasked();
                boolean z12 = (actionMasked == 1 || actionMasked == 3) ? false : true;
                if (!zB || !z12) {
                }
            }
        } else if (view2.isEnabled()) {
            int actionMasked2 = motionEvent.getActionMasked();
            if (actionMasked2 == 0) {
                this.f29917h = motionEvent.getPointerId(0);
                if (this.f29914e == null) {
                    this.f29914e = new x1(this, 0);
                }
                view2.postDelayed(this.f29914e, this.f29911b);
                if (this.f29915f == null) {
                    this.f29915f = new x1(this, 1);
                }
                view2.postDelayed(this.f29915f, this.f29912c);
            } else if (actionMasked2 == 1) {
                a();
            } else if (actionMasked2 == 2) {
                int iFindPointerIndex = motionEvent.findPointerIndex(this.f29917h);
                if (iFindPointerIndex >= 0) {
                    float x10 = motionEvent.getX(iFindPointerIndex);
                    float y10 = motionEvent.getY(iFindPointerIndex);
                    float f10 = this.f29910a;
                    float f11 = -f10;
                    if (x10 < f11 || y10 < f11 || x10 >= (view2.getRight() - view2.getLeft()) + f10 || y10 >= (view2.getBottom() - view2.getTop()) + f10) {
                        a();
                        view2.getParent().requestDisallowInterceptTouchEvent(true);
                        if (c()) {
                            z10 = true;
                        }
                        if (z10) {
                            long jUptimeMillis = SystemClock.uptimeMillis();
                            MotionEvent motionEventObtain = MotionEvent.obtain(jUptimeMillis, jUptimeMillis, 3, 0.0f, 0.0f, 0);
                            view2.onTouchEvent(motionEventObtain);
                            motionEventObtain.recycle();
                        }
                    }
                }
            } else if (actionMasked2 == 3) {
            }
            z10 = false;
            if (z10) {
            }
        } else {
            z10 = false;
            if (z10) {
            }
        }
        this.f29916g = z10;
        return z10 || z11;
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewAttachedToWindow(View view) {
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewDetachedFromWindow(View view) {
        this.f29916g = false;
        this.f29917h = -1;
        x1 x1Var = this.f29914e;
        if (x1Var != null) {
            this.f29913d.removeCallbacks(x1Var);
        }
    }
}
