package androidx.recyclerview.widget;

import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;

/* loaded from: classes.dex */
public abstract class n {

    /* renamed from: a, reason: collision with root package name */
    protected final RecyclerView.p f5460a;

    /* renamed from: b, reason: collision with root package name */
    private int f5461b;

    /* renamed from: c, reason: collision with root package name */
    final Rect f5462c;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public class a extends n {
        a(RecyclerView.p pVar) {
            super(pVar, null);
        }

        @Override // androidx.recyclerview.widget.n
        public int d(View view) {
            return this.f5460a.d0(view) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.q) view.getLayoutParams())).rightMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int e(View view) {
            RecyclerView.q qVar = (RecyclerView.q) view.getLayoutParams();
            return this.f5460a.c0(view) + ((ViewGroup.MarginLayoutParams) qVar).leftMargin + ((ViewGroup.MarginLayoutParams) qVar).rightMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int f(View view) {
            RecyclerView.q qVar = (RecyclerView.q) view.getLayoutParams();
            return this.f5460a.b0(view) + ((ViewGroup.MarginLayoutParams) qVar).topMargin + ((ViewGroup.MarginLayoutParams) qVar).bottomMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int g(View view) {
            return this.f5460a.a0(view) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.q) view.getLayoutParams())).leftMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int h() {
            return this.f5460a.u0();
        }

        @Override // androidx.recyclerview.widget.n
        public int i() {
            return this.f5460a.u0() - this.f5460a.getPaddingRight();
        }

        @Override // androidx.recyclerview.widget.n
        public int j() {
            return this.f5460a.getPaddingRight();
        }

        @Override // androidx.recyclerview.widget.n
        public int k() {
            return this.f5460a.v0();
        }

        @Override // androidx.recyclerview.widget.n
        public int l() {
            return this.f5460a.h0();
        }

        @Override // androidx.recyclerview.widget.n
        public int m() {
            return this.f5460a.getPaddingLeft();
        }

        @Override // androidx.recyclerview.widget.n
        public int n() {
            return (this.f5460a.u0() - this.f5460a.getPaddingLeft()) - this.f5460a.getPaddingRight();
        }

        @Override // androidx.recyclerview.widget.n
        public int p(View view) {
            this.f5460a.t0(view, true, this.f5462c);
            return this.f5462c.right;
        }

        @Override // androidx.recyclerview.widget.n
        public int q(View view) {
            this.f5460a.t0(view, true, this.f5462c);
            return this.f5462c.left;
        }

        @Override // androidx.recyclerview.widget.n
        public void r(int i10) {
            this.f5460a.J0(i10);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public class b extends n {
        b(RecyclerView.p pVar) {
            super(pVar, null);
        }

        @Override // androidx.recyclerview.widget.n
        public int d(View view) {
            return this.f5460a.Y(view) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.q) view.getLayoutParams())).bottomMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int e(View view) {
            RecyclerView.q qVar = (RecyclerView.q) view.getLayoutParams();
            return this.f5460a.b0(view) + ((ViewGroup.MarginLayoutParams) qVar).topMargin + ((ViewGroup.MarginLayoutParams) qVar).bottomMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int f(View view) {
            RecyclerView.q qVar = (RecyclerView.q) view.getLayoutParams();
            return this.f5460a.c0(view) + ((ViewGroup.MarginLayoutParams) qVar).leftMargin + ((ViewGroup.MarginLayoutParams) qVar).rightMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int g(View view) {
            return this.f5460a.e0(view) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.q) view.getLayoutParams())).topMargin;
        }

        @Override // androidx.recyclerview.widget.n
        public int h() {
            return this.f5460a.g0();
        }

        @Override // androidx.recyclerview.widget.n
        public int i() {
            return this.f5460a.g0() - this.f5460a.getPaddingBottom();
        }

        @Override // androidx.recyclerview.widget.n
        public int j() {
            return this.f5460a.getPaddingBottom();
        }

        @Override // androidx.recyclerview.widget.n
        public int k() {
            return this.f5460a.h0();
        }

        @Override // androidx.recyclerview.widget.n
        public int l() {
            return this.f5460a.v0();
        }

        @Override // androidx.recyclerview.widget.n
        public int m() {
            return this.f5460a.getPaddingTop();
        }

        @Override // androidx.recyclerview.widget.n
        public int n() {
            return (this.f5460a.g0() - this.f5460a.getPaddingTop()) - this.f5460a.getPaddingBottom();
        }

        @Override // androidx.recyclerview.widget.n
        public int p(View view) {
            this.f5460a.t0(view, true, this.f5462c);
            return this.f5462c.bottom;
        }

        @Override // androidx.recyclerview.widget.n
        public int q(View view) {
            this.f5460a.t0(view, true, this.f5462c);
            return this.f5462c.top;
        }

        @Override // androidx.recyclerview.widget.n
        public void r(int i10) {
            this.f5460a.K0(i10);
        }
    }

    /* synthetic */ n(RecyclerView.p pVar, a aVar) {
        this(pVar);
    }

    public static n a(RecyclerView.p pVar) {
        return new a(pVar);
    }

    public static n b(RecyclerView.p pVar, int i10) {
        if (i10 == 0) {
            return a(pVar);
        }
        if (i10 == 1) {
            return c(pVar);
        }
        throw new IllegalArgumentException("invalid orientation");
    }

    public static n c(RecyclerView.p pVar) {
        return new b(pVar);
    }

    public abstract int d(View view);

    public abstract int e(View view);

    public abstract int f(View view);

    public abstract int g(View view);

    public abstract int h();

    public abstract int i();

    public abstract int j();

    public abstract int k();

    public abstract int l();

    public abstract int m();

    public abstract int n();

    public int o() {
        if (Integer.MIN_VALUE == this.f5461b) {
            return 0;
        }
        return n() - this.f5461b;
    }

    public abstract int p(View view);

    public abstract int q(View view);

    public abstract void r(int i10);

    public void s() {
        this.f5461b = n();
    }

    private n(RecyclerView.p pVar) {
        this.f5461b = Integer.MIN_VALUE;
        this.f5462c = new Rect();
        this.f5460a = pVar;
    }
}
