jimu-decompiled/sources/com/ubt/jimu/picture/pagerecyclerview/HorizontalPageLayoutManager.java
2025-05-13 19:24:51 +02:00

159 lines
4.5 KiB
Java

package com.ubt.jimu.picture.pagerecyclerview;
import android.graphics.Rect;
import android.util.SparseArray;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/* loaded from: classes2.dex */
public class HorizontalPageLayoutManager extends RecyclerView.LayoutManager implements PageDecorationLastJudge {
int A;
int B;
int C;
int v;
int w;
int s = 0;
int t = 0;
private SparseArray<Rect> u = new SparseArray<>();
public int x = 0;
int y = 0;
int z = 0;
public HorizontalPageLayoutManager(int i, int i2) {
this.v = 0;
this.w = 0;
this.A = 0;
this.v = i;
this.w = i2;
this.A = i * i2;
}
private int E() {
return (h() - q()) - n();
}
private int F() {
return (r() - o()) - p();
}
private void f(RecyclerView.Recycler recycler, RecyclerView.State state) {
if (state.d()) {
return;
}
Rect rect = new Rect(o() + this.t, q(), ((r() - o()) - p()) + this.t, (h() - q()) - n());
Rect rect2 = new Rect();
for (int i = 0; i < e(); i++) {
View d = d(i);
rect2.left = f(d);
rect2.top = j(d);
rect2.right = i(d);
rect2.bottom = e(d);
if (!Rect.intersects(rect, rect2)) {
a(d, recycler);
}
}
for (int i2 = 0; i2 < j(); i2++) {
if (Rect.intersects(rect, this.u.get(i2))) {
View d2 = recycler.d(i2);
b(d2);
a(d2, this.B, this.C);
Rect rect3 = this.u.get(i2);
int i3 = rect3.left;
int i4 = this.t;
a(d2, i3 - i4, rect3.top, rect3.right - i4, rect3.bottom);
}
}
}
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
public int a(int i, RecyclerView.Recycler recycler, RecyclerView.State state) {
a(recycler);
int i2 = this.t;
int i3 = i2 + i;
int i4 = this.s;
if (i3 > i4) {
i = i4 - i2;
} else if (i3 < 0) {
i = 0 - i2;
}
this.t += i;
e(-i);
f(recycler, state);
return i;
}
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
public boolean a() {
return true;
}
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
public void b(RecyclerView recyclerView, RecyclerView.Recycler recycler) {
super.b(recyclerView, recycler);
this.t = 0;
}
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
public RecyclerView.LayoutParams c() {
return null;
}
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
public void e(RecyclerView.Recycler recycler, RecyclerView.State state) {
int i;
if (j() == 0) {
b(recycler);
return;
}
if (state.d()) {
return;
}
this.y = F() / this.w;
int E = E();
int i2 = this.v;
this.z = E / i2;
this.B = (this.w - 1) * this.y;
this.C = (i2 - 1) * this.z;
this.x = (j() / this.A) + (j() % this.A == 0 ? 0 : 1);
this.s = (this.x - 1) * r();
a(recycler);
int j = j();
for (int i3 = 0; i3 < this.x; i3 = i + 1) {
i = i3;
int i4 = 0;
while (i4 < this.v) {
int i5 = 0;
while (true) {
int i6 = this.w;
if (i5 >= i6) {
break;
}
int i7 = (this.A * i) + (i6 * i4) + i5;
if (i7 == j) {
i4 = this.v;
i = this.x;
break;
}
View d = recycler.d(i7);
b(d);
a(d, this.B, this.C);
int h = h(d);
int g = g(d);
Rect rect = this.u.get(i7);
if (rect == null) {
rect = new Rect();
}
int F = (F() * i) + (this.y * i5);
int i8 = this.z * i4;
rect.set(F, i8, h + F, g + i8);
this.u.put(i7, rect);
i5++;
}
i4++;
}
b(recycler);
}
f(recycler, state);
}
}