package k3;

import M.J;
import android.view.View;
import android.view.ViewParent;
import com.google.android.gms.internal.measurement.X1;
import com.google.android.material.behavior.SwipeDismissBehavior;
import g3.p;
import java.lang.reflect.Field;

/* JADX INFO: loaded from: classes.dex */
public final class b extends X1 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f13834e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f13835f = -1;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final /* synthetic */ SwipeDismissBehavior f13836g;

    public b(SwipeDismissBehavior swipeDismissBehavior) {
        this.f13836g = swipeDismissBehavior;
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final void A(View view, int i) {
        this.f13835f = i;
        this.f13834e = view.getLeft();
        ViewParent parent = view.getParent();
        if (parent != null) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final void C(View view, int i, int i5) {
        float f3 = this.f13834e;
        float width = view.getWidth();
        SwipeDismissBehavior swipeDismissBehavior = this.f13836g;
        float f7 = (width * swipeDismissBehavior.f10110d) + f3;
        float width2 = (view.getWidth() * swipeDismissBehavior.f10111e) + this.f13834e;
        float f8 = i;
        if (f8 <= f7) {
            view.setAlpha(1.0f);
        } else if (f8 >= width2) {
            view.setAlpha(0.0f);
        } else {
            view.setAlpha(Math.min(Math.max(0.0f, 1.0f - ((f8 - f7) / (width2 - f7))), 1.0f));
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x0052  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x005e  */
    @Override // com.google.android.gms.internal.measurement.X1
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void D(View view, float f3, float f7) {
        int i;
        this.f13835f = -1;
        int width = view.getWidth();
        SwipeDismissBehavior swipeDismissBehavior = this.f13836g;
        boolean z8 = true;
        if (f3 != 0.0f) {
            Field field = J.f4065a;
            boolean z9 = view.getLayoutDirection() == 1;
            int i5 = swipeDismissBehavior.f10109c;
            if (i5 != 2 && (i5 != 0 ? i5 != 1 || (!z9 ? f3 < 0.0f : f3 > 0.0f) : !z9 ? f3 > 0.0f : f3 < 0.0f)) {
                i = this.f13834e;
                z8 = false;
            } else {
                int left = view.getLeft();
                int i8 = this.f13834e;
                i = left < i8 ? i8 - width : i8 + width;
            }
        } else {
            if (Math.abs(view.getLeft() - this.f13834e) >= Math.round(view.getWidth() * 0.5f)) {
            }
        }
        if (swipeDismissBehavior.f10107a.o(i, view.getTop())) {
            p pVar = new p(swipeDismissBehavior, view, z8);
            Field field2 = J.f4065a;
            view.postOnAnimation(pVar);
        }
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final boolean N(View view, int i) {
        int i5 = this.f13835f;
        return (i5 == -1 || i5 == i) && this.f13836g.r(view);
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int g(View view, int i) {
        int width;
        int width2;
        int width3;
        Field field = J.f4065a;
        boolean z8 = view.getLayoutDirection() == 1;
        int i5 = this.f13836g.f10109c;
        if (i5 == 0) {
            if (z8) {
                width = this.f13834e - view.getWidth();
                width2 = this.f13834e;
            } else {
                width = this.f13834e;
                width3 = view.getWidth();
                width2 = width3 + width;
            }
        } else if (i5 != 1) {
            width = this.f13834e - view.getWidth();
            width2 = view.getWidth() + this.f13834e;
        } else if (z8) {
            width = this.f13834e;
            width3 = view.getWidth();
            width2 = width3 + width;
        } else {
            width = this.f13834e - view.getWidth();
            width2 = this.f13834e;
        }
        return Math.min(Math.max(width, i), width2);
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int h(View view, int i) {
        return view.getTop();
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final int q(View view) {
        return view.getWidth();
    }

    @Override // com.google.android.gms.internal.measurement.X1
    public final void B(int i) {
    }
}
