package ῲ.ῲ.㴹;

import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import ῲ.ῲ.ඓ.㳳.AbstractC1903;

/* renamed from: ῲ.ῲ.㴹.䀟  reason: contains not printable characters */
/* compiled from: ForwardingListener */
public abstract class AbstractView$OnTouchListenerC2051 implements View.OnTouchListener, View.OnAttachStateChangeListener {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final int f6968;

    /* renamed from: ඓ  reason: contains not printable characters */
    public final View f6969;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public int f6970;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final float f6971;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public Runnable f6972;

    /* renamed from: 㳳  reason: contains not printable characters */
    public final int[] f6973 = new int[2];

    /* renamed from: 㴹  reason: contains not printable characters */
    public Runnable f6974;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final int f6975;

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f6976;

    /* renamed from: ῲ.ῲ.㴹.䀟$ῲ  reason: contains not printable characters */
    /* compiled from: ForwardingListener */
    public class RunnableC2052 implements Runnable {
        public RunnableC2052() {
        }

        public void run() {
            AbstractView$OnTouchListenerC2051 r0 = AbstractView$OnTouchListenerC2051.this;
            r0.m5340();
            View view = r0.f6969;
            if (view.isEnabled() && !view.isLongClickable() && r0.m5338()) {
                view.getParent().requestDisallowInterceptTouchEvent(true);
                long uptimeMillis = SystemClock.uptimeMillis();
                MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
                view.onTouchEvent(obtain);
                obtain.recycle();
                r0.f6976 = true;
            }
        }
    }

    /* renamed from: ῲ.ῲ.㴹.䀟$K  reason: contains not printable characters */
    /* compiled from: ForwardingListener */
    public class RunnableC2053 implements Runnable {
        public RunnableC2053() {
        }

        public void run() {
            ViewParent parent = AbstractView$OnTouchListenerC2051.this.f6969.getParent();
            if (parent != null) {
                parent.requestDisallowInterceptTouchEvent(true);
            }
        }
    }

    public AbstractView$OnTouchListenerC2051(View view) {
        this.f6969 = view;
        view.setLongClickable(true);
        view.addOnAttachStateChangeListener(this);
        this.f6971 = (float) ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
        this.f6968 = ViewConfiguration.getTapTimeout();
        this.f6975 = (ViewConfiguration.getLongPressTimeout() + this.f6968) / 2;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:32:0x0087, code lost:
        if (r4 != 3) goto L_0x0079;
     */
    /* JADX WARNING: Removed duplicated region for block: B:61:0x0113  */
    public boolean onTouch(View view, MotionEvent motionEvent) {
        boolean z;
        boolean z2;
        boolean z3;
        C2035 r4;
        boolean z4 = this.f6976;
        if (z4) {
            View view2 = this.f6969;
            AbstractC1903 r42 = m5339();
            if (r42 != null && r42.m4925() && (r4 = (C2035) r42.m4926()) != null && r4.isShown()) {
                MotionEvent obtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
                int[] iArr = this.f6973;
                view2.getLocationOnScreen(iArr);
                obtainNoHistory.offsetLocation((float) iArr[0], (float) iArr[1]);
                int[] iArr2 = this.f6973;
                r4.getLocationOnScreen(iArr2);
                obtainNoHistory.offsetLocation((float) (-iArr2[0]), (float) (-iArr2[1]));
                boolean r3 = r4.m5278(obtainNoHistory, this.f6970);
                obtainNoHistory.recycle();
                int actionMasked = motionEvent.getActionMasked();
                boolean z5 = (actionMasked == 1 || actionMasked == 3) ? false : true;
                if (r3 && z5) {
                    z3 = true;
                    z = !z3 || !m5341();
                }
            }
            z3 = false;
            if (!z3) {
            }
        } else {
            View view3 = this.f6969;
            if (view3.isEnabled()) {
                int actionMasked2 = motionEvent.getActionMasked();
                if (actionMasked2 != 0) {
                    if (actionMasked2 != 1) {
                        if (actionMasked2 == 2) {
                            int findPointerIndex = motionEvent.findPointerIndex(this.f6970);
                            if (findPointerIndex >= 0) {
                                float x = motionEvent.getX(findPointerIndex);
                                float y = motionEvent.getY(findPointerIndex);
                                float f = this.f6971;
                                float f2 = -f;
                                if (!(x >= f2 && y >= f2 && x < ((float) (view3.getRight() - view3.getLeft())) + f && y < ((float) (view3.getBottom() - view3.getTop())) + f)) {
                                    m5340();
                                    view3.getParent().requestDisallowInterceptTouchEvent(true);
                                    z2 = true;
                                    z = !z2 && m5338();
                                    if (z) {
                                        long uptimeMillis = SystemClock.uptimeMillis();
                                        MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
                                        this.f6969.onTouchEvent(obtain);
                                        obtain.recycle();
                                    }
                                }
                            }
                        }
                    }
                    m5340();
                } else {
                    this.f6970 = motionEvent.getPointerId(0);
                    if (this.f6974 == null) {
                        this.f6974 = new RunnableC2053();
                    }
                    view3.postDelayed(this.f6974, (long) this.f6968);
                    if (this.f6972 == null) {
                        this.f6972 = new RunnableC2052();
                    }
                    view3.postDelayed(this.f6972, (long) this.f6975);
                }
            }
            z2 = false;
            if (!z2) {
            }
            if (z) {
            }
        }
        this.f6976 = z;
        if (z || z4) {
            return true;
        }
        return false;
    }

    public void onViewAttachedToWindow(View view) {
    }

    public void onViewDetachedFromWindow(View view) {
        this.f6976 = false;
        this.f6970 = -1;
        Runnable runnable = this.f6974;
        if (runnable != null) {
            this.f6969.removeCallbacks(runnable);
        }
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public boolean m5338() {
        AbstractC1903 r0 = m5339();
        if (r0 == null || r0.m4925()) {
            return true;
        }
        r0.show();
        return true;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract AbstractC1903 m5339();

    /* renamed from: K  reason: contains not printable characters */
    public final void m5340() {
        Runnable runnable = this.f6972;
        if (runnable != null) {
            this.f6969.removeCallbacks(runnable);
        }
        Runnable runnable2 = this.f6974;
        if (runnable2 != null) {
            this.f6969.removeCallbacks(runnable2);
        }
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean m5341() {
        AbstractC1903 r0 = m5339();
        if (r0 == null || !r0.m4925()) {
            return true;
        }
        r0.dismiss();
        return true;
    }
}
