package com.bytedance.sdk.component.adexpress.dynamic.lb.fm;

import android.graphics.RectF;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import java.lang.ref.SoftReference;

/* JADX INFO: loaded from: classes.dex */
public class wsy implements View.OnTouchListener {

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private static int f6495lb = 10;
    private float fm;
    private int jnr;
    private float ro;
    private com.bytedance.sdk.component.adexpress.dynamic.lb.wu yz;
    private RectF ajl = new RectF();
    private long wsy = 0;
    private final int wu = 200;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private final int f6496ef = 3;
    private SoftReference<View> vt = new SoftReference<>(null);

    public wsy(com.bytedance.sdk.component.adexpress.dynamic.lb.wu wuVar, int i10, final ViewGroup viewGroup) {
        this.jnr = f6495lb;
        this.yz = wuVar;
        if (i10 > 0) {
            this.jnr = i10;
        }
        if (viewGroup != null) {
            viewGroup.post(new Runnable() { // from class: com.bytedance.sdk.component.adexpress.dynamic.lb.fm.wsy.1
                @Override // java.lang.Runnable
                public void run() {
                    View viewFindViewById = viewGroup.findViewById(2097610746);
                    wsy.this.vt = new SoftReference(viewFindViewById);
                }
            });
        }
    }

    @Override // android.view.View.OnTouchListener
    public boolean onTouch(View view, MotionEvent motionEvent) {
        com.bytedance.sdk.component.adexpress.dynamic.lb.wu wuVar;
        com.bytedance.sdk.component.adexpress.dynamic.lb.wu wuVar2;
        int action = motionEvent.getAction();
        if (action == 0) {
            this.ajl = fm(this.vt.get());
            this.fm = motionEvent.getRawX();
            this.ro = motionEvent.getRawY();
            this.wsy = System.currentTimeMillis();
        } else if (action == 1) {
            RectF rectF = this.ajl;
            if (rectF != null && !rectF.contains(this.fm, this.ro)) {
                return false;
            }
            float rawX = motionEvent.getRawX();
            float rawY = motionEvent.getRawY();
            float fAbs = Math.abs(rawX - this.fm);
            float fAbs2 = Math.abs(rawY - this.ro);
            int iRo = com.bytedance.sdk.component.adexpress.yz.wsy.ro(com.bytedance.sdk.component.adexpress.yz.fm(), Math.abs(rawX - this.fm));
            int i10 = f6495lb;
            if (fAbs < i10 || fAbs2 < i10) {
                if ((System.currentTimeMillis() - this.wsy < 200 || (fAbs < 3.0f && fAbs2 < 3.0f)) && (wuVar = this.yz) != null) {
                    wuVar.fm();
                }
            } else if (rawX > this.fm && iRo > this.jnr && (wuVar2 = this.yz) != null) {
                wuVar2.fm();
            }
        }
        return true;
    }

    private RectF fm(View view) {
        if (view == null) {
            return new RectF();
        }
        int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        return new RectF(iArr[0], iArr[1], view.getWidth() + r2, view.getHeight() + iArr[1]);
    }
}
