package com.ss.android.ugc.aweme.friends.ui;

import X.0EQ;
import android.content.Context;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.views.WrapLinearLayoutManager;

public class ScrollOffsetLayoutManager extends WrapLinearLayoutManager {
    public final SparseIntArray LIZ = new SparseIntArray();

    static {
        Covode.recordClassIndex(81341);
    }

    public final void LIZ(0EQ r5) {
        super.LIZ(r5);
        int LJIJI = LJIJI();
        for (int i = 0; i < LJIJI; i++) {
            View LJI = LJI(i);
            if (LJI != null) {
                this.LIZ.put(i, LJI.getHeight());
            }
        }
    }

    public final int LJ(0EQ r6) {
        int i;
        if (LJIJI() == 0) {
            return 0;
        }
        try {
            int LJIIJ = LJIIJ();
            int i2 = -((int) LIZJ(LJIIJ).getY());
            for (int i3 = 0; i3 < LJIIJ; i3++) {
                if (this.LIZ.indexOfKey(i3) >= 0) {
                    i = 0;
                } else {
                    i = this.LIZ.get(i3);
                }
                i2 += i;
            }
            return i2;
        } catch (Exception unused) {
            return 0;
        }
    }

    public ScrollOffsetLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
    }
}
