package s9;

import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import com.google.android.material.search.SearchView;
import org.drive_hunter.R;
import xyz.netfly.ui.main.HomeActivity;
import xyz.stream.view.UiUtils;
import xyz.stream.view.VideoGestureFrameLayout;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class g implements View.OnTouchListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f32692a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f32693b;

    public /* synthetic */ g(Object obj, int i10) {
        this.f32692a = i10;
        this.f32693b = obj;
    }

    /* JADX WARN: Removed duplicated region for block: B:41:0x00a0  */
    @Override // android.view.View.OnTouchListener
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean onTouch(View view, MotionEvent motionEvent) {
        VideoGestureFrameLayout.VideoGestureListener videoGestureListener;
        int i10 = this.f32692a;
        Object obj = this.f32693b;
        switch (i10) {
            case 0:
                SearchView searchView = (SearchView) obj;
                int i11 = SearchView.f22992j0;
                if (searchView.h()) {
                    searchView.f();
                }
                return false;
            case 1:
                com.google.android.material.textfield.l lVar = (com.google.android.material.textfield.l) obj;
                lVar.getClass();
                if (motionEvent.getAction() == 1) {
                    long jUptimeMillis = SystemClock.uptimeMillis() - lVar.f23421n;
                    if (jUptimeMillis < 0 || jUptimeMillis > 300) {
                        lVar.f23419l = false;
                    }
                    lVar.v();
                    lVar.f23419l = true;
                    lVar.f23421n = SystemClock.uptimeMillis();
                }
                return false;
            case 2:
                HomeActivity homeActivity = (HomeActivity) obj;
                int i12 = HomeActivity.f35516i;
                homeActivity.getClass();
                int action = motionEvent.getAction();
                if (action == 0) {
                    homeActivity.f35522g = motionEvent.getRawX();
                    homeActivity.f35523h = ((ie.h) homeActivity.binding).f26930u.getWidth();
                    return true;
                }
                if (action == 1) {
                    if (((ie.h) homeActivity.binding).f26930u.getWidth() > UiUtils.dp2px(240.0f)) {
                        homeActivity.M();
                        return true;
                    }
                    homeActivity.L();
                    return true;
                }
                if (action != 2) {
                    return false;
                }
                int iMax = Math.max(UiUtils.dp2px(135.0f), Math.min(UiUtils.dp2px(345.0f), (int) (homeActivity.f35523h + (motionEvent.getRawX() - homeActivity.f35522g))));
                ViewGroup.LayoutParams layoutParams = ((ie.h) homeActivity.binding).f26930u.getLayoutParams();
                layoutParams.width = iMax;
                ((ie.h) homeActivity.binding).f26930u.setLayoutParams(layoutParams);
                if (iMax > UiUtils.dp2px(240.0f)) {
                    ((ie.h) homeActivity.binding).f26918i.setImageResource(R.mipmap.main_logo_open);
                } else {
                    ((ie.h) homeActivity.binding).f26918i.setImageResource(R.mipmap.main_logo_close);
                }
                homeActivity.f35517b = iMax > UiUtils.dp2px(240.0f);
                return true;
            default:
                VideoGestureFrameLayout videoGestureFrameLayout = (VideoGestureFrameLayout) obj;
                int i13 = VideoGestureFrameLayout.f36397q0;
                videoGestureFrameLayout.getClass();
                int actionMasked = motionEvent.getActionMasked();
                if (actionMasked == 0) {
                    videoGestureFrameLayout.c();
                    videoGestureFrameLayout.f36421l0 = false;
                    videoGestureFrameLayout.f36409f0 = motionEvent.getX();
                    videoGestureFrameLayout.f36411g0 = motionEvent.getY();
                    if (videoGestureFrameLayout.f36415i0 && videoGestureFrameLayout.f36399a0 && videoGestureFrameLayout.f36422m && videoGestureFrameLayout.f36420l > 0 && motionEvent.getPointerCount() <= 1) {
                        if (videoGestureFrameLayout.f36426p0 == null) {
                            videoGestureFrameLayout.f36426p0 = new p000if.e(videoGestureFrameLayout, 23);
                        }
                        videoGestureFrameLayout.f36417j0 = true;
                        videoGestureFrameLayout.postDelayed(videoGestureFrameLayout.f36426p0, ViewConfiguration.getLongPressTimeout());
                    }
                } else if (actionMasked == 5) {
                    boolean z10 = videoGestureFrameLayout.f36419k0 || videoGestureFrameLayout.f36421l0;
                    videoGestureFrameLayout.c();
                    if (z10) {
                        return true;
                    }
                } else if (actionMasked == 2) {
                    if (!videoGestureFrameLayout.f36419k0) {
                        if (motionEvent.getPointerCount() <= 1) {
                            float fAbs = Math.abs(motionEvent.getX() - videoGestureFrameLayout.f36409f0);
                            float fAbs2 = Math.abs(motionEvent.getY() - videoGestureFrameLayout.f36411g0);
                            float f10 = videoGestureFrameLayout.f36407e0;
                            if (fAbs > f10 || fAbs2 > f10) {
                            }
                        } else if (videoGestureFrameLayout.f36417j0) {
                            videoGestureFrameLayout.f36417j0 = false;
                            p000if.e eVar = videoGestureFrameLayout.f36426p0;
                            if (eVar != null) {
                                videoGestureFrameLayout.removeCallbacks(eVar);
                            }
                        }
                    }
                    if (videoGestureFrameLayout.f36419k0 || videoGestureFrameLayout.f36421l0) {
                        return true;
                    }
                } else if (actionMasked == 6) {
                    if (videoGestureFrameLayout.f36421l0) {
                        return true;
                    }
                } else if (actionMasked == 1 || actionMasked == 3) {
                    boolean z11 = videoGestureFrameLayout.f36419k0 || videoGestureFrameLayout.f36421l0;
                    videoGestureFrameLayout.c();
                    boolean z12 = actionMasked == 1;
                    if (videoGestureFrameLayout.indexOfChild(videoGestureFrameLayout.T) != -1) {
                        videoGestureFrameLayout.removeView(videoGestureFrameLayout.T);
                    }
                    if (videoGestureFrameLayout.indexOfChild(videoGestureFrameLayout.U) != -1) {
                        videoGestureFrameLayout.removeView(videoGestureFrameLayout.U);
                    }
                    if (videoGestureFrameLayout.indexOfChild(videoGestureFrameLayout.V) != -1) {
                        videoGestureFrameLayout.removeView(videoGestureFrameLayout.V);
                    }
                    if (z12 && videoGestureFrameLayout.f36404d && (videoGestureListener = videoGestureFrameLayout.f36402c) != null) {
                        long j10 = videoGestureFrameLayout.f36420l;
                        if (j10 > 0) {
                            videoGestureListener.onSeekGestureCommit((j10 * ((long) videoGestureFrameLayout.f36414i)) / 100);
                        }
                    }
                    videoGestureFrameLayout.f36404d = false;
                    if (z11) {
                        return true;
                    }
                }
                return videoGestureFrameLayout.f36400b.onTouchEvent(motionEvent);
        }
    }
}
