Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,158 @@
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);
}
}

View File

@@ -0,0 +1,5 @@
package com.ubt.jimu.picture.pagerecyclerview;
/* loaded from: classes2.dex */
public interface PageDecorationLastJudge {
}

View File

@@ -0,0 +1,213 @@
package com.ubt.jimu.picture.pagerecyclerview;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.view.MotionEvent;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import com.baidu.cloud.media.player.IMediaPlayer;
/* loaded from: classes2.dex */
public class PagerHelper {
RecyclerView a = null;
private MyOnScrollListener b = new MyOnScrollListener();
private MyOnFlingListener c = new MyOnFlingListener();
private int d = 0;
private int e = 0;
int f = 0;
int g = 0;
ORIENTATION h = ORIENTATION.HORIZONTAL;
ValueAnimator i = null;
private MyOnTouchListener j = new MyOnTouchListener();
onPageChangeListener k;
public class MyOnFlingListener extends RecyclerView.OnFlingListener {
public MyOnFlingListener() {
}
@Override // androidx.recyclerview.widget.RecyclerView.OnFlingListener
public boolean a(int i, int i2) {
int width;
int i3;
PagerHelper pagerHelper = PagerHelper.this;
if (pagerHelper.h == ORIENTATION.NULL) {
return false;
}
int c = pagerHelper.c();
PagerHelper pagerHelper2 = PagerHelper.this;
if (pagerHelper2.h == ORIENTATION.VERTICAL) {
i3 = pagerHelper2.d;
if (i2 < 0) {
c--;
} else if (i2 > 0) {
c++;
}
width = c * PagerHelper.this.a.getHeight();
} else {
int i4 = pagerHelper2.e;
if (i < 0) {
c--;
} else if (i > 0) {
c++;
}
width = c * PagerHelper.this.a.getWidth();
i3 = i4;
}
if (width < 0) {
width = 0;
}
PagerHelper pagerHelper3 = PagerHelper.this;
ValueAnimator valueAnimator = pagerHelper3.i;
if (valueAnimator == null) {
new ValueAnimator();
pagerHelper3.i = ValueAnimator.ofInt(i3, width);
PagerHelper.this.i.setDuration(300L);
PagerHelper.this.i.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.ubt.jimu.picture.pagerecyclerview.PagerHelper.MyOnFlingListener.1
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public void onAnimationUpdate(ValueAnimator valueAnimator2) {
int intValue = ((Integer) valueAnimator2.getAnimatedValue()).intValue();
PagerHelper pagerHelper4 = PagerHelper.this;
if (pagerHelper4.h == ORIENTATION.VERTICAL) {
PagerHelper.this.a.scrollBy(0, intValue - pagerHelper4.d);
} else {
PagerHelper.this.a.scrollBy(intValue - pagerHelper4.e, 0);
}
}
});
PagerHelper.this.i.addListener(new AnimatorListenerAdapter() { // from class: com.ubt.jimu.picture.pagerecyclerview.PagerHelper.MyOnFlingListener.2
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
PagerHelper pagerHelper4 = PagerHelper.this;
onPageChangeListener onpagechangelistener = pagerHelper4.k;
if (onpagechangelistener != null) {
onpagechangelistener.a(pagerHelper4.b());
}
}
});
} else {
valueAnimator.cancel();
PagerHelper.this.i.setIntValues(i3, width);
}
PagerHelper.this.i.start();
return true;
}
}
public class MyOnTouchListener implements View.OnTouchListener {
public MyOnTouchListener() {
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() != 0) {
return false;
}
PagerHelper pagerHelper = PagerHelper.this;
pagerHelper.f = pagerHelper.d;
PagerHelper pagerHelper2 = PagerHelper.this;
pagerHelper2.g = pagerHelper2.e;
return false;
}
}
enum ORIENTATION {
HORIZONTAL,
VERTICAL,
NULL
}
public interface onPageChangeListener {
void a(int i);
}
/* JADX INFO: Access modifiers changed from: private */
public int c() {
return this.h == ORIENTATION.VERTICAL ? this.f / this.a.getHeight() : this.g / this.a.getWidth();
}
/* JADX INFO: Access modifiers changed from: private */
public int b() {
if (this.h == ORIENTATION.VERTICAL) {
return this.d / this.a.getHeight();
}
return this.e / this.a.getWidth();
}
public void a(RecyclerView recyclerView) {
if (recyclerView != null) {
this.a = recyclerView;
recyclerView.setOnFlingListener(this.c);
recyclerView.setOnScrollListener(this.b);
recyclerView.setOnTouchListener(this.j);
a();
return;
}
throw new IllegalArgumentException("recycleView must be not null");
}
public class MyOnScrollListener extends RecyclerView.OnScrollListener {
public MyOnScrollListener() {
}
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
public void a(RecyclerView recyclerView, int i) {
PagerHelper pagerHelper;
ORIENTATION orientation;
if (i != 0 || (orientation = (pagerHelper = PagerHelper.this).h) == ORIENTATION.NULL) {
return;
}
ORIENTATION orientation2 = ORIENTATION.VERTICAL;
int i2 = IMediaPlayer.MEDIA_ERROR_AUTH_FAILURE;
int i3 = 0;
if (orientation == orientation2) {
if (Math.abs(pagerHelper.d - PagerHelper.this.f) > recyclerView.getHeight() / 2) {
if (PagerHelper.this.d - PagerHelper.this.f >= 0) {
i2 = 1000;
}
PagerHelper.this.c.a(i3, i2);
}
} else {
if (Math.abs(pagerHelper.e - PagerHelper.this.g) > recyclerView.getWidth() / 2) {
if (PagerHelper.this.e - PagerHelper.this.g >= 0) {
i2 = 1000;
}
i3 = i2;
}
}
i2 = 0;
PagerHelper.this.c.a(i3, i2);
}
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
public void a(RecyclerView recyclerView, int i, int i2) {
PagerHelper.this.d += i2;
PagerHelper.this.e += i;
}
}
public void a() {
RecyclerView.LayoutManager layoutManager = this.a.getLayoutManager();
if (layoutManager != null) {
if (layoutManager.b()) {
this.h = ORIENTATION.VERTICAL;
} else if (layoutManager.a()) {
this.h = ORIENTATION.HORIZONTAL;
} else {
this.h = ORIENTATION.NULL;
}
ValueAnimator valueAnimator = this.i;
if (valueAnimator != null) {
valueAnimator.cancel();
}
this.g = 0;
this.f = 0;
this.e = 0;
this.d = 0;
}
}
public void a(onPageChangeListener onpagechangelistener) {
this.k = onpagechangelistener;
}
}