package defpackage;

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

/* JADX INFO: renamed from: ᵲᵬʖ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractViewOnTouchListenerC4529 implements View.OnTouchListener, View.OnAttachStateChangeListener {

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public boolean f17234;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final float f17235;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public int f17236;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final int f17237;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final int f17238;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final View f17239;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public RunnableC3140 f17240;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public RunnableC3140 f17241;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public final int[] f17242 = new int[2];

    public AbstractViewOnTouchListenerC4529(View view) {
        this.f17239 = view;
        view.setLongClickable(true);
        view.addOnAttachStateChangeListener(this);
        this.f17235 = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
        int tapTimeout = ViewConfiguration.getTapTimeout();
        this.f17238 = tapTimeout;
        this.f17237 = (ViewConfiguration.getLongPressTimeout() + tapTimeout) / 2;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x005c  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x0062  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00cb  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x00fe  */
    @Override // android.view.View.OnTouchListener
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean onTouch(View view, MotionEvent motionEvent) {
        boolean z;
        C5565 c5565Mo7545;
        boolean z2 = this.f17234;
        View view2 = this.f17239;
        if (z2) {
            InterfaceC3957 interfaceC3957Mo3752 = mo3752();
            if (interfaceC3957Mo3752 == null || !interfaceC3957Mo3752.mo7546() || (c5565Mo7545 = interfaceC3957Mo3752.mo7545()) == null || !c5565Mo7545.isShown()) {
                z = !mo8067();
            } else {
                MotionEvent motionEventObtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
                int[] iArr = this.f17242;
                view2.getLocationOnScreen(iArr);
                motionEventObtainNoHistory.offsetLocation(iArr[0], iArr[1]);
                c5565Mo7545.getLocationOnScreen(iArr);
                motionEventObtainNoHistory.offsetLocation(-iArr[0], -iArr[1]);
                boolean zM11207 = c5565Mo7545.m11207(motionEventObtainNoHistory, this.f17236);
                motionEventObtainNoHistory.recycle();
                int actionMasked = motionEvent.getActionMasked();
                boolean z3 = (actionMasked == 1 || actionMasked == 3) ? false : true;
                if (!zM11207 || !z3) {
                }
            }
        } else if (view2.isEnabled()) {
            int actionMasked2 = motionEvent.getActionMasked();
            if (actionMasked2 == 0) {
                this.f17236 = motionEvent.getPointerId(0);
                if (this.f17240 == null) {
                    this.f17240 = new RunnableC3140(this, 0);
                }
                view2.postDelayed(this.f17240, this.f17238);
                if (this.f17241 == null) {
                    this.f17241 = new RunnableC3140(this, 1);
                }
                view2.postDelayed(this.f17241, this.f17237);
            } else if (actionMasked2 == 1) {
                m9571();
            } else if (actionMasked2 == 2) {
                int iFindPointerIndex = motionEvent.findPointerIndex(this.f17236);
                if (iFindPointerIndex >= 0) {
                    float x = motionEvent.getX(iFindPointerIndex);
                    float y = motionEvent.getY(iFindPointerIndex);
                    float f = this.f17235;
                    float f2 = -f;
                    if (x < f2 || y < f2 || x >= (view2.getRight() - view2.getLeft()) + f || y >= (view2.getBottom() - view2.getTop()) + f) {
                        m9571();
                        view2.getParent().requestDisallowInterceptTouchEvent(true);
                        if (mo3753()) {
                            z = true;
                        }
                        if (z) {
                            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) {
            }
            z = false;
            if (z) {
            }
        } else {
            z = false;
            if (z) {
            }
        }
        this.f17234 = z;
        return z || z2;
    }

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

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewDetachedFromWindow(View view) {
        this.f17234 = false;
        this.f17236 = -1;
        RunnableC3140 runnableC3140 = this.f17240;
        if (runnableC3140 != null) {
            this.f17239.removeCallbacks(runnableC3140);
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ */
    public abstract InterfaceC3957 mo3752();

    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public abstract boolean mo3753();

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m9571() {
        RunnableC3140 runnableC3140 = this.f17241;
        View view = this.f17239;
        if (runnableC3140 != null) {
            view.removeCallbacks(runnableC3140);
        }
        RunnableC3140 runnableC31402 = this.f17240;
        if (runnableC31402 != null) {
            view.removeCallbacks(runnableC31402);
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public boolean mo8067() {
        InterfaceC3957 interfaceC3957Mo3752 = mo3752();
        if (interfaceC3957Mo3752 == null || !interfaceC3957Mo3752.mo7546()) {
            return true;
        }
        interfaceC3957Mo3752.dismiss();
        return true;
    }
}
