package com.bytedance.sdk.component.adexpress.dynamic.tN.YFl;

import android.view.MotionEvent;
import android.view.View;
/* loaded from: classes2.dex */
public class AlY implements View.OnTouchListener {
    private float AlY;
    private float DSW;
    private com.bytedance.sdk.component.adexpress.dynamic.tN.qsH NjR;
    private float Sg;
    private float YFl;
    private boolean eT;
    private int nc;
    private boolean qsH;
    private float tN;
    private float vc;
    private boolean wN = true;

    public AlY(com.bytedance.sdk.component.adexpress.dynamic.tN.qsH qsh, int i, boolean z) {
        this.NjR = qsh;
        this.nc = i;
        this.eT = z;
    }

    @Override // android.view.View.OnTouchListener
    public boolean onTouch(View view, MotionEvent motionEvent) {
        com.bytedance.sdk.component.adexpress.dynamic.tN.qsH qsh;
        com.bytedance.sdk.component.adexpress.dynamic.tN.qsH qsh2;
        com.bytedance.sdk.component.adexpress.dynamic.tN.qsH qsh3;
        int action = motionEvent.getAction();
        if (action == 0) {
            this.YFl = motionEvent.getX();
            this.Sg = motionEvent.getY();
            this.vc = motionEvent.getY();
            this.wN = true;
        } else if (action != 1) {
            if (action == 2) {
                float y = motionEvent.getY();
                this.DSW = y;
                if (Math.abs(y - this.vc) > 10.0f) {
                    this.qsH = true;
                }
                this.AlY = motionEvent.getX();
                this.tN = motionEvent.getY();
                if (Math.abs(this.AlY - this.YFl) > 8.0f || Math.abs(this.tN - this.Sg) > 8.0f) {
                    this.wN = false;
                }
            }
        } else if (!this.qsH && !this.wN) {
            return false;
        } else {
            if (!this.eT && (qsh3 = this.NjR) != null) {
                qsh3.YFl();
            } else {
                int Sg = com.bytedance.sdk.component.adexpress.AlY.qsH.Sg(com.bytedance.sdk.component.adexpress.AlY.YFl(), Math.abs(this.DSW - this.vc));
                if (this.DSW - this.vc < 0.0f && Sg > this.nc && (qsh2 = this.NjR) != null) {
                    qsh2.YFl();
                } else if (this.wN && (qsh = this.NjR) != null) {
                    qsh.YFl();
                }
            }
        }
        return true;
    }
}
