package a9;

import android.view.View;
import android.view.ViewParent;
import androidx.lifecycle.q0;
import com.bumptech.glide.h;
import com.google.android.material.behavior.SwipeDismissBehavior;

/* JADX INFO: loaded from: classes2.dex */
public final class c extends h {

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

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

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

    public c(SwipeDismissBehavior swipeDismissBehavior) {
        this.f404c = swipeDismissBehavior;
    }

    @Override // com.bumptech.glide.h
    public final boolean D(int i10, View view) {
        int i11 = this.f403b;
        return (i11 == -1 || i11 == i10) && this.f404c.w(view);
    }

    @Override // com.bumptech.glide.h
    public final int j(View view, int i10) {
        int width;
        int width2;
        int width3;
        boolean z10 = view.getLayoutDirection() == 1;
        int i11 = this.f404c.f22252d;
        if (i11 == 0) {
            if (z10) {
                width = this.f402a - view.getWidth();
                width2 = this.f402a;
            } else {
                width = this.f402a;
                width3 = view.getWidth();
                width2 = width3 + width;
            }
        } else if (i11 != 1) {
            width = this.f402a - view.getWidth();
            width2 = view.getWidth() + this.f402a;
        } else if (z10) {
            width = this.f402a;
            width3 = view.getWidth();
            width2 = width3 + width;
        } else {
            width = this.f402a - view.getWidth();
            width2 = this.f402a;
        }
        return Math.min(Math.max(width, i10), width2);
    }

    @Override // com.bumptech.glide.h
    public final int k(View view, int i10) {
        return view.getTop();
    }

    @Override // com.bumptech.glide.h
    public final int n(View view) {
        return view.getWidth();
    }

    @Override // com.bumptech.glide.h
    public final void u(View view, int i10) {
        this.f403b = i10;
        this.f402a = view.getLeft();
        ViewParent parent = view.getParent();
        if (parent != null) {
            SwipeDismissBehavior swipeDismissBehavior = this.f404c;
            swipeDismissBehavior.f22251c = true;
            parent.requestDisallowInterceptTouchEvent(true);
            swipeDismissBehavior.f22251c = false;
        }
    }

    @Override // com.bumptech.glide.h
    public final void v(int i10) {
        this.f404c.getClass();
    }

    @Override // com.bumptech.glide.h
    public final void w(View view, int i10, int i11) {
        float width = view.getWidth();
        SwipeDismissBehavior swipeDismissBehavior = this.f404c;
        float f10 = width * swipeDismissBehavior.f22254f;
        float width2 = view.getWidth() * swipeDismissBehavior.f22255g;
        float fAbs = Math.abs(i10 - this.f402a);
        if (fAbs <= f10) {
            view.setAlpha(1.0f);
        } else if (fAbs >= width2) {
            view.setAlpha(0.0f);
        } else {
            view.setAlpha(Math.min(Math.max(0.0f, 1.0f - ((fAbs - f10) / (width2 - f10))), 1.0f));
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x0050  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x005f  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0064  */
    @Override // com.bumptech.glide.h
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void x(float f10, float f11, View view) {
        int i10;
        this.f403b = -1;
        int width = view.getWidth();
        boolean z10 = true;
        SwipeDismissBehavior swipeDismissBehavior = this.f404c;
        if (f10 != 0.0f) {
            boolean z11 = view.getLayoutDirection() == 1;
            int i11 = swipeDismissBehavior.f22252d;
            if (i11 != 2 && (i11 != 0 ? i11 != 1 || (!z11 ? f10 < 0.0f : f10 > 0.0f) : !z11 ? f10 > 0.0f : f10 < 0.0f)) {
                i10 = this.f402a;
                z10 = false;
            } else if (f10 >= 0.0f) {
                int left = view.getLeft();
                int i12 = this.f402a;
                i10 = left < i12 ? this.f402a - width : i12 + width;
            }
        } else {
            if (Math.abs(view.getLeft() - this.f402a) >= Math.round(view.getWidth() * swipeDismissBehavior.f22253e)) {
            }
        }
        if (swipeDismissBehavior.f22249a.q(i10, view.getTop())) {
            view.postOnAnimation(new q0(swipeDismissBehavior, view, z10));
        }
    }
}
