Initial commit
This commit is contained in:
33
sources/androidx/recyclerview/R$dimen.java
Normal file
33
sources/androidx/recyclerview/R$dimen.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package androidx.recyclerview;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$dimen {
|
||||
public static final int compat_button_inset_horizontal_material = 2131165503;
|
||||
public static final int compat_button_inset_vertical_material = 2131165504;
|
||||
public static final int compat_button_padding_horizontal_material = 2131165505;
|
||||
public static final int compat_button_padding_vertical_material = 2131165506;
|
||||
public static final int compat_control_corner_material = 2131165507;
|
||||
public static final int compat_notification_large_icon_max_height = 2131165508;
|
||||
public static final int compat_notification_large_icon_max_width = 2131165509;
|
||||
public static final int fastscroll_default_thickness = 2131169804;
|
||||
public static final int fastscroll_margin = 2131169805;
|
||||
public static final int fastscroll_minimum_range = 2131169806;
|
||||
public static final int item_touch_helper_max_drag_scroll_per_frame = 2131169890;
|
||||
public static final int item_touch_helper_swipe_escape_max_velocity = 2131169891;
|
||||
public static final int item_touch_helper_swipe_escape_velocity = 2131169892;
|
||||
public static final int notification_action_icon_size = 2131172010;
|
||||
public static final int notification_action_text_size = 2131172011;
|
||||
public static final int notification_big_circle_margin = 2131172012;
|
||||
public static final int notification_content_margin_start = 2131172013;
|
||||
public static final int notification_large_icon_height = 2131172014;
|
||||
public static final int notification_large_icon_width = 2131172015;
|
||||
public static final int notification_main_column_padding_top = 2131172016;
|
||||
public static final int notification_media_narrow_margin = 2131172017;
|
||||
public static final int notification_right_icon_size = 2131172018;
|
||||
public static final int notification_right_side_padding_top = 2131172019;
|
||||
public static final int notification_small_icon_background_padding = 2131172020;
|
||||
public static final int notification_small_icon_size_as_large = 2131172021;
|
||||
public static final int notification_subtext_size = 2131172022;
|
||||
public static final int notification_top_pad = 2131172023;
|
||||
public static final int notification_top_pad_large_text = 2131172024;
|
||||
}
|
41
sources/androidx/recyclerview/R$id.java
Normal file
41
sources/androidx/recyclerview/R$id.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package androidx.recyclerview;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$id {
|
||||
public static final int action_container = 2131296279;
|
||||
public static final int action_divider = 2131296281;
|
||||
public static final int action_image = 2131296282;
|
||||
public static final int action_text = 2131296288;
|
||||
public static final int actions = 2131296289;
|
||||
public static final int async = 2131296326;
|
||||
public static final int blocking = 2131296343;
|
||||
public static final int bottom = 2131296348;
|
||||
public static final int chronometer = 2131296452;
|
||||
public static final int end = 2131296567;
|
||||
public static final int forever = 2131296644;
|
||||
public static final int icon = 2131296701;
|
||||
public static final int icon_group = 2131296702;
|
||||
public static final int info = 2131296971;
|
||||
public static final int italic = 2131296980;
|
||||
public static final int item_touch_helper_previous_elevation = 2131296991;
|
||||
public static final int left = 2131297071;
|
||||
public static final int line1 = 2131297087;
|
||||
public static final int line3 = 2131297088;
|
||||
public static final int none = 2131297193;
|
||||
public static final int normal = 2131297194;
|
||||
public static final int notification_background = 2131297195;
|
||||
public static final int notification_main_column = 2131297196;
|
||||
public static final int notification_main_column_container = 2131297197;
|
||||
public static final int right = 2131297305;
|
||||
public static final int right_icon = 2131297308;
|
||||
public static final int right_side = 2131297309;
|
||||
public static final int start = 2131297500;
|
||||
public static final int tag_transition_group = 2131297528;
|
||||
public static final int tag_unhandled_key_event_manager = 2131297529;
|
||||
public static final int tag_unhandled_key_listeners = 2131297530;
|
||||
public static final int text = 2131297537;
|
||||
public static final int text2 = 2131297538;
|
||||
public static final int time = 2131297551;
|
||||
public static final int title = 2131297555;
|
||||
public static final int top = 2131297568;
|
||||
}
|
68
sources/androidx/recyclerview/R$styleable.java
Normal file
68
sources/androidx/recyclerview/R$styleable.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package androidx.recyclerview;
|
||||
|
||||
import android.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$styleable {
|
||||
public static final int ColorStateListItem_alpha = 2;
|
||||
public static final int ColorStateListItem_android_alpha = 1;
|
||||
public static final int ColorStateListItem_android_color = 0;
|
||||
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
|
||||
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
|
||||
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
|
||||
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
|
||||
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
|
||||
public static final int CoordinatorLayout_keylines = 0;
|
||||
public static final int CoordinatorLayout_statusBarBackground = 1;
|
||||
public static final int FontFamilyFont_android_font = 0;
|
||||
public static final int FontFamilyFont_android_fontStyle = 2;
|
||||
public static final int FontFamilyFont_android_fontVariationSettings = 4;
|
||||
public static final int FontFamilyFont_android_fontWeight = 1;
|
||||
public static final int FontFamilyFont_android_ttcIndex = 3;
|
||||
public static final int FontFamilyFont_font = 5;
|
||||
public static final int FontFamilyFont_fontStyle = 6;
|
||||
public static final int FontFamilyFont_fontVariationSettings = 7;
|
||||
public static final int FontFamilyFont_fontWeight = 8;
|
||||
public static final int FontFamilyFont_ttcIndex = 9;
|
||||
public static final int FontFamily_fontProviderAuthority = 0;
|
||||
public static final int FontFamily_fontProviderCerts = 1;
|
||||
public static final int FontFamily_fontProviderFetchStrategy = 2;
|
||||
public static final int FontFamily_fontProviderFetchTimeout = 3;
|
||||
public static final int FontFamily_fontProviderPackage = 4;
|
||||
public static final int FontFamily_fontProviderQuery = 5;
|
||||
public static final int GradientColorItem_android_color = 0;
|
||||
public static final int GradientColorItem_android_offset = 1;
|
||||
public static final int GradientColor_android_centerColor = 7;
|
||||
public static final int GradientColor_android_centerX = 3;
|
||||
public static final int GradientColor_android_centerY = 4;
|
||||
public static final int GradientColor_android_endColor = 1;
|
||||
public static final int GradientColor_android_endX = 10;
|
||||
public static final int GradientColor_android_endY = 11;
|
||||
public static final int GradientColor_android_gradientRadius = 5;
|
||||
public static final int GradientColor_android_startColor = 0;
|
||||
public static final int GradientColor_android_startX = 8;
|
||||
public static final int GradientColor_android_startY = 9;
|
||||
public static final int GradientColor_android_tileMode = 6;
|
||||
public static final int GradientColor_android_type = 2;
|
||||
public static final int RecyclerView_android_descendantFocusability = 1;
|
||||
public static final int RecyclerView_android_orientation = 0;
|
||||
public static final int RecyclerView_fastScrollEnabled = 2;
|
||||
public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 3;
|
||||
public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 4;
|
||||
public static final int RecyclerView_fastScrollVerticalThumbDrawable = 5;
|
||||
public static final int RecyclerView_fastScrollVerticalTrackDrawable = 6;
|
||||
public static final int RecyclerView_layoutManager = 7;
|
||||
public static final int RecyclerView_reverseLayout = 8;
|
||||
public static final int RecyclerView_spanCount = 9;
|
||||
public static final int RecyclerView_stackFromEnd = 10;
|
||||
public static final int[] ColorStateListItem = {R.attr.color, R.attr.alpha, com.ubt.jimu.R.attr.alpha};
|
||||
public static final int[] CoordinatorLayout = {com.ubt.jimu.R.attr.keylines, com.ubt.jimu.R.attr.statusBarBackground};
|
||||
public static final int[] CoordinatorLayout_Layout = {R.attr.layout_gravity, com.ubt.jimu.R.attr.layout_anchor, com.ubt.jimu.R.attr.layout_anchorGravity, com.ubt.jimu.R.attr.layout_behavior, com.ubt.jimu.R.attr.layout_dodgeInsetEdges, com.ubt.jimu.R.attr.layout_insetEdge, com.ubt.jimu.R.attr.layout_keyline};
|
||||
public static final int[] FontFamily = {com.ubt.jimu.R.attr.fontProviderAuthority, com.ubt.jimu.R.attr.fontProviderCerts, com.ubt.jimu.R.attr.fontProviderFetchStrategy, com.ubt.jimu.R.attr.fontProviderFetchTimeout, com.ubt.jimu.R.attr.fontProviderPackage, com.ubt.jimu.R.attr.fontProviderQuery};
|
||||
public static final int[] FontFamilyFont = {R.attr.font, R.attr.fontWeight, R.attr.fontStyle, R.attr.ttcIndex, R.attr.fontVariationSettings, com.ubt.jimu.R.attr.font, com.ubt.jimu.R.attr.fontStyle, com.ubt.jimu.R.attr.fontVariationSettings, com.ubt.jimu.R.attr.fontWeight, com.ubt.jimu.R.attr.ttcIndex};
|
||||
public static final int[] GradientColor = {R.attr.startColor, R.attr.endColor, R.attr.type, R.attr.centerX, R.attr.centerY, R.attr.gradientRadius, R.attr.tileMode, R.attr.centerColor, R.attr.startX, R.attr.startY, R.attr.endX, R.attr.endY};
|
||||
public static final int[] GradientColorItem = {R.attr.color, R.attr.offset};
|
||||
public static final int[] RecyclerView = {R.attr.orientation, R.attr.descendantFocusability, com.ubt.jimu.R.attr.fastScrollEnabled, com.ubt.jimu.R.attr.fastScrollHorizontalThumbDrawable, com.ubt.jimu.R.attr.fastScrollHorizontalTrackDrawable, com.ubt.jimu.R.attr.fastScrollVerticalThumbDrawable, com.ubt.jimu.R.attr.fastScrollVerticalTrackDrawable, com.ubt.jimu.R.attr.layoutManager, com.ubt.jimu.R.attr.reverseLayout, com.ubt.jimu.R.attr.spanCount, com.ubt.jimu.R.attr.stackFromEnd};
|
||||
}
|
603
sources/androidx/recyclerview/widget/AdapterHelper.java
Normal file
603
sources/androidx/recyclerview/widget/AdapterHelper.java
Normal file
@@ -0,0 +1,603 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import androidx.core.util.Pools$SimplePool;
|
||||
import androidx.recyclerview.widget.OpReorderer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AdapterHelper implements OpReorderer.Callback {
|
||||
private Pools$Pool<UpdateOp> a;
|
||||
final ArrayList<UpdateOp> b;
|
||||
final ArrayList<UpdateOp> c;
|
||||
final Callback d;
|
||||
Runnable e;
|
||||
final boolean f;
|
||||
final OpReorderer g;
|
||||
private int h;
|
||||
|
||||
interface Callback {
|
||||
RecyclerView.ViewHolder a(int i);
|
||||
|
||||
void a(int i, int i2);
|
||||
|
||||
void a(int i, int i2, Object obj);
|
||||
|
||||
void a(UpdateOp updateOp);
|
||||
|
||||
void b(int i, int i2);
|
||||
|
||||
void b(UpdateOp updateOp);
|
||||
|
||||
void c(int i, int i2);
|
||||
|
||||
void d(int i, int i2);
|
||||
}
|
||||
|
||||
static class UpdateOp {
|
||||
int a;
|
||||
int b;
|
||||
Object c;
|
||||
int d;
|
||||
|
||||
UpdateOp(int i, int i2, int i3, Object obj) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
this.d = i3;
|
||||
this.c = obj;
|
||||
}
|
||||
|
||||
String a() {
|
||||
int i = this.a;
|
||||
return i != 1 ? i != 2 ? i != 4 ? i != 8 ? "??" : "mv" : "up" : "rm" : "add";
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || UpdateOp.class != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UpdateOp updateOp = (UpdateOp) obj;
|
||||
int i = this.a;
|
||||
if (i != updateOp.a) {
|
||||
return false;
|
||||
}
|
||||
if (i == 8 && Math.abs(this.d - this.b) == 1 && this.d == updateOp.b && this.b == updateOp.d) {
|
||||
return true;
|
||||
}
|
||||
if (this.d != updateOp.d || this.b != updateOp.b) {
|
||||
return false;
|
||||
}
|
||||
Object obj2 = this.c;
|
||||
if (obj2 != null) {
|
||||
if (!obj2.equals(updateOp.c)) {
|
||||
return false;
|
||||
}
|
||||
} else if (updateOp.c != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (((this.a * 31) + this.b) * 31) + this.d;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Integer.toHexString(System.identityHashCode(this)) + "[" + a() + ",s:" + this.b + "c:" + this.d + ",p:" + this.c + "]";
|
||||
}
|
||||
}
|
||||
|
||||
AdapterHelper(Callback callback) {
|
||||
this(callback, false);
|
||||
}
|
||||
|
||||
private void b(UpdateOp updateOp) {
|
||||
g(updateOp);
|
||||
}
|
||||
|
||||
private void c(UpdateOp updateOp) {
|
||||
g(updateOp);
|
||||
}
|
||||
|
||||
private void d(UpdateOp updateOp) {
|
||||
boolean z;
|
||||
char c;
|
||||
int i = updateOp.b;
|
||||
int i2 = updateOp.d + i;
|
||||
int i3 = 0;
|
||||
char c2 = 65535;
|
||||
int i4 = i;
|
||||
while (i4 < i2) {
|
||||
if (this.d.a(i4) != null || d(i4)) {
|
||||
if (c2 == 0) {
|
||||
f(a(2, i, i3, null));
|
||||
z = true;
|
||||
} else {
|
||||
z = false;
|
||||
}
|
||||
c = 1;
|
||||
} else {
|
||||
if (c2 == 1) {
|
||||
g(a(2, i, i3, null));
|
||||
z = true;
|
||||
} else {
|
||||
z = false;
|
||||
}
|
||||
c = 0;
|
||||
}
|
||||
if (z) {
|
||||
i4 -= i3;
|
||||
i2 -= i3;
|
||||
i3 = 1;
|
||||
} else {
|
||||
i3++;
|
||||
}
|
||||
i4++;
|
||||
c2 = c;
|
||||
}
|
||||
if (i3 != updateOp.d) {
|
||||
a(updateOp);
|
||||
updateOp = a(2, i, i3, null);
|
||||
}
|
||||
if (c2 == 0) {
|
||||
f(updateOp);
|
||||
} else {
|
||||
g(updateOp);
|
||||
}
|
||||
}
|
||||
|
||||
private void g(UpdateOp updateOp) {
|
||||
this.c.add(updateOp);
|
||||
int i = updateOp.a;
|
||||
if (i == 1) {
|
||||
this.d.c(updateOp.b, updateOp.d);
|
||||
return;
|
||||
}
|
||||
if (i == 2) {
|
||||
this.d.b(updateOp.b, updateOp.d);
|
||||
return;
|
||||
}
|
||||
if (i == 4) {
|
||||
this.d.a(updateOp.b, updateOp.d, updateOp.c);
|
||||
} else {
|
||||
if (i == 8) {
|
||||
this.d.a(updateOp.b, updateOp.d);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown update op type for " + updateOp);
|
||||
}
|
||||
}
|
||||
|
||||
void a() {
|
||||
int size = this.c.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.d.b(this.c.get(i));
|
||||
}
|
||||
a(this.c);
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
void e() {
|
||||
this.g.a(this.b);
|
||||
int size = this.b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
UpdateOp updateOp = this.b.get(i);
|
||||
int i2 = updateOp.a;
|
||||
if (i2 == 1) {
|
||||
b(updateOp);
|
||||
} else if (i2 == 2) {
|
||||
d(updateOp);
|
||||
} else if (i2 == 4) {
|
||||
e(updateOp);
|
||||
} else if (i2 == 8) {
|
||||
c(updateOp);
|
||||
}
|
||||
Runnable runnable = this.e;
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
this.b.clear();
|
||||
}
|
||||
|
||||
void f() {
|
||||
a(this.b);
|
||||
a(this.c);
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
AdapterHelper(Callback callback, boolean z) {
|
||||
this.a = new Pools$SimplePool(30);
|
||||
this.b = new ArrayList<>();
|
||||
this.c = new ArrayList<>();
|
||||
this.h = 0;
|
||||
this.d = callback;
|
||||
this.f = z;
|
||||
this.g = new OpReorderer(this);
|
||||
}
|
||||
|
||||
int b(int i) {
|
||||
return a(i, 0);
|
||||
}
|
||||
|
||||
boolean c() {
|
||||
return this.b.size() > 0;
|
||||
}
|
||||
|
||||
boolean b(int i, int i2) {
|
||||
if (i2 < 1) {
|
||||
return false;
|
||||
}
|
||||
this.b.add(a(1, i, i2, null));
|
||||
this.h |= 1;
|
||||
return this.b.size() == 1;
|
||||
}
|
||||
|
||||
boolean c(int i) {
|
||||
return (i & this.h) != 0;
|
||||
}
|
||||
|
||||
private void f(UpdateOp updateOp) {
|
||||
int i;
|
||||
int i2 = updateOp.a;
|
||||
if (i2 != 1 && i2 != 8) {
|
||||
int d = d(updateOp.b, i2);
|
||||
int i3 = updateOp.b;
|
||||
int i4 = updateOp.a;
|
||||
if (i4 == 2) {
|
||||
i = 0;
|
||||
} else {
|
||||
if (i4 != 4) {
|
||||
throw new IllegalArgumentException("op should be remove or update." + updateOp);
|
||||
}
|
||||
i = 1;
|
||||
}
|
||||
int i5 = d;
|
||||
int i6 = i3;
|
||||
int i7 = 1;
|
||||
for (int i8 = 1; i8 < updateOp.d; i8++) {
|
||||
int d2 = d(updateOp.b + (i * i8), updateOp.a);
|
||||
int i9 = updateOp.a;
|
||||
if (i9 == 2 ? d2 == i5 : i9 == 4 && d2 == i5 + 1) {
|
||||
i7++;
|
||||
} else {
|
||||
UpdateOp a = a(updateOp.a, i5, i7, updateOp.c);
|
||||
a(a, i6);
|
||||
a(a);
|
||||
if (updateOp.a == 4) {
|
||||
i6 += i7;
|
||||
}
|
||||
i5 = d2;
|
||||
i7 = 1;
|
||||
}
|
||||
}
|
||||
Object obj = updateOp.c;
|
||||
a(updateOp);
|
||||
if (i7 > 0) {
|
||||
UpdateOp a2 = a(updateOp.a, i5, i7, obj);
|
||||
a(a2, i6);
|
||||
a(a2);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("should not dispatch add or move for pre layout");
|
||||
}
|
||||
|
||||
boolean c(int i, int i2) {
|
||||
if (i2 < 1) {
|
||||
return false;
|
||||
}
|
||||
this.b.add(a(2, i, i2, null));
|
||||
this.h |= 2;
|
||||
return this.b.size() == 1;
|
||||
}
|
||||
|
||||
void a(UpdateOp updateOp, int i) {
|
||||
this.d.a(updateOp);
|
||||
int i2 = updateOp.a;
|
||||
if (i2 == 2) {
|
||||
this.d.d(i, updateOp.d);
|
||||
} else {
|
||||
if (i2 == 4) {
|
||||
this.d.a(i, updateOp.d, updateOp.c);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("only remove and update ops can be dispatched in first pass");
|
||||
}
|
||||
}
|
||||
|
||||
void b() {
|
||||
a();
|
||||
int size = this.b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
UpdateOp updateOp = this.b.get(i);
|
||||
int i2 = updateOp.a;
|
||||
if (i2 == 1) {
|
||||
this.d.b(updateOp);
|
||||
this.d.c(updateOp.b, updateOp.d);
|
||||
} else if (i2 == 2) {
|
||||
this.d.b(updateOp);
|
||||
this.d.d(updateOp.b, updateOp.d);
|
||||
} else if (i2 == 4) {
|
||||
this.d.b(updateOp);
|
||||
this.d.a(updateOp.b, updateOp.d, updateOp.c);
|
||||
} else if (i2 == 8) {
|
||||
this.d.b(updateOp);
|
||||
this.d.a(updateOp.b, updateOp.d);
|
||||
}
|
||||
Runnable runnable = this.e;
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
a(this.b);
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
int a(int i, int i2) {
|
||||
int size = this.c.size();
|
||||
while (i2 < size) {
|
||||
UpdateOp updateOp = this.c.get(i2);
|
||||
int i3 = updateOp.a;
|
||||
if (i3 == 8) {
|
||||
int i4 = updateOp.b;
|
||||
if (i4 == i) {
|
||||
i = updateOp.d;
|
||||
} else {
|
||||
if (i4 < i) {
|
||||
i--;
|
||||
}
|
||||
if (updateOp.d <= i) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int i5 = updateOp.b;
|
||||
if (i5 > i) {
|
||||
continue;
|
||||
} else if (i3 == 2) {
|
||||
int i6 = updateOp.d;
|
||||
if (i < i5 + i6) {
|
||||
return -1;
|
||||
}
|
||||
i -= i6;
|
||||
} else if (i3 == 1) {
|
||||
i += updateOp.d;
|
||||
}
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private void e(UpdateOp updateOp) {
|
||||
int i = updateOp.b;
|
||||
int i2 = updateOp.d + i;
|
||||
int i3 = i;
|
||||
int i4 = 0;
|
||||
char c = 65535;
|
||||
while (i < i2) {
|
||||
if (this.d.a(i) != null || d(i)) {
|
||||
if (c == 0) {
|
||||
f(a(4, i3, i4, updateOp.c));
|
||||
i3 = i;
|
||||
i4 = 0;
|
||||
}
|
||||
c = 1;
|
||||
} else {
|
||||
if (c == 1) {
|
||||
g(a(4, i3, i4, updateOp.c));
|
||||
i3 = i;
|
||||
i4 = 0;
|
||||
}
|
||||
c = 0;
|
||||
}
|
||||
i4++;
|
||||
i++;
|
||||
}
|
||||
if (i4 != updateOp.d) {
|
||||
Object obj = updateOp.c;
|
||||
a(updateOp);
|
||||
updateOp = a(4, i3, i4, obj);
|
||||
}
|
||||
if (c == 0) {
|
||||
f(updateOp);
|
||||
} else {
|
||||
g(updateOp);
|
||||
}
|
||||
}
|
||||
|
||||
private int d(int i, int i2) {
|
||||
for (int size = this.c.size() - 1; size >= 0; size--) {
|
||||
UpdateOp updateOp = this.c.get(size);
|
||||
int i3 = updateOp.a;
|
||||
if (i3 == 8) {
|
||||
int i4 = updateOp.b;
|
||||
int i5 = updateOp.d;
|
||||
if (i4 >= i5) {
|
||||
i5 = i4;
|
||||
i4 = i5;
|
||||
}
|
||||
if (i >= i4 && i <= i5) {
|
||||
int i6 = updateOp.b;
|
||||
if (i4 == i6) {
|
||||
if (i2 == 1) {
|
||||
updateOp.d++;
|
||||
} else if (i2 == 2) {
|
||||
updateOp.d--;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
if (i2 == 1) {
|
||||
updateOp.b = i6 + 1;
|
||||
} else if (i2 == 2) {
|
||||
updateOp.b = i6 - 1;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
int i7 = updateOp.b;
|
||||
if (i < i7) {
|
||||
if (i2 == 1) {
|
||||
updateOp.b = i7 + 1;
|
||||
updateOp.d++;
|
||||
} else if (i2 == 2) {
|
||||
updateOp.b = i7 - 1;
|
||||
updateOp.d--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int i8 = updateOp.b;
|
||||
if (i8 <= i) {
|
||||
if (i3 == 1) {
|
||||
i -= updateOp.d;
|
||||
} else if (i3 == 2) {
|
||||
i += updateOp.d;
|
||||
}
|
||||
} else if (i2 == 1) {
|
||||
updateOp.b = i8 + 1;
|
||||
} else if (i2 == 2) {
|
||||
updateOp.b = i8 - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int size2 = this.c.size() - 1; size2 >= 0; size2--) {
|
||||
UpdateOp updateOp2 = this.c.get(size2);
|
||||
if (updateOp2.a == 8) {
|
||||
int i9 = updateOp2.d;
|
||||
if (i9 == updateOp2.b || i9 < 0) {
|
||||
this.c.remove(size2);
|
||||
a(updateOp2);
|
||||
}
|
||||
} else if (updateOp2.d <= 0) {
|
||||
this.c.remove(size2);
|
||||
a(updateOp2);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
boolean a(int i, int i2, Object obj) {
|
||||
if (i2 < 1) {
|
||||
return false;
|
||||
}
|
||||
this.b.add(a(4, i, i2, obj));
|
||||
this.h |= 4;
|
||||
return this.b.size() == 1;
|
||||
}
|
||||
|
||||
boolean a(int i, int i2, int i3) {
|
||||
if (i == i2) {
|
||||
return false;
|
||||
}
|
||||
if (i3 == 1) {
|
||||
this.b.add(a(8, i, i2, null));
|
||||
this.h |= 8;
|
||||
return this.b.size() == 1;
|
||||
}
|
||||
throw new IllegalArgumentException("Moving more than 1 item is not supported yet");
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
int size = this.b.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
UpdateOp updateOp = this.b.get(i2);
|
||||
int i3 = updateOp.a;
|
||||
if (i3 != 1) {
|
||||
if (i3 == 2) {
|
||||
int i4 = updateOp.b;
|
||||
if (i4 <= i) {
|
||||
int i5 = updateOp.d;
|
||||
if (i4 + i5 > i) {
|
||||
return -1;
|
||||
}
|
||||
i -= i5;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if (i3 == 8) {
|
||||
int i6 = updateOp.b;
|
||||
if (i6 == i) {
|
||||
i = updateOp.d;
|
||||
} else {
|
||||
if (i6 < i) {
|
||||
i--;
|
||||
}
|
||||
if (updateOp.d <= i) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (updateOp.b <= i) {
|
||||
i += updateOp.d;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OpReorderer.Callback
|
||||
public UpdateOp a(int i, int i2, int i3, Object obj) {
|
||||
UpdateOp a = this.a.a();
|
||||
if (a == null) {
|
||||
return new UpdateOp(i, i2, i3, obj);
|
||||
}
|
||||
a.a = i;
|
||||
a.b = i2;
|
||||
a.d = i3;
|
||||
a.c = obj;
|
||||
return a;
|
||||
}
|
||||
|
||||
private boolean d(int i) {
|
||||
int size = this.c.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
UpdateOp updateOp = this.c.get(i2);
|
||||
int i3 = updateOp.a;
|
||||
if (i3 == 8) {
|
||||
if (a(updateOp.d, i2 + 1) == i) {
|
||||
return true;
|
||||
}
|
||||
} else if (i3 == 1) {
|
||||
int i4 = updateOp.b;
|
||||
int i5 = updateOp.d + i4;
|
||||
while (i4 < i5) {
|
||||
if (a(i4, i2 + 1) == i) {
|
||||
return true;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OpReorderer.Callback
|
||||
public void a(UpdateOp updateOp) {
|
||||
if (this.f) {
|
||||
return;
|
||||
}
|
||||
updateOp.c = null;
|
||||
this.a.a(updateOp);
|
||||
}
|
||||
|
||||
void a(List<UpdateOp> list) {
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
a(list.get(i));
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
|
||||
boolean d() {
|
||||
return (this.c.isEmpty() || this.b.isEmpty()) ? false : true;
|
||||
}
|
||||
}
|
335
sources/androidx/recyclerview/widget/ChildHelper.java
Normal file
335
sources/androidx/recyclerview/widget/ChildHelper.java
Normal file
@@ -0,0 +1,335 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ChildHelper {
|
||||
final Callback a;
|
||||
final Bucket b = new Bucket();
|
||||
final List<View> c = new ArrayList();
|
||||
|
||||
interface Callback {
|
||||
int a();
|
||||
|
||||
View a(int i);
|
||||
|
||||
void a(View view);
|
||||
|
||||
void a(View view, int i);
|
||||
|
||||
void a(View view, int i, ViewGroup.LayoutParams layoutParams);
|
||||
|
||||
int b(View view);
|
||||
|
||||
void b();
|
||||
|
||||
void b(int i);
|
||||
|
||||
RecyclerView.ViewHolder c(View view);
|
||||
|
||||
void c(int i);
|
||||
|
||||
void d(View view);
|
||||
}
|
||||
|
||||
ChildHelper(Callback callback) {
|
||||
this.a = callback;
|
||||
}
|
||||
|
||||
private int f(int i) {
|
||||
if (i < 0) {
|
||||
return -1;
|
||||
}
|
||||
int a = this.a.a();
|
||||
int i2 = i;
|
||||
while (i2 < a) {
|
||||
int b = i - (i2 - this.b.b(i2));
|
||||
if (b == 0) {
|
||||
while (this.b.c(i2)) {
|
||||
i2++;
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
i2 += b;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void g(View view) {
|
||||
this.c.add(view);
|
||||
this.a.a(view);
|
||||
}
|
||||
|
||||
private boolean h(View view) {
|
||||
if (!this.c.remove(view)) {
|
||||
return false;
|
||||
}
|
||||
this.a.d(view);
|
||||
return true;
|
||||
}
|
||||
|
||||
void a(View view, boolean z) {
|
||||
a(view, -1, z);
|
||||
}
|
||||
|
||||
View b(int i) {
|
||||
int size = this.c.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
View view = this.c.get(i2);
|
||||
RecyclerView.ViewHolder c = this.a.c(view);
|
||||
if (c.getLayoutPosition() == i && !c.isInvalid() && !c.isRemoved()) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
View c(int i) {
|
||||
return this.a.a(f(i));
|
||||
}
|
||||
|
||||
void d(View view) {
|
||||
int b = this.a.b(view);
|
||||
if (b < 0) {
|
||||
return;
|
||||
}
|
||||
if (this.b.d(b)) {
|
||||
h(view);
|
||||
}
|
||||
this.a.c(b);
|
||||
}
|
||||
|
||||
void e(int i) {
|
||||
int f = f(i);
|
||||
View a = this.a.a(f);
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
if (this.b.d(f)) {
|
||||
h(a);
|
||||
}
|
||||
this.a.c(f);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.b.toString() + ", hidden list:" + this.c.size();
|
||||
}
|
||||
|
||||
static class Bucket {
|
||||
long a = 0;
|
||||
Bucket b;
|
||||
|
||||
Bucket() {
|
||||
}
|
||||
|
||||
private void b() {
|
||||
if (this.b == null) {
|
||||
this.b = new Bucket();
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
if (i < 64) {
|
||||
this.a &= ~(1 << i);
|
||||
return;
|
||||
}
|
||||
Bucket bucket = this.b;
|
||||
if (bucket != null) {
|
||||
bucket.a(i - 64);
|
||||
}
|
||||
}
|
||||
|
||||
boolean c(int i) {
|
||||
if (i < 64) {
|
||||
return (this.a & (1 << i)) != 0;
|
||||
}
|
||||
b();
|
||||
return this.b.c(i - 64);
|
||||
}
|
||||
|
||||
boolean d(int i) {
|
||||
if (i >= 64) {
|
||||
b();
|
||||
return this.b.d(i - 64);
|
||||
}
|
||||
long j = 1 << i;
|
||||
boolean z = (this.a & j) != 0;
|
||||
this.a &= ~j;
|
||||
long j2 = j - 1;
|
||||
long j3 = this.a;
|
||||
this.a = Long.rotateRight(j3 & (~j2), 1) | (j3 & j2);
|
||||
Bucket bucket = this.b;
|
||||
if (bucket != null) {
|
||||
if (bucket.c(0)) {
|
||||
e(63);
|
||||
}
|
||||
this.b.d(0);
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
void e(int i) {
|
||||
if (i < 64) {
|
||||
this.a |= 1 << i;
|
||||
} else {
|
||||
b();
|
||||
this.b.e(i - 64);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (this.b == null) {
|
||||
return Long.toBinaryString(this.a);
|
||||
}
|
||||
return this.b.toString() + "xx" + Long.toBinaryString(this.a);
|
||||
}
|
||||
|
||||
int b(int i) {
|
||||
Bucket bucket = this.b;
|
||||
if (bucket == null) {
|
||||
if (i >= 64) {
|
||||
return Long.bitCount(this.a);
|
||||
}
|
||||
return Long.bitCount(this.a & ((1 << i) - 1));
|
||||
}
|
||||
if (i < 64) {
|
||||
return Long.bitCount(this.a & ((1 << i) - 1));
|
||||
}
|
||||
return bucket.b(i - 64) + Long.bitCount(this.a);
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.a = 0L;
|
||||
Bucket bucket = this.b;
|
||||
if (bucket != null) {
|
||||
bucket.a();
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i, boolean z) {
|
||||
if (i >= 64) {
|
||||
b();
|
||||
this.b.a(i - 64, z);
|
||||
return;
|
||||
}
|
||||
boolean z2 = (this.a & Long.MIN_VALUE) != 0;
|
||||
long j = (1 << i) - 1;
|
||||
long j2 = this.a;
|
||||
this.a = ((j2 & (~j)) << 1) | (j2 & j);
|
||||
if (z) {
|
||||
e(i);
|
||||
} else {
|
||||
a(i);
|
||||
}
|
||||
if (z2 || this.b != null) {
|
||||
b();
|
||||
this.b.a(0, z2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(View view, int i, boolean z) {
|
||||
int a = i < 0 ? this.a.a() : f(i);
|
||||
this.b.a(a, z);
|
||||
if (z) {
|
||||
g(view);
|
||||
}
|
||||
this.a.a(view, a);
|
||||
}
|
||||
|
||||
void c() {
|
||||
this.b.a();
|
||||
for (int size = this.c.size() - 1; size >= 0; size--) {
|
||||
this.a.d(this.c.get(size));
|
||||
this.c.remove(size);
|
||||
}
|
||||
this.a.b();
|
||||
}
|
||||
|
||||
void f(View view) {
|
||||
int b = this.a.b(view);
|
||||
if (b >= 0) {
|
||||
if (this.b.c(b)) {
|
||||
this.b.a(b);
|
||||
h(view);
|
||||
return;
|
||||
} else {
|
||||
throw new RuntimeException("trying to unhide a view that was not hidden" + view);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("view is not a child, cannot hide " + view);
|
||||
}
|
||||
|
||||
View d(int i) {
|
||||
return this.a.a(i);
|
||||
}
|
||||
|
||||
boolean e(View view) {
|
||||
int b = this.a.b(view);
|
||||
if (b == -1) {
|
||||
h(view);
|
||||
return true;
|
||||
}
|
||||
if (!this.b.c(b)) {
|
||||
return false;
|
||||
}
|
||||
this.b.d(b);
|
||||
h(view);
|
||||
this.a.c(b);
|
||||
return true;
|
||||
}
|
||||
|
||||
void a(View view, int i, ViewGroup.LayoutParams layoutParams, boolean z) {
|
||||
int f;
|
||||
if (i < 0) {
|
||||
f = this.a.a();
|
||||
} else {
|
||||
f = f(i);
|
||||
}
|
||||
this.b.a(f, z);
|
||||
if (z) {
|
||||
g(view);
|
||||
}
|
||||
this.a.a(view, f, layoutParams);
|
||||
}
|
||||
|
||||
int b() {
|
||||
return this.a.a();
|
||||
}
|
||||
|
||||
int b(View view) {
|
||||
int b = this.a.b(view);
|
||||
if (b == -1 || this.b.c(b)) {
|
||||
return -1;
|
||||
}
|
||||
return b - this.b.b(b);
|
||||
}
|
||||
|
||||
boolean c(View view) {
|
||||
return this.c.contains(view);
|
||||
}
|
||||
|
||||
int a() {
|
||||
return this.a.a() - this.c.size();
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
int f = f(i);
|
||||
this.b.d(f);
|
||||
this.a.b(f);
|
||||
}
|
||||
|
||||
void a(View view) {
|
||||
int b = this.a.b(view);
|
||||
if (b >= 0) {
|
||||
this.b.e(b);
|
||||
g(view);
|
||||
} else {
|
||||
throw new IllegalArgumentException("view is not a child, cannot hide " + view);
|
||||
}
|
||||
}
|
||||
}
|
566
sources/androidx/recyclerview/widget/DefaultItemAnimator.java
Normal file
566
sources/androidx/recyclerview/widget/DefaultItemAnimator.java
Normal file
@@ -0,0 +1,566 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultItemAnimator extends SimpleItemAnimator {
|
||||
private static TimeInterpolator s;
|
||||
private ArrayList<RecyclerView.ViewHolder> h = new ArrayList<>();
|
||||
private ArrayList<RecyclerView.ViewHolder> i = new ArrayList<>();
|
||||
private ArrayList<MoveInfo> j = new ArrayList<>();
|
||||
private ArrayList<ChangeInfo> k = new ArrayList<>();
|
||||
ArrayList<ArrayList<RecyclerView.ViewHolder>> l = new ArrayList<>();
|
||||
ArrayList<ArrayList<MoveInfo>> m = new ArrayList<>();
|
||||
ArrayList<ArrayList<ChangeInfo>> n = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> o = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> p = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> q = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> r = new ArrayList<>();
|
||||
|
||||
private static class MoveInfo {
|
||||
public RecyclerView.ViewHolder a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
|
||||
MoveInfo(RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4) {
|
||||
this.a = viewHolder;
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
this.d = i3;
|
||||
this.e = i4;
|
||||
}
|
||||
}
|
||||
|
||||
private void u(final RecyclerView.ViewHolder viewHolder) {
|
||||
final View view = viewHolder.itemView;
|
||||
final ViewPropertyAnimator animate = view.animate();
|
||||
this.q.add(viewHolder);
|
||||
animate.setDuration(f()).alpha(0.0f).setListener(new AnimatorListenerAdapter() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.4
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animate.setListener(null);
|
||||
view.setAlpha(1.0f);
|
||||
DefaultItemAnimator.this.l(viewHolder);
|
||||
DefaultItemAnimator.this.q.remove(viewHolder);
|
||||
DefaultItemAnimator.this.j();
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DefaultItemAnimator.this.m(viewHolder);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void v(RecyclerView.ViewHolder viewHolder) {
|
||||
if (s == null) {
|
||||
s = new ValueAnimator().getInterpolator();
|
||||
}
|
||||
viewHolder.itemView.animate().setInterpolator(s);
|
||||
c(viewHolder);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.SimpleItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4) {
|
||||
View view = viewHolder.itemView;
|
||||
int translationX = i + ((int) view.getTranslationX());
|
||||
int translationY = i2 + ((int) viewHolder.itemView.getTranslationY());
|
||||
v(viewHolder);
|
||||
int i5 = i3 - translationX;
|
||||
int i6 = i4 - translationY;
|
||||
if (i5 == 0 && i6 == 0) {
|
||||
j(viewHolder);
|
||||
return false;
|
||||
}
|
||||
if (i5 != 0) {
|
||||
view.setTranslationX(-i5);
|
||||
}
|
||||
if (i6 != 0) {
|
||||
view.setTranslationY(-i6);
|
||||
}
|
||||
this.j.add(new MoveInfo(viewHolder, translationX, translationY, i3, i4));
|
||||
return true;
|
||||
}
|
||||
|
||||
void b(final RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4) {
|
||||
final View view = viewHolder.itemView;
|
||||
final int i5 = i3 - i;
|
||||
final int i6 = i4 - i2;
|
||||
if (i5 != 0) {
|
||||
view.animate().translationX(0.0f);
|
||||
}
|
||||
if (i6 != 0) {
|
||||
view.animate().translationY(0.0f);
|
||||
}
|
||||
final ViewPropertyAnimator animate = view.animate();
|
||||
this.p.add(viewHolder);
|
||||
animate.setDuration(e()).setListener(new AnimatorListenerAdapter() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.6
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
if (i5 != 0) {
|
||||
view.setTranslationX(0.0f);
|
||||
}
|
||||
if (i6 != 0) {
|
||||
view.setTranslationY(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animate.setListener(null);
|
||||
DefaultItemAnimator.this.j(viewHolder);
|
||||
DefaultItemAnimator.this.p.remove(viewHolder);
|
||||
DefaultItemAnimator.this.j();
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DefaultItemAnimator.this.k(viewHolder);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public void c(RecyclerView.ViewHolder viewHolder) {
|
||||
View view = viewHolder.itemView;
|
||||
view.animate().cancel();
|
||||
int size = this.j.size();
|
||||
while (true) {
|
||||
size--;
|
||||
if (size < 0) {
|
||||
break;
|
||||
}
|
||||
if (this.j.get(size).a == viewHolder) {
|
||||
view.setTranslationY(0.0f);
|
||||
view.setTranslationX(0.0f);
|
||||
j(viewHolder);
|
||||
this.j.remove(size);
|
||||
}
|
||||
}
|
||||
a(this.k, viewHolder);
|
||||
if (this.h.remove(viewHolder)) {
|
||||
view.setAlpha(1.0f);
|
||||
l(viewHolder);
|
||||
}
|
||||
if (this.i.remove(viewHolder)) {
|
||||
view.setAlpha(1.0f);
|
||||
h(viewHolder);
|
||||
}
|
||||
for (int size2 = this.n.size() - 1; size2 >= 0; size2--) {
|
||||
ArrayList<ChangeInfo> arrayList = this.n.get(size2);
|
||||
a(arrayList, viewHolder);
|
||||
if (arrayList.isEmpty()) {
|
||||
this.n.remove(size2);
|
||||
}
|
||||
}
|
||||
for (int size3 = this.m.size() - 1; size3 >= 0; size3--) {
|
||||
ArrayList<MoveInfo> arrayList2 = this.m.get(size3);
|
||||
int size4 = arrayList2.size() - 1;
|
||||
while (true) {
|
||||
if (size4 < 0) {
|
||||
break;
|
||||
}
|
||||
if (arrayList2.get(size4).a == viewHolder) {
|
||||
view.setTranslationY(0.0f);
|
||||
view.setTranslationX(0.0f);
|
||||
j(viewHolder);
|
||||
arrayList2.remove(size4);
|
||||
if (arrayList2.isEmpty()) {
|
||||
this.m.remove(size3);
|
||||
}
|
||||
} else {
|
||||
size4--;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int size5 = this.l.size() - 1; size5 >= 0; size5--) {
|
||||
ArrayList<RecyclerView.ViewHolder> arrayList3 = this.l.get(size5);
|
||||
if (arrayList3.remove(viewHolder)) {
|
||||
view.setAlpha(1.0f);
|
||||
h(viewHolder);
|
||||
if (arrayList3.isEmpty()) {
|
||||
this.l.remove(size5);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.q.remove(viewHolder);
|
||||
this.o.remove(viewHolder);
|
||||
this.r.remove(viewHolder);
|
||||
this.p.remove(viewHolder);
|
||||
j();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.SimpleItemAnimator
|
||||
public boolean f(RecyclerView.ViewHolder viewHolder) {
|
||||
v(viewHolder);
|
||||
viewHolder.itemView.setAlpha(0.0f);
|
||||
this.i.add(viewHolder);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.SimpleItemAnimator
|
||||
public boolean g(RecyclerView.ViewHolder viewHolder) {
|
||||
v(viewHolder);
|
||||
this.h.add(viewHolder);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public void i() {
|
||||
boolean z = !this.h.isEmpty();
|
||||
boolean z2 = !this.j.isEmpty();
|
||||
boolean z3 = !this.k.isEmpty();
|
||||
boolean z4 = !this.i.isEmpty();
|
||||
if (z || z2 || z4 || z3) {
|
||||
Iterator<RecyclerView.ViewHolder> it = this.h.iterator();
|
||||
while (it.hasNext()) {
|
||||
u(it.next());
|
||||
}
|
||||
this.h.clear();
|
||||
if (z2) {
|
||||
final ArrayList<MoveInfo> arrayList = new ArrayList<>();
|
||||
arrayList.addAll(this.j);
|
||||
this.m.add(arrayList);
|
||||
this.j.clear();
|
||||
Runnable runnable = new Runnable() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Iterator it2 = arrayList.iterator();
|
||||
while (it2.hasNext()) {
|
||||
MoveInfo moveInfo = (MoveInfo) it2.next();
|
||||
DefaultItemAnimator.this.b(moveInfo.a, moveInfo.b, moveInfo.c, moveInfo.d, moveInfo.e);
|
||||
}
|
||||
arrayList.clear();
|
||||
DefaultItemAnimator.this.m.remove(arrayList);
|
||||
}
|
||||
};
|
||||
if (z) {
|
||||
ViewCompat.a(arrayList.get(0).a.itemView, runnable, f());
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
final ArrayList<ChangeInfo> arrayList2 = new ArrayList<>();
|
||||
arrayList2.addAll(this.k);
|
||||
this.n.add(arrayList2);
|
||||
this.k.clear();
|
||||
Runnable runnable2 = new Runnable() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Iterator it2 = arrayList2.iterator();
|
||||
while (it2.hasNext()) {
|
||||
DefaultItemAnimator.this.a((ChangeInfo) it2.next());
|
||||
}
|
||||
arrayList2.clear();
|
||||
DefaultItemAnimator.this.n.remove(arrayList2);
|
||||
}
|
||||
};
|
||||
if (z) {
|
||||
ViewCompat.a(arrayList2.get(0).a.itemView, runnable2, f());
|
||||
} else {
|
||||
runnable2.run();
|
||||
}
|
||||
}
|
||||
if (z4) {
|
||||
final ArrayList<RecyclerView.ViewHolder> arrayList3 = new ArrayList<>();
|
||||
arrayList3.addAll(this.i);
|
||||
this.l.add(arrayList3);
|
||||
this.i.clear();
|
||||
Runnable runnable3 = new Runnable() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Iterator it2 = arrayList3.iterator();
|
||||
while (it2.hasNext()) {
|
||||
DefaultItemAnimator.this.t((RecyclerView.ViewHolder) it2.next());
|
||||
}
|
||||
arrayList3.clear();
|
||||
DefaultItemAnimator.this.l.remove(arrayList3);
|
||||
}
|
||||
};
|
||||
if (z || z2 || z3) {
|
||||
ViewCompat.a(arrayList3.get(0).itemView, runnable3, (z ? f() : 0L) + Math.max(z2 ? e() : 0L, z3 ? d() : 0L));
|
||||
} else {
|
||||
runnable3.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void j() {
|
||||
if (g()) {
|
||||
return;
|
||||
}
|
||||
a();
|
||||
}
|
||||
|
||||
void t(final RecyclerView.ViewHolder viewHolder) {
|
||||
final View view = viewHolder.itemView;
|
||||
final ViewPropertyAnimator animate = view.animate();
|
||||
this.o.add(viewHolder);
|
||||
animate.alpha(1.0f).setDuration(c()).setListener(new AnimatorListenerAdapter() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.5
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
view.setAlpha(1.0f);
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animate.setListener(null);
|
||||
DefaultItemAnimator.this.h(viewHolder);
|
||||
DefaultItemAnimator.this.o.remove(viewHolder);
|
||||
DefaultItemAnimator.this.j();
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DefaultItemAnimator.this.i(viewHolder);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static class ChangeInfo {
|
||||
public RecyclerView.ViewHolder a;
|
||||
public RecyclerView.ViewHolder b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public int f;
|
||||
|
||||
private ChangeInfo(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2) {
|
||||
this.a = viewHolder;
|
||||
this.b = viewHolder2;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ChangeInfo{oldHolder=" + this.a + ", newHolder=" + this.b + ", fromX=" + this.c + ", fromY=" + this.d + ", toX=" + this.e + ", toY=" + this.f + '}';
|
||||
}
|
||||
|
||||
ChangeInfo(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2, int i, int i2, int i3, int i4) {
|
||||
this(viewHolder, viewHolder2);
|
||||
this.c = i;
|
||||
this.d = i2;
|
||||
this.e = i3;
|
||||
this.f = i4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean g() {
|
||||
return (this.i.isEmpty() && this.k.isEmpty() && this.j.isEmpty() && this.h.isEmpty() && this.p.isEmpty() && this.q.isEmpty() && this.o.isEmpty() && this.r.isEmpty() && this.m.isEmpty() && this.l.isEmpty() && this.n.isEmpty()) ? false : true;
|
||||
}
|
||||
|
||||
private void b(ChangeInfo changeInfo) {
|
||||
RecyclerView.ViewHolder viewHolder = changeInfo.a;
|
||||
if (viewHolder != null) {
|
||||
a(changeInfo, viewHolder);
|
||||
}
|
||||
RecyclerView.ViewHolder viewHolder2 = changeInfo.b;
|
||||
if (viewHolder2 != null) {
|
||||
a(changeInfo, viewHolder2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.SimpleItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2, int i, int i2, int i3, int i4) {
|
||||
if (viewHolder == viewHolder2) {
|
||||
return a(viewHolder, i, i2, i3, i4);
|
||||
}
|
||||
float translationX = viewHolder.itemView.getTranslationX();
|
||||
float translationY = viewHolder.itemView.getTranslationY();
|
||||
float alpha = viewHolder.itemView.getAlpha();
|
||||
v(viewHolder);
|
||||
int i5 = (int) ((i3 - i) - translationX);
|
||||
int i6 = (int) ((i4 - i2) - translationY);
|
||||
viewHolder.itemView.setTranslationX(translationX);
|
||||
viewHolder.itemView.setTranslationY(translationY);
|
||||
viewHolder.itemView.setAlpha(alpha);
|
||||
if (viewHolder2 != null) {
|
||||
v(viewHolder2);
|
||||
viewHolder2.itemView.setTranslationX(-i5);
|
||||
viewHolder2.itemView.setTranslationY(-i6);
|
||||
viewHolder2.itemView.setAlpha(0.0f);
|
||||
}
|
||||
this.k.add(new ChangeInfo(viewHolder, viewHolder2, i, i2, i3, i4));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public void b() {
|
||||
int size = this.j.size();
|
||||
while (true) {
|
||||
size--;
|
||||
if (size < 0) {
|
||||
break;
|
||||
}
|
||||
MoveInfo moveInfo = this.j.get(size);
|
||||
View view = moveInfo.a.itemView;
|
||||
view.setTranslationY(0.0f);
|
||||
view.setTranslationX(0.0f);
|
||||
j(moveInfo.a);
|
||||
this.j.remove(size);
|
||||
}
|
||||
for (int size2 = this.h.size() - 1; size2 >= 0; size2--) {
|
||||
l(this.h.get(size2));
|
||||
this.h.remove(size2);
|
||||
}
|
||||
int size3 = this.i.size();
|
||||
while (true) {
|
||||
size3--;
|
||||
if (size3 < 0) {
|
||||
break;
|
||||
}
|
||||
RecyclerView.ViewHolder viewHolder = this.i.get(size3);
|
||||
viewHolder.itemView.setAlpha(1.0f);
|
||||
h(viewHolder);
|
||||
this.i.remove(size3);
|
||||
}
|
||||
for (int size4 = this.k.size() - 1; size4 >= 0; size4--) {
|
||||
b(this.k.get(size4));
|
||||
}
|
||||
this.k.clear();
|
||||
if (g()) {
|
||||
for (int size5 = this.m.size() - 1; size5 >= 0; size5--) {
|
||||
ArrayList<MoveInfo> arrayList = this.m.get(size5);
|
||||
for (int size6 = arrayList.size() - 1; size6 >= 0; size6--) {
|
||||
MoveInfo moveInfo2 = arrayList.get(size6);
|
||||
View view2 = moveInfo2.a.itemView;
|
||||
view2.setTranslationY(0.0f);
|
||||
view2.setTranslationX(0.0f);
|
||||
j(moveInfo2.a);
|
||||
arrayList.remove(size6);
|
||||
if (arrayList.isEmpty()) {
|
||||
this.m.remove(arrayList);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int size7 = this.l.size() - 1; size7 >= 0; size7--) {
|
||||
ArrayList<RecyclerView.ViewHolder> arrayList2 = this.l.get(size7);
|
||||
for (int size8 = arrayList2.size() - 1; size8 >= 0; size8--) {
|
||||
RecyclerView.ViewHolder viewHolder2 = arrayList2.get(size8);
|
||||
viewHolder2.itemView.setAlpha(1.0f);
|
||||
h(viewHolder2);
|
||||
arrayList2.remove(size8);
|
||||
if (arrayList2.isEmpty()) {
|
||||
this.l.remove(arrayList2);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int size9 = this.n.size() - 1; size9 >= 0; size9--) {
|
||||
ArrayList<ChangeInfo> arrayList3 = this.n.get(size9);
|
||||
for (int size10 = arrayList3.size() - 1; size10 >= 0; size10--) {
|
||||
b(arrayList3.get(size10));
|
||||
if (arrayList3.isEmpty()) {
|
||||
this.n.remove(arrayList3);
|
||||
}
|
||||
}
|
||||
}
|
||||
a(this.q);
|
||||
a(this.p);
|
||||
a(this.o);
|
||||
a(this.r);
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
void a(final ChangeInfo changeInfo) {
|
||||
RecyclerView.ViewHolder viewHolder = changeInfo.a;
|
||||
final View view = viewHolder == null ? null : viewHolder.itemView;
|
||||
RecyclerView.ViewHolder viewHolder2 = changeInfo.b;
|
||||
final View view2 = viewHolder2 != null ? viewHolder2.itemView : null;
|
||||
if (view != null) {
|
||||
final ViewPropertyAnimator duration = view.animate().setDuration(d());
|
||||
this.r.add(changeInfo.a);
|
||||
duration.translationX(changeInfo.e - changeInfo.c);
|
||||
duration.translationY(changeInfo.f - changeInfo.d);
|
||||
duration.alpha(0.0f).setListener(new AnimatorListenerAdapter() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.7
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
duration.setListener(null);
|
||||
view.setAlpha(1.0f);
|
||||
view.setTranslationX(0.0f);
|
||||
view.setTranslationY(0.0f);
|
||||
DefaultItemAnimator.this.a(changeInfo.a, true);
|
||||
DefaultItemAnimator.this.r.remove(changeInfo.a);
|
||||
DefaultItemAnimator.this.j();
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DefaultItemAnimator.this.b(changeInfo.a, true);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (view2 != null) {
|
||||
final ViewPropertyAnimator animate = view2.animate();
|
||||
this.r.add(changeInfo.b);
|
||||
animate.translationX(0.0f).translationY(0.0f).setDuration(d()).alpha(1.0f).setListener(new AnimatorListenerAdapter() { // from class: androidx.recyclerview.widget.DefaultItemAnimator.8
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
animate.setListener(null);
|
||||
view2.setAlpha(1.0f);
|
||||
view2.setTranslationX(0.0f);
|
||||
view2.setTranslationY(0.0f);
|
||||
DefaultItemAnimator.this.a(changeInfo.b, false);
|
||||
DefaultItemAnimator.this.r.remove(changeInfo.b);
|
||||
DefaultItemAnimator.this.j();
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DefaultItemAnimator.this.b(changeInfo.b, false);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(List<ChangeInfo> list, RecyclerView.ViewHolder viewHolder) {
|
||||
for (int size = list.size() - 1; size >= 0; size--) {
|
||||
ChangeInfo changeInfo = list.get(size);
|
||||
if (a(changeInfo, viewHolder) && changeInfo.a == null && changeInfo.b == null) {
|
||||
list.remove(changeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(ChangeInfo changeInfo, RecyclerView.ViewHolder viewHolder) {
|
||||
boolean z = false;
|
||||
if (changeInfo.b == viewHolder) {
|
||||
changeInfo.b = null;
|
||||
} else {
|
||||
if (changeInfo.a != viewHolder) {
|
||||
return false;
|
||||
}
|
||||
changeInfo.a = null;
|
||||
z = true;
|
||||
}
|
||||
viewHolder.itemView.setAlpha(1.0f);
|
||||
viewHolder.itemView.setTranslationX(0.0f);
|
||||
viewHolder.itemView.setTranslationY(0.0f);
|
||||
a(viewHolder, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
void a(List<RecyclerView.ViewHolder> list) {
|
||||
for (int size = list.size() - 1; size >= 0; size--) {
|
||||
list.get(size).itemView.animate().cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder, List<Object> list) {
|
||||
return !list.isEmpty() || super.a(viewHolder, list);
|
||||
}
|
||||
}
|
106
sources/androidx/recyclerview/widget/DividerItemDecoration.java
Normal file
106
sources/androidx/recyclerview/widget/DividerItemDecoration.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private static final int[] d = {R.attr.listDivider};
|
||||
private Drawable a;
|
||||
private int b;
|
||||
private final Rect c = new Rect();
|
||||
|
||||
public DividerItemDecoration(Context context, int i) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(d);
|
||||
this.a = obtainStyledAttributes.getDrawable(0);
|
||||
if (this.a == null) {
|
||||
Log.w("DividerItem", "@android:attr/listDivider was not set in the theme used for this DividerItemDecoration. Please set that attribute all call setDrawable()");
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
setOrientation(i);
|
||||
}
|
||||
|
||||
private void a(Canvas canvas, RecyclerView recyclerView) {
|
||||
int height;
|
||||
int i;
|
||||
canvas.save();
|
||||
if (recyclerView.getClipToPadding()) {
|
||||
i = recyclerView.getPaddingTop();
|
||||
height = recyclerView.getHeight() - recyclerView.getPaddingBottom();
|
||||
canvas.clipRect(recyclerView.getPaddingLeft(), i, recyclerView.getWidth() - recyclerView.getPaddingRight(), height);
|
||||
} else {
|
||||
height = recyclerView.getHeight();
|
||||
i = 0;
|
||||
}
|
||||
int childCount = recyclerView.getChildCount();
|
||||
for (int i2 = 0; i2 < childCount; i2++) {
|
||||
View childAt = recyclerView.getChildAt(i2);
|
||||
recyclerView.getLayoutManager().b(childAt, this.c);
|
||||
int round = this.c.right + Math.round(childAt.getTranslationX());
|
||||
this.a.setBounds(round - this.a.getIntrinsicWidth(), i, round, height);
|
||||
this.a.draw(canvas);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void b(Canvas canvas, RecyclerView recyclerView) {
|
||||
int width;
|
||||
int i;
|
||||
canvas.save();
|
||||
if (recyclerView.getClipToPadding()) {
|
||||
i = recyclerView.getPaddingLeft();
|
||||
width = recyclerView.getWidth() - recyclerView.getPaddingRight();
|
||||
canvas.clipRect(i, recyclerView.getPaddingTop(), width, recyclerView.getHeight() - recyclerView.getPaddingBottom());
|
||||
} else {
|
||||
width = recyclerView.getWidth();
|
||||
i = 0;
|
||||
}
|
||||
int childCount = recyclerView.getChildCount();
|
||||
for (int i2 = 0; i2 < childCount; i2++) {
|
||||
View childAt = recyclerView.getChildAt(i2);
|
||||
recyclerView.a(childAt, this.c);
|
||||
int round = this.c.bottom + Math.round(childAt.getTranslationY());
|
||||
this.a.setBounds(i, round - this.a.getIntrinsicHeight(), width, round);
|
||||
this.a.draw(canvas);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
Drawable drawable = this.a;
|
||||
if (drawable == null) {
|
||||
rect.set(0, 0, 0, 0);
|
||||
} else if (this.b == 1) {
|
||||
rect.set(0, 0, 0, drawable.getIntrinsicHeight());
|
||||
} else {
|
||||
rect.set(0, 0, drawable.getIntrinsicWidth(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void onDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
if (recyclerView.getLayoutManager() == null || this.a == null) {
|
||||
return;
|
||||
}
|
||||
if (this.b == 1) {
|
||||
b(canvas, recyclerView);
|
||||
} else {
|
||||
a(canvas, recyclerView);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrientation(int i) {
|
||||
if (i != 0 && i != 1) {
|
||||
throw new IllegalArgumentException("Invalid orientation. It should be either HORIZONTAL or VERTICAL");
|
||||
}
|
||||
this.b = i;
|
||||
}
|
||||
}
|
445
sources/androidx/recyclerview/widget/FastScroller.java
Normal file
445
sources/androidx/recyclerview/widget/FastScroller.java
Normal file
@@ -0,0 +1,445 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.R;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.view.MotionEvent;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class FastScroller extends RecyclerView.ItemDecoration implements RecyclerView.OnItemTouchListener {
|
||||
private static final int[] D = {R.attr.state_pressed};
|
||||
private static final int[] E = new int[0];
|
||||
private final int a;
|
||||
private final int b;
|
||||
final StateListDrawable c;
|
||||
final Drawable d;
|
||||
private final int e;
|
||||
private final int f;
|
||||
private final StateListDrawable g;
|
||||
private final Drawable h;
|
||||
private final int i;
|
||||
private final int j;
|
||||
int k;
|
||||
int l;
|
||||
float m;
|
||||
int n;
|
||||
int o;
|
||||
float p;
|
||||
private RecyclerView s;
|
||||
private int q = 0;
|
||||
private int r = 0;
|
||||
private boolean t = false;
|
||||
private boolean u = false;
|
||||
private int v = 0;
|
||||
private int w = 0;
|
||||
private final int[] x = new int[2];
|
||||
private final int[] y = new int[2];
|
||||
final ValueAnimator z = ValueAnimator.ofFloat(0.0f, 1.0f);
|
||||
int A = 0;
|
||||
private final Runnable B = new Runnable() { // from class: androidx.recyclerview.widget.FastScroller.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
FastScroller.this.a(SingleClickListener.FAST_CLICK_DELAY_TIME);
|
||||
}
|
||||
};
|
||||
private final RecyclerView.OnScrollListener C = new RecyclerView.OnScrollListener() { // from class: androidx.recyclerview.widget.FastScroller.2
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
public void a(RecyclerView recyclerView, int i, int i2) {
|
||||
FastScroller.this.a(recyclerView.computeHorizontalScrollOffset(), recyclerView.computeVerticalScrollOffset());
|
||||
}
|
||||
};
|
||||
|
||||
private class AnimatorListener extends AnimatorListenerAdapter {
|
||||
private boolean a = false;
|
||||
|
||||
AnimatorListener() {
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
this.a = true;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (this.a) {
|
||||
this.a = false;
|
||||
return;
|
||||
}
|
||||
if (((Float) FastScroller.this.z.getAnimatedValue()).floatValue() == 0.0f) {
|
||||
FastScroller fastScroller = FastScroller.this;
|
||||
fastScroller.A = 0;
|
||||
fastScroller.b(0);
|
||||
} else {
|
||||
FastScroller fastScroller2 = FastScroller.this;
|
||||
fastScroller2.A = 2;
|
||||
fastScroller2.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class AnimatorUpdater implements ValueAnimator.AnimatorUpdateListener {
|
||||
AnimatorUpdater() {
|
||||
}
|
||||
|
||||
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||
int floatValue = (int) (((Float) valueAnimator.getAnimatedValue()).floatValue() * 255.0f);
|
||||
FastScroller.this.c.setAlpha(floatValue);
|
||||
FastScroller.this.d.setAlpha(floatValue);
|
||||
FastScroller.this.a();
|
||||
}
|
||||
}
|
||||
|
||||
FastScroller(RecyclerView recyclerView, StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2, int i, int i2, int i3) {
|
||||
this.c = stateListDrawable;
|
||||
this.d = drawable;
|
||||
this.g = stateListDrawable2;
|
||||
this.h = drawable2;
|
||||
this.e = Math.max(i, stateListDrawable.getIntrinsicWidth());
|
||||
this.f = Math.max(i, drawable.getIntrinsicWidth());
|
||||
this.i = Math.max(i, stateListDrawable2.getIntrinsicWidth());
|
||||
this.j = Math.max(i, drawable2.getIntrinsicWidth());
|
||||
this.a = i2;
|
||||
this.b = i3;
|
||||
this.c.setAlpha(255);
|
||||
this.d.setAlpha(255);
|
||||
this.z.addListener(new AnimatorListener());
|
||||
this.z.addUpdateListener(new AnimatorUpdater());
|
||||
a(recyclerView);
|
||||
}
|
||||
|
||||
private void c() {
|
||||
this.s.removeCallbacks(this.B);
|
||||
}
|
||||
|
||||
private void d() {
|
||||
this.s.b((RecyclerView.ItemDecoration) this);
|
||||
this.s.b((RecyclerView.OnItemTouchListener) this);
|
||||
this.s.b(this.C);
|
||||
c();
|
||||
}
|
||||
|
||||
private int[] e() {
|
||||
int[] iArr = this.y;
|
||||
int i = this.b;
|
||||
iArr[0] = i;
|
||||
iArr[1] = this.q - i;
|
||||
return iArr;
|
||||
}
|
||||
|
||||
private int[] f() {
|
||||
int[] iArr = this.x;
|
||||
int i = this.b;
|
||||
iArr[0] = i;
|
||||
iArr[1] = this.r - i;
|
||||
return iArr;
|
||||
}
|
||||
|
||||
private boolean g() {
|
||||
return ViewCompat.k(this.s) == 1;
|
||||
}
|
||||
|
||||
private void h() {
|
||||
this.s.a((RecyclerView.ItemDecoration) this);
|
||||
this.s.a((RecyclerView.OnItemTouchListener) this);
|
||||
this.s.a(this.C);
|
||||
}
|
||||
|
||||
public void a(RecyclerView recyclerView) {
|
||||
RecyclerView recyclerView2 = this.s;
|
||||
if (recyclerView2 == recyclerView) {
|
||||
return;
|
||||
}
|
||||
if (recyclerView2 != null) {
|
||||
d();
|
||||
}
|
||||
this.s = recyclerView;
|
||||
if (this.s != null) {
|
||||
h();
|
||||
}
|
||||
}
|
||||
|
||||
void b(int i) {
|
||||
if (i == 2 && this.v != 2) {
|
||||
this.c.setState(D);
|
||||
c();
|
||||
}
|
||||
if (i == 0) {
|
||||
a();
|
||||
} else {
|
||||
b();
|
||||
}
|
||||
if (this.v == 2 && i != 2) {
|
||||
this.c.setState(E);
|
||||
c(1200);
|
||||
} else if (i == 1) {
|
||||
c(ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED);
|
||||
}
|
||||
this.v = i;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void onDrawOver(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
if (this.q != this.s.getWidth() || this.r != this.s.getHeight()) {
|
||||
this.q = this.s.getWidth();
|
||||
this.r = this.s.getHeight();
|
||||
b(0);
|
||||
} else if (this.A != 0) {
|
||||
if (this.t) {
|
||||
b(canvas);
|
||||
}
|
||||
if (this.u) {
|
||||
a(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
|
||||
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
|
||||
int i = this.v;
|
||||
if (i == 1) {
|
||||
boolean b = b(motionEvent.getX(), motionEvent.getY());
|
||||
boolean a = a(motionEvent.getX(), motionEvent.getY());
|
||||
if (motionEvent.getAction() != 0) {
|
||||
return false;
|
||||
}
|
||||
if (!b && !a) {
|
||||
return false;
|
||||
}
|
||||
if (a) {
|
||||
this.w = 1;
|
||||
this.p = (int) motionEvent.getX();
|
||||
} else if (b) {
|
||||
this.w = 2;
|
||||
this.m = (int) motionEvent.getY();
|
||||
}
|
||||
b(2);
|
||||
} else if (i != 2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
|
||||
public void onRequestDisallowInterceptTouchEvent(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
|
||||
public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
|
||||
if (this.v == 0) {
|
||||
return;
|
||||
}
|
||||
if (motionEvent.getAction() == 0) {
|
||||
boolean b = b(motionEvent.getX(), motionEvent.getY());
|
||||
boolean a = a(motionEvent.getX(), motionEvent.getY());
|
||||
if (b || a) {
|
||||
if (a) {
|
||||
this.w = 1;
|
||||
this.p = (int) motionEvent.getX();
|
||||
} else if (b) {
|
||||
this.w = 2;
|
||||
this.m = (int) motionEvent.getY();
|
||||
}
|
||||
b(2);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (motionEvent.getAction() == 1 && this.v == 2) {
|
||||
this.m = 0.0f;
|
||||
this.p = 0.0f;
|
||||
b(1);
|
||||
this.w = 0;
|
||||
return;
|
||||
}
|
||||
if (motionEvent.getAction() == 2 && this.v == 2) {
|
||||
b();
|
||||
if (this.w == 1) {
|
||||
a(motionEvent.getX());
|
||||
}
|
||||
if (this.w == 2) {
|
||||
b(motionEvent.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void c(int i) {
|
||||
c();
|
||||
this.s.postDelayed(this.B, i);
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.s.invalidate();
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
int i2 = this.A;
|
||||
if (i2 == 1) {
|
||||
this.z.cancel();
|
||||
} else if (i2 != 2) {
|
||||
return;
|
||||
}
|
||||
this.A = 3;
|
||||
ValueAnimator valueAnimator = this.z;
|
||||
valueAnimator.setFloatValues(((Float) valueAnimator.getAnimatedValue()).floatValue(), 0.0f);
|
||||
this.z.setDuration(i);
|
||||
this.z.start();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
int i = this.A;
|
||||
if (i != 0) {
|
||||
if (i != 3) {
|
||||
return;
|
||||
} else {
|
||||
this.z.cancel();
|
||||
}
|
||||
}
|
||||
this.A = 1;
|
||||
ValueAnimator valueAnimator = this.z;
|
||||
valueAnimator.setFloatValues(((Float) valueAnimator.getAnimatedValue()).floatValue(), 1.0f);
|
||||
this.z.setDuration(500L);
|
||||
this.z.setStartDelay(0L);
|
||||
this.z.start();
|
||||
}
|
||||
|
||||
private void a(Canvas canvas) {
|
||||
int i = this.r;
|
||||
int i2 = this.i;
|
||||
int i3 = this.o;
|
||||
int i4 = this.n;
|
||||
this.g.setBounds(0, 0, i4, i2);
|
||||
this.h.setBounds(0, 0, this.q, this.j);
|
||||
canvas.translate(0.0f, i - i2);
|
||||
this.h.draw(canvas);
|
||||
canvas.translate(i3 - (i4 / 2), 0.0f);
|
||||
this.g.draw(canvas);
|
||||
canvas.translate(-r2, -r0);
|
||||
}
|
||||
|
||||
private void b(Canvas canvas) {
|
||||
int i = this.q;
|
||||
int i2 = this.e;
|
||||
int i3 = i - i2;
|
||||
int i4 = this.l;
|
||||
int i5 = this.k;
|
||||
int i6 = i4 - (i5 / 2);
|
||||
this.c.setBounds(0, 0, i2, i5);
|
||||
this.d.setBounds(0, 0, this.f, this.r);
|
||||
if (g()) {
|
||||
this.d.draw(canvas);
|
||||
canvas.translate(this.e, i6);
|
||||
canvas.scale(-1.0f, 1.0f);
|
||||
this.c.draw(canvas);
|
||||
canvas.scale(1.0f, 1.0f);
|
||||
canvas.translate(-this.e, -i6);
|
||||
return;
|
||||
}
|
||||
canvas.translate(i3, 0.0f);
|
||||
this.d.draw(canvas);
|
||||
canvas.translate(0.0f, i6);
|
||||
this.c.draw(canvas);
|
||||
canvas.translate(-i3, -i6);
|
||||
}
|
||||
|
||||
void a(int i, int i2) {
|
||||
int computeVerticalScrollRange = this.s.computeVerticalScrollRange();
|
||||
int i3 = this.r;
|
||||
this.t = computeVerticalScrollRange - i3 > 0 && i3 >= this.a;
|
||||
int computeHorizontalScrollRange = this.s.computeHorizontalScrollRange();
|
||||
int i4 = this.q;
|
||||
this.u = computeHorizontalScrollRange - i4 > 0 && i4 >= this.a;
|
||||
if (!this.t && !this.u) {
|
||||
if (this.v != 0) {
|
||||
b(0);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.t) {
|
||||
float f = i3;
|
||||
this.l = (int) ((f * (i2 + (f / 2.0f))) / computeVerticalScrollRange);
|
||||
this.k = Math.min(i3, (i3 * i3) / computeVerticalScrollRange);
|
||||
}
|
||||
if (this.u) {
|
||||
float f2 = i4;
|
||||
this.o = (int) ((f2 * (i + (f2 / 2.0f))) / computeHorizontalScrollRange);
|
||||
this.n = Math.min(i4, (i4 * i4) / computeHorizontalScrollRange);
|
||||
}
|
||||
int i5 = this.v;
|
||||
if (i5 == 0 || i5 == 1) {
|
||||
b(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void b(float f) {
|
||||
int[] f2 = f();
|
||||
float max = Math.max(f2[0], Math.min(f2[1], f));
|
||||
if (Math.abs(this.l - max) < 2.0f) {
|
||||
return;
|
||||
}
|
||||
int a = a(this.m, max, f2, this.s.computeVerticalScrollRange(), this.s.computeVerticalScrollOffset(), this.r);
|
||||
if (a != 0) {
|
||||
this.s.scrollBy(0, a);
|
||||
}
|
||||
this.m = max;
|
||||
}
|
||||
|
||||
private void a(float f) {
|
||||
int[] e = e();
|
||||
float max = Math.max(e[0], Math.min(e[1], f));
|
||||
if (Math.abs(this.o - max) < 2.0f) {
|
||||
return;
|
||||
}
|
||||
int a = a(this.p, max, e, this.s.computeHorizontalScrollRange(), this.s.computeHorizontalScrollOffset(), this.q);
|
||||
if (a != 0) {
|
||||
this.s.scrollBy(a, 0);
|
||||
}
|
||||
this.p = max;
|
||||
}
|
||||
|
||||
boolean b(float f, float f2) {
|
||||
if (!g() ? f >= this.q - this.e : f <= this.e / 2) {
|
||||
int i = this.l;
|
||||
int i2 = this.k;
|
||||
if (f2 >= i - (i2 / 2) && f2 <= i + (i2 / 2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int a(float f, float f2, int[] iArr, int i, int i2, int i3) {
|
||||
int i4 = iArr[1] - iArr[0];
|
||||
if (i4 == 0) {
|
||||
return 0;
|
||||
}
|
||||
int i5 = i - i3;
|
||||
int i6 = (int) (((f2 - f) / i4) * i5);
|
||||
int i7 = i2 + i6;
|
||||
if (i7 >= i5 || i7 < 0) {
|
||||
return 0;
|
||||
}
|
||||
return i6;
|
||||
}
|
||||
|
||||
boolean a(float f, float f2) {
|
||||
if (f2 >= this.r - this.i) {
|
||||
int i = this.o;
|
||||
int i2 = this.n;
|
||||
if (f >= i - (i2 / 2) && f <= i + (i2 / 2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
303
sources/androidx/recyclerview/widget/GapWorker.java
Normal file
303
sources/androidx/recyclerview/widget/GapWorker.java
Normal file
@@ -0,0 +1,303 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import androidx.core.os.TraceCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class GapWorker implements Runnable {
|
||||
static final ThreadLocal<GapWorker> e = new ThreadLocal<>();
|
||||
static Comparator<Task> f = new Comparator<Task>() { // from class: androidx.recyclerview.widget.GapWorker.1
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(Task task, Task task2) {
|
||||
if ((task.d == null) != (task2.d == null)) {
|
||||
return task.d == null ? 1 : -1;
|
||||
}
|
||||
boolean z = task.a;
|
||||
if (z != task2.a) {
|
||||
return z ? -1 : 1;
|
||||
}
|
||||
int i = task2.b - task.b;
|
||||
if (i != 0) {
|
||||
return i;
|
||||
}
|
||||
int i2 = task.c - task2.c;
|
||||
if (i2 != 0) {
|
||||
return i2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
long b;
|
||||
long c;
|
||||
ArrayList<RecyclerView> a = new ArrayList<>();
|
||||
private ArrayList<Task> d = new ArrayList<>();
|
||||
|
||||
static class Task {
|
||||
public boolean a;
|
||||
public int b;
|
||||
public int c;
|
||||
public RecyclerView d;
|
||||
public int e;
|
||||
|
||||
Task() {
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a = false;
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
this.d = null;
|
||||
this.e = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GapWorker() {
|
||||
}
|
||||
|
||||
public void a(RecyclerView recyclerView) {
|
||||
this.a.add(recyclerView);
|
||||
}
|
||||
|
||||
public void b(RecyclerView recyclerView) {
|
||||
this.a.remove(recyclerView);
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
TraceCompat.a("RV Prefetch");
|
||||
if (!this.a.isEmpty()) {
|
||||
int size = this.a.size();
|
||||
long j = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
RecyclerView recyclerView = this.a.get(i);
|
||||
if (recyclerView.getWindowVisibility() == 0) {
|
||||
j = Math.max(recyclerView.getDrawingTime(), j);
|
||||
}
|
||||
}
|
||||
if (j != 0) {
|
||||
a(TimeUnit.MILLISECONDS.toNanos(j) + this.c);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
this.b = 0L;
|
||||
TraceCompat.a();
|
||||
}
|
||||
}
|
||||
|
||||
private void b(long j) {
|
||||
for (int i = 0; i < this.d.size(); i++) {
|
||||
Task task = this.d.get(i);
|
||||
if (task.d == null) {
|
||||
return;
|
||||
}
|
||||
a(task, j);
|
||||
task.a();
|
||||
}
|
||||
}
|
||||
|
||||
void a(RecyclerView recyclerView, int i, int i2) {
|
||||
if (recyclerView.isAttachedToWindow() && this.b == 0) {
|
||||
this.b = recyclerView.getNanoTime();
|
||||
recyclerView.post(this);
|
||||
}
|
||||
recyclerView.h0.b(i, i2);
|
||||
}
|
||||
|
||||
private void a() {
|
||||
Task task;
|
||||
int size = this.a.size();
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
RecyclerView recyclerView = this.a.get(i2);
|
||||
if (recyclerView.getWindowVisibility() == 0) {
|
||||
recyclerView.h0.a(recyclerView, false);
|
||||
i += recyclerView.h0.d;
|
||||
}
|
||||
}
|
||||
this.d.ensureCapacity(i);
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < size; i4++) {
|
||||
RecyclerView recyclerView2 = this.a.get(i4);
|
||||
if (recyclerView2.getWindowVisibility() == 0) {
|
||||
LayoutPrefetchRegistryImpl layoutPrefetchRegistryImpl = recyclerView2.h0;
|
||||
int abs = Math.abs(layoutPrefetchRegistryImpl.a) + Math.abs(layoutPrefetchRegistryImpl.b);
|
||||
int i5 = i3;
|
||||
for (int i6 = 0; i6 < layoutPrefetchRegistryImpl.d * 2; i6 += 2) {
|
||||
if (i5 >= this.d.size()) {
|
||||
task = new Task();
|
||||
this.d.add(task);
|
||||
} else {
|
||||
task = this.d.get(i5);
|
||||
}
|
||||
int i7 = layoutPrefetchRegistryImpl.c[i6 + 1];
|
||||
task.a = i7 <= abs;
|
||||
task.b = abs;
|
||||
task.c = i7;
|
||||
task.d = recyclerView2;
|
||||
task.e = layoutPrefetchRegistryImpl.c[i6];
|
||||
i5++;
|
||||
}
|
||||
i3 = i5;
|
||||
}
|
||||
}
|
||||
Collections.sort(this.d, f);
|
||||
}
|
||||
|
||||
static class LayoutPrefetchRegistryImpl implements RecyclerView.LayoutManager.LayoutPrefetchRegistry {
|
||||
int a;
|
||||
int b;
|
||||
int[] c;
|
||||
int d;
|
||||
|
||||
LayoutPrefetchRegistryImpl() {
|
||||
}
|
||||
|
||||
void a(RecyclerView recyclerView, boolean z) {
|
||||
this.d = 0;
|
||||
int[] iArr = this.c;
|
||||
if (iArr != null) {
|
||||
Arrays.fill(iArr, -1);
|
||||
}
|
||||
RecyclerView.LayoutManager layoutManager = recyclerView.m;
|
||||
if (recyclerView.l == null || layoutManager == null || !layoutManager.w()) {
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
if (!recyclerView.d.c()) {
|
||||
layoutManager.a(recyclerView.l.getItemCount(), this);
|
||||
}
|
||||
} else if (!recyclerView.j()) {
|
||||
layoutManager.a(this.a, this.b, recyclerView.i0, this);
|
||||
}
|
||||
int i = this.d;
|
||||
if (i > layoutManager.m) {
|
||||
layoutManager.m = i;
|
||||
layoutManager.n = z;
|
||||
recyclerView.b.j();
|
||||
}
|
||||
}
|
||||
|
||||
void b(int i, int i2) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager.LayoutPrefetchRegistry
|
||||
public void a(int i, int i2) {
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException("Layout positions must be non-negative");
|
||||
}
|
||||
if (i2 >= 0) {
|
||||
int i3 = this.d * 2;
|
||||
int[] iArr = this.c;
|
||||
if (iArr == null) {
|
||||
this.c = new int[4];
|
||||
Arrays.fill(this.c, -1);
|
||||
} else if (i3 >= iArr.length) {
|
||||
this.c = new int[i3 * 2];
|
||||
System.arraycopy(iArr, 0, this.c, 0, iArr.length);
|
||||
}
|
||||
int[] iArr2 = this.c;
|
||||
iArr2[i3] = i;
|
||||
iArr2[i3 + 1] = i2;
|
||||
this.d++;
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Pixel distance must be non-negative");
|
||||
}
|
||||
|
||||
boolean a(int i) {
|
||||
if (this.c != null) {
|
||||
int i2 = this.d * 2;
|
||||
for (int i3 = 0; i3 < i2; i3 += 2) {
|
||||
if (this.c[i3] == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void a() {
|
||||
int[] iArr = this.c;
|
||||
if (iArr != null) {
|
||||
Arrays.fill(iArr, -1);
|
||||
}
|
||||
this.d = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean a(RecyclerView recyclerView, int i) {
|
||||
int b = recyclerView.e.b();
|
||||
for (int i2 = 0; i2 < b; i2++) {
|
||||
RecyclerView.ViewHolder m = RecyclerView.m(recyclerView.e.d(i2));
|
||||
if (m.mPosition == i && !m.isInvalid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private RecyclerView.ViewHolder a(RecyclerView recyclerView, int i, long j) {
|
||||
if (a(recyclerView, i)) {
|
||||
return null;
|
||||
}
|
||||
RecyclerView.Recycler recycler = recyclerView.b;
|
||||
try {
|
||||
recyclerView.q();
|
||||
RecyclerView.ViewHolder a = recycler.a(i, false, j);
|
||||
if (a != null) {
|
||||
if (a.isBound() && !a.isInvalid()) {
|
||||
recycler.b(a.itemView);
|
||||
} else {
|
||||
recycler.a(a, false);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
} finally {
|
||||
recyclerView.a(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(RecyclerView recyclerView, long j) {
|
||||
if (recyclerView == null) {
|
||||
return;
|
||||
}
|
||||
if (recyclerView.E && recyclerView.e.b() != 0) {
|
||||
recyclerView.t();
|
||||
}
|
||||
LayoutPrefetchRegistryImpl layoutPrefetchRegistryImpl = recyclerView.h0;
|
||||
layoutPrefetchRegistryImpl.a(recyclerView, true);
|
||||
if (layoutPrefetchRegistryImpl.d != 0) {
|
||||
try {
|
||||
TraceCompat.a("RV Nested Prefetch");
|
||||
recyclerView.i0.a(recyclerView.l);
|
||||
for (int i = 0; i < layoutPrefetchRegistryImpl.d * 2; i += 2) {
|
||||
a(recyclerView, layoutPrefetchRegistryImpl.c[i], j);
|
||||
}
|
||||
} finally {
|
||||
TraceCompat.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Task task, long j) {
|
||||
RecyclerView.ViewHolder a = a(task.d, task.e, task.a ? Long.MAX_VALUE : j);
|
||||
if (a == null || a.mNestedRecyclerView == null || !a.isBound() || a.isInvalid()) {
|
||||
return;
|
||||
}
|
||||
a(a.mNestedRecyclerView.get(), j);
|
||||
}
|
||||
|
||||
void a(long j) {
|
||||
a();
|
||||
b(j);
|
||||
}
|
||||
}
|
703
sources/androidx/recyclerview/widget/GridLayoutManager.java
Normal file
703
sources/androidx/recyclerview/widget/GridLayoutManager.java
Normal file
@@ -0,0 +1,703 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GridLayoutManager extends LinearLayoutManager {
|
||||
boolean H;
|
||||
int I;
|
||||
int[] J;
|
||||
View[] K;
|
||||
final SparseIntArray L;
|
||||
final SparseIntArray M;
|
||||
SpanSizeLookup N;
|
||||
final Rect O;
|
||||
|
||||
public static final class DefaultSpanSizeLookup extends SpanSizeLookup {
|
||||
@Override // androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
|
||||
public int getSpanIndex(int i, int i2) {
|
||||
return i % i2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
|
||||
public int getSpanSize(int i) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class SpanSizeLookup {
|
||||
final SparseIntArray mSpanIndexCache = new SparseIntArray();
|
||||
private boolean mCacheSpanIndices = false;
|
||||
|
||||
int findReferenceIndexFromCache(int i) {
|
||||
int size = this.mSpanIndexCache.size() - 1;
|
||||
int i2 = 0;
|
||||
while (i2 <= size) {
|
||||
int i3 = (i2 + size) >>> 1;
|
||||
if (this.mSpanIndexCache.keyAt(i3) < i) {
|
||||
i2 = i3 + 1;
|
||||
} else {
|
||||
size = i3 - 1;
|
||||
}
|
||||
}
|
||||
int i4 = i2 - 1;
|
||||
if (i4 < 0 || i4 >= this.mSpanIndexCache.size()) {
|
||||
return -1;
|
||||
}
|
||||
return this.mSpanIndexCache.keyAt(i4);
|
||||
}
|
||||
|
||||
int getCachedSpanIndex(int i, int i2) {
|
||||
if (!this.mCacheSpanIndices) {
|
||||
return getSpanIndex(i, i2);
|
||||
}
|
||||
int i3 = this.mSpanIndexCache.get(i, -1);
|
||||
if (i3 != -1) {
|
||||
return i3;
|
||||
}
|
||||
int spanIndex = getSpanIndex(i, i2);
|
||||
this.mSpanIndexCache.put(i, spanIndex);
|
||||
return spanIndex;
|
||||
}
|
||||
|
||||
public int getSpanGroupIndex(int i, int i2) {
|
||||
int spanSize = getSpanSize(i);
|
||||
int i3 = 0;
|
||||
int i4 = 0;
|
||||
for (int i5 = 0; i5 < i; i5++) {
|
||||
int spanSize2 = getSpanSize(i5);
|
||||
i3 += spanSize2;
|
||||
if (i3 == i2) {
|
||||
i4++;
|
||||
i3 = 0;
|
||||
} else if (i3 > i2) {
|
||||
i4++;
|
||||
i3 = spanSize2;
|
||||
}
|
||||
}
|
||||
return i3 + spanSize > i2 ? i4 + 1 : i4;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x002a */
|
||||
/* JADX WARN: Removed duplicated region for block: B:19:0x0039 */
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:16:0x0031 -> B:12:0x0036). Please report as a decompilation issue!!! */
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:17:0x0033 -> B:12:0x0036). Please report as a decompilation issue!!! */
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:18:0x0035 -> B:12:0x0036). Please report as a decompilation issue!!! */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public int getSpanIndex(int r6, int r7) {
|
||||
/*
|
||||
r5 = this;
|
||||
int r0 = r5.getSpanSize(r6)
|
||||
r1 = 0
|
||||
if (r0 != r7) goto L8
|
||||
return r1
|
||||
L8:
|
||||
boolean r2 = r5.mCacheSpanIndices
|
||||
if (r2 == 0) goto L26
|
||||
android.util.SparseIntArray r2 = r5.mSpanIndexCache
|
||||
int r2 = r2.size()
|
||||
if (r2 <= 0) goto L26
|
||||
int r2 = r5.findReferenceIndexFromCache(r6)
|
||||
if (r2 < 0) goto L26
|
||||
android.util.SparseIntArray r3 = r5.mSpanIndexCache
|
||||
int r3 = r3.get(r2)
|
||||
int r4 = r5.getSpanSize(r2)
|
||||
int r3 = r3 + r4
|
||||
goto L36
|
||||
L26:
|
||||
r2 = 0
|
||||
r3 = 0
|
||||
L28:
|
||||
if (r2 >= r6) goto L39
|
||||
int r4 = r5.getSpanSize(r2)
|
||||
int r3 = r3 + r4
|
||||
if (r3 != r7) goto L33
|
||||
r3 = 0
|
||||
goto L36
|
||||
L33:
|
||||
if (r3 <= r7) goto L36
|
||||
r3 = r4
|
||||
L36:
|
||||
int r2 = r2 + 1
|
||||
goto L28
|
||||
L39:
|
||||
int r0 = r0 + r3
|
||||
if (r0 > r7) goto L3d
|
||||
return r3
|
||||
L3d:
|
||||
return r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup.getSpanIndex(int, int):int");
|
||||
}
|
||||
|
||||
public abstract int getSpanSize(int i);
|
||||
|
||||
public void invalidateSpanIndexCache() {
|
||||
this.mSpanIndexCache.clear();
|
||||
}
|
||||
|
||||
public boolean isSpanIndexCacheEnabled() {
|
||||
return this.mCacheSpanIndices;
|
||||
}
|
||||
|
||||
public void setSpanIndexCacheEnabled(boolean z) {
|
||||
this.mCacheSpanIndices = z;
|
||||
}
|
||||
}
|
||||
|
||||
public GridLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
this.H = false;
|
||||
this.I = -1;
|
||||
this.L = new SparseIntArray();
|
||||
this.M = new SparseIntArray();
|
||||
this.N = new DefaultSpanSizeLookup();
|
||||
this.O = new Rect();
|
||||
l(RecyclerView.LayoutManager.a(context, attributeSet, i, i2).spanCount);
|
||||
}
|
||||
|
||||
private void P() {
|
||||
int e = e();
|
||||
for (int i = 0; i < e; i++) {
|
||||
LayoutParams layoutParams = (LayoutParams) d(i).getLayoutParams();
|
||||
int a = layoutParams.a();
|
||||
this.L.put(a, layoutParams.f());
|
||||
this.M.put(a, layoutParams.e());
|
||||
}
|
||||
}
|
||||
|
||||
private void Q() {
|
||||
this.L.clear();
|
||||
this.M.clear();
|
||||
}
|
||||
|
||||
private void R() {
|
||||
View[] viewArr = this.K;
|
||||
if (viewArr == null || viewArr.length != this.I) {
|
||||
this.K = new View[this.I];
|
||||
}
|
||||
}
|
||||
|
||||
private void S() {
|
||||
int h;
|
||||
int q;
|
||||
if (K() == 1) {
|
||||
h = r() - p();
|
||||
q = o();
|
||||
} else {
|
||||
h = h() - n();
|
||||
q = q();
|
||||
}
|
||||
m(h - q);
|
||||
}
|
||||
|
||||
private void m(int i) {
|
||||
this.J = a(this.J, this.I, i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public boolean D() {
|
||||
return this.D == null && !this.H;
|
||||
}
|
||||
|
||||
public int N() {
|
||||
return this.I;
|
||||
}
|
||||
|
||||
public SpanSizeLookup O() {
|
||||
return this.N;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int a(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
if (this.s == 1) {
|
||||
return this.I;
|
||||
}
|
||||
if (state.a() < 1) {
|
||||
return 0;
|
||||
}
|
||||
return a(recycler, state, state.a() - 1) + 1;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager
|
||||
public void b(boolean z) {
|
||||
if (z) {
|
||||
throw new UnsupportedOperationException("GridLayoutManager does not support stack from end. Consider using reverse layout");
|
||||
}
|
||||
super.b(false);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public RecyclerView.LayoutParams c() {
|
||||
return this.s == 0 ? new LayoutParams(-2, -1) : new LayoutParams(-1, -2);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void d(RecyclerView recyclerView) {
|
||||
this.N.invalidateSpanIndexCache();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void e(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
if (state.d()) {
|
||||
P();
|
||||
}
|
||||
super.e(recycler, state);
|
||||
Q();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void g(RecyclerView.State state) {
|
||||
super.g(state);
|
||||
this.H = false;
|
||||
}
|
||||
|
||||
public void l(int i) {
|
||||
if (i == this.I) {
|
||||
return;
|
||||
}
|
||||
this.H = true;
|
||||
if (i >= 1) {
|
||||
this.I = i;
|
||||
this.N.invalidateSpanIndexCache();
|
||||
z();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Span count should be at least 1. Provided " + i);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutParams extends RecyclerView.LayoutParams {
|
||||
int e;
|
||||
int f;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.e = -1;
|
||||
this.f = 0;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public int f() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.e = -1;
|
||||
this.f = 0;
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
|
||||
super(marginLayoutParams);
|
||||
this.e = -1;
|
||||
this.f = 0;
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
this.e = -1;
|
||||
this.f = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int b(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
if (this.s == 0) {
|
||||
return this.I;
|
||||
}
|
||||
if (state.a() < 1) {
|
||||
return 0;
|
||||
}
|
||||
return a(recycler, state, state.a() - 1) + 1;
|
||||
}
|
||||
|
||||
int g(int i, int i2) {
|
||||
if (this.s == 1 && L()) {
|
||||
int[] iArr = this.J;
|
||||
int i3 = this.I;
|
||||
return iArr[i3 - i] - iArr[(i3 - i) - i2];
|
||||
}
|
||||
int[] iArr2 = this.J;
|
||||
return iArr2[i2 + i] - iArr2[i];
|
||||
}
|
||||
|
||||
private int c(RecyclerView.Recycler recycler, RecyclerView.State state, int i) {
|
||||
if (!state.d()) {
|
||||
return this.N.getSpanSize(i);
|
||||
}
|
||||
int i2 = this.L.get(i, -1);
|
||||
if (i2 != -1) {
|
||||
return i2;
|
||||
}
|
||||
int a = recycler.a(i);
|
||||
if (a == -1) {
|
||||
Log.w("GridLayoutManager", "Cannot find span size for pre layout position. It is not cached, not in the adapter. Pos:" + i);
|
||||
return 1;
|
||||
}
|
||||
return this.N.getSpanSize(a);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(RecyclerView.Recycler recycler, RecyclerView.State state, View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
||||
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
||||
if (!(layoutParams instanceof LayoutParams)) {
|
||||
super.a(view, accessibilityNodeInfoCompat);
|
||||
return;
|
||||
}
|
||||
LayoutParams layoutParams2 = (LayoutParams) layoutParams;
|
||||
int a = a(recycler, state, layoutParams2.a());
|
||||
if (this.s == 0) {
|
||||
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.a(layoutParams2.e(), layoutParams2.f(), a, 1, this.I > 1 && layoutParams2.f() == this.I, false));
|
||||
} else {
|
||||
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.a(a, 1, layoutParams2.e(), layoutParams2.f(), this.I > 1 && layoutParams2.f() == this.I, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void b(RecyclerView recyclerView, int i, int i2) {
|
||||
this.N.invalidateSpanIndexCache();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int b(int i, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
S();
|
||||
R();
|
||||
return super.b(i, recycler, state);
|
||||
}
|
||||
|
||||
public GridLayoutManager(Context context, int i) {
|
||||
super(context);
|
||||
this.H = false;
|
||||
this.I = -1;
|
||||
this.L = new SparseIntArray();
|
||||
this.M = new SparseIntArray();
|
||||
this.N = new DefaultSpanSizeLookup();
|
||||
this.O = new Rect();
|
||||
l(i);
|
||||
}
|
||||
|
||||
private void b(RecyclerView.Recycler recycler, RecyclerView.State state, LinearLayoutManager.AnchorInfo anchorInfo, int i) {
|
||||
boolean z = i == 1;
|
||||
int b = b(recycler, state, anchorInfo.b);
|
||||
if (z) {
|
||||
while (b > 0) {
|
||||
int i2 = anchorInfo.b;
|
||||
if (i2 <= 0) {
|
||||
return;
|
||||
}
|
||||
anchorInfo.b = i2 - 1;
|
||||
b = b(recycler, state, anchorInfo.b);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int a = state.a() - 1;
|
||||
int i3 = anchorInfo.b;
|
||||
while (i3 < a) {
|
||||
int i4 = i3 + 1;
|
||||
int b2 = b(recycler, state, i4);
|
||||
if (b2 <= b) {
|
||||
break;
|
||||
}
|
||||
i3 = i4;
|
||||
b = b2;
|
||||
}
|
||||
anchorInfo.b = i3;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(RecyclerView recyclerView, int i, int i2) {
|
||||
this.N.invalidateSpanIndexCache();
|
||||
}
|
||||
|
||||
public GridLayoutManager(Context context, int i, int i2, boolean z) {
|
||||
super(context, i2, z);
|
||||
this.H = false;
|
||||
this.I = -1;
|
||||
this.L = new SparseIntArray();
|
||||
this.M = new SparseIntArray();
|
||||
this.N = new DefaultSpanSizeLookup();
|
||||
this.O = new Rect();
|
||||
l(i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(RecyclerView recyclerView, int i, int i2, Object obj) {
|
||||
this.N.invalidateSpanIndexCache();
|
||||
}
|
||||
|
||||
private int b(RecyclerView.Recycler recycler, RecyclerView.State state, int i) {
|
||||
if (!state.d()) {
|
||||
return this.N.getCachedSpanIndex(i, this.I);
|
||||
}
|
||||
int i2 = this.M.get(i, -1);
|
||||
if (i2 != -1) {
|
||||
return i2;
|
||||
}
|
||||
int a = recycler.a(i);
|
||||
if (a == -1) {
|
||||
Log.w("GridLayoutManager", "Cannot find span size for pre layout position. It is not cached, not in the adapter. Pos:" + i);
|
||||
return 0;
|
||||
}
|
||||
return this.N.getCachedSpanIndex(a, this.I);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(RecyclerView recyclerView, int i, int i2, int i3) {
|
||||
this.N.invalidateSpanIndexCache();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public RecyclerView.LayoutParams a(Context context, AttributeSet attributeSet) {
|
||||
return new LayoutParams(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public RecyclerView.LayoutParams a(ViewGroup.LayoutParams layoutParams) {
|
||||
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
|
||||
return new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams);
|
||||
}
|
||||
return new LayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public boolean a(RecyclerView.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
public void a(SpanSizeLookup spanSizeLookup) {
|
||||
this.N = spanSizeLookup;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(Rect rect, int i, int i2) {
|
||||
int a;
|
||||
int a2;
|
||||
if (this.J == null) {
|
||||
super.a(rect, i, i2);
|
||||
}
|
||||
int o = o() + p();
|
||||
int q = q() + n();
|
||||
if (this.s == 1) {
|
||||
a2 = RecyclerView.LayoutManager.a(i2, rect.height() + q, l());
|
||||
int[] iArr = this.J;
|
||||
a = RecyclerView.LayoutManager.a(i, iArr[iArr.length - 1] + o, m());
|
||||
} else {
|
||||
a = RecyclerView.LayoutManager.a(i, rect.width() + o, m());
|
||||
int[] iArr2 = this.J;
|
||||
a2 = RecyclerView.LayoutManager.a(i2, iArr2[iArr2.length - 1] + q, l());
|
||||
}
|
||||
c(a, a2);
|
||||
}
|
||||
|
||||
static int[] a(int[] iArr, int i, int i2) {
|
||||
int i3;
|
||||
if (iArr == null || iArr.length != i + 1 || iArr[iArr.length - 1] != i2) {
|
||||
iArr = new int[i + 1];
|
||||
}
|
||||
int i4 = 0;
|
||||
iArr[0] = 0;
|
||||
int i5 = i2 / i;
|
||||
int i6 = i2 % i;
|
||||
int i7 = 0;
|
||||
for (int i8 = 1; i8 <= i; i8++) {
|
||||
i4 += i6;
|
||||
if (i4 <= 0 || i - i4 >= i6) {
|
||||
i3 = i5;
|
||||
} else {
|
||||
i3 = i5 + 1;
|
||||
i4 -= i;
|
||||
}
|
||||
i7 += i3;
|
||||
iArr[i8] = i7;
|
||||
}
|
||||
return iArr;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager
|
||||
void a(RecyclerView.Recycler recycler, RecyclerView.State state, LinearLayoutManager.AnchorInfo anchorInfo, int i) {
|
||||
super.a(recycler, state, anchorInfo, i);
|
||||
S();
|
||||
if (state.a() > 0 && !state.d()) {
|
||||
b(recycler, state, anchorInfo, i);
|
||||
}
|
||||
R();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int a(int i, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
S();
|
||||
R();
|
||||
return super.a(i, recycler, state);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager
|
||||
View a(RecyclerView.Recycler recycler, RecyclerView.State state, int i, int i2, int i3) {
|
||||
F();
|
||||
int f = this.u.f();
|
||||
int b = this.u.b();
|
||||
int i4 = i2 > i ? 1 : -1;
|
||||
View view = null;
|
||||
View view2 = null;
|
||||
while (i != i2) {
|
||||
View d = d(i);
|
||||
int l = l(d);
|
||||
if (l >= 0 && l < i3 && b(recycler, state, l) == 0) {
|
||||
if (((RecyclerView.LayoutParams) d.getLayoutParams()).c()) {
|
||||
if (view2 == null) {
|
||||
view2 = d;
|
||||
}
|
||||
} else {
|
||||
if (this.u.d(d) < b && this.u.a(d) >= f) {
|
||||
return d;
|
||||
}
|
||||
if (view == null) {
|
||||
view = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
i += i4;
|
||||
}
|
||||
return view != null ? view : view2;
|
||||
}
|
||||
|
||||
private int a(RecyclerView.Recycler recycler, RecyclerView.State state, int i) {
|
||||
if (!state.d()) {
|
||||
return this.N.getSpanGroupIndex(i, this.I);
|
||||
}
|
||||
int a = recycler.a(i);
|
||||
if (a == -1) {
|
||||
Log.w("GridLayoutManager", "Cannot find span size for pre layout position. " + i);
|
||||
return 0;
|
||||
}
|
||||
return this.N.getSpanGroupIndex(a, this.I);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager
|
||||
void a(RecyclerView.State state, LinearLayoutManager.LayoutState layoutState, RecyclerView.LayoutManager.LayoutPrefetchRegistry layoutPrefetchRegistry) {
|
||||
int i = this.I;
|
||||
for (int i2 = 0; i2 < this.I && layoutState.a(state) && i > 0; i2++) {
|
||||
int i3 = layoutState.d;
|
||||
layoutPrefetchRegistry.a(i3, Math.max(0, layoutState.g));
|
||||
i -= this.N.getSpanSize(i3);
|
||||
layoutState.d += layoutState.e;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:30:0x00a1, code lost:
|
||||
|
||||
r22.b = true;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x00a3, code lost:
|
||||
|
||||
return;
|
||||
*/
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void a(androidx.recyclerview.widget.RecyclerView.Recycler r19, androidx.recyclerview.widget.RecyclerView.State r20, androidx.recyclerview.widget.LinearLayoutManager.LayoutState r21, androidx.recyclerview.widget.LinearLayoutManager.LayoutChunkResult r22) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 574
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.GridLayoutManager.a(androidx.recyclerview.widget.RecyclerView$Recycler, androidx.recyclerview.widget.RecyclerView$State, androidx.recyclerview.widget.LinearLayoutManager$LayoutState, androidx.recyclerview.widget.LinearLayoutManager$LayoutChunkResult):void");
|
||||
}
|
||||
|
||||
private void a(View view, int i, boolean z) {
|
||||
int i2;
|
||||
int i3;
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
Rect rect = layoutParams.b;
|
||||
int i4 = rect.top + rect.bottom + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
|
||||
int i5 = rect.left + rect.right + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
||||
int g = g(layoutParams.e, layoutParams.f);
|
||||
if (this.s == 1) {
|
||||
i3 = RecyclerView.LayoutManager.a(g, i, i5, ((ViewGroup.MarginLayoutParams) layoutParams).width, false);
|
||||
i2 = RecyclerView.LayoutManager.a(this.u.g(), i(), i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, true);
|
||||
} else {
|
||||
int a = RecyclerView.LayoutManager.a(g, i, i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, false);
|
||||
int a2 = RecyclerView.LayoutManager.a(this.u.g(), s(), i5, ((ViewGroup.MarginLayoutParams) layoutParams).width, true);
|
||||
i2 = a;
|
||||
i3 = a2;
|
||||
}
|
||||
a(view, i3, i2, z);
|
||||
}
|
||||
|
||||
private void a(float f, int i) {
|
||||
m(Math.max(Math.round(f * this.I), i));
|
||||
}
|
||||
|
||||
private void a(View view, int i, int i2, boolean z) {
|
||||
boolean a;
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
if (z) {
|
||||
a = b(view, i, i2, layoutParams);
|
||||
} else {
|
||||
a = a(view, i, i2, layoutParams);
|
||||
}
|
||||
if (a) {
|
||||
view.measure(i, i2);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(RecyclerView.Recycler recycler, RecyclerView.State state, int i, int i2, boolean z) {
|
||||
int i3;
|
||||
int i4;
|
||||
int i5 = 0;
|
||||
int i6 = -1;
|
||||
if (z) {
|
||||
i6 = i;
|
||||
i3 = 0;
|
||||
i4 = 1;
|
||||
} else {
|
||||
i3 = i - 1;
|
||||
i4 = -1;
|
||||
}
|
||||
while (i3 != i6) {
|
||||
View view = this.K[i3];
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
layoutParams.f = c(recycler, state, l(view));
|
||||
layoutParams.e = i5;
|
||||
i5 += layoutParams.f;
|
||||
i3 += i4;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:69:0x00d7, code lost:
|
||||
|
||||
if (r13 == (r2 > r8)) goto L54;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:83:0x00f7, code lost:
|
||||
|
||||
if (r13 == (r2 > r10)) goto L50;
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:53:0x0105 */
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public android.view.View a(android.view.View r24, int r25, androidx.recyclerview.widget.RecyclerView.Recycler r26, androidx.recyclerview.widget.RecyclerView.State r27) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 335
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.GridLayoutManager.a(android.view.View, int, androidx.recyclerview.widget.RecyclerView$Recycler, androidx.recyclerview.widget.RecyclerView$State):android.view.View");
|
||||
}
|
||||
}
|
330
sources/androidx/recyclerview/widget/ItemTouchHelper.java
Normal file
330
sources/androidx/recyclerview/widget/ItemTouchHelper.java
Normal file
@@ -0,0 +1,330 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.R$dimen;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ItemTouchHelper extends RecyclerView.ItemDecoration implements RecyclerView.OnChildAttachStateChangeListener {
|
||||
|
||||
public static abstract class Callback {
|
||||
private static final int ABS_HORIZONTAL_DIR_FLAGS = 789516;
|
||||
public static final int DEFAULT_DRAG_ANIMATION_DURATION = 200;
|
||||
public static final int DEFAULT_SWIPE_ANIMATION_DURATION = 250;
|
||||
private static final long DRAG_SCROLL_ACCELERATION_LIMIT_TIME_MS = 2000;
|
||||
static final int RELATIVE_DIR_FLAGS = 3158064;
|
||||
private static final Interpolator sDragScrollInterpolator = new Interpolator() { // from class: androidx.recyclerview.widget.ItemTouchHelper.Callback.1
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public float getInterpolation(float f) {
|
||||
return f * f * f * f * f;
|
||||
}
|
||||
};
|
||||
private static final Interpolator sDragViewScrollCapInterpolator = new Interpolator() { // from class: androidx.recyclerview.widget.ItemTouchHelper.Callback.2
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public float getInterpolation(float f) {
|
||||
float f2 = f - 1.0f;
|
||||
return (f2 * f2 * f2 * f2 * f2) + 1.0f;
|
||||
}
|
||||
};
|
||||
private int mCachedMaxScrollSpeed = -1;
|
||||
|
||||
public static int convertToRelativeDirection(int i, int i2) {
|
||||
int i3;
|
||||
int i4 = i & ABS_HORIZONTAL_DIR_FLAGS;
|
||||
if (i4 == 0) {
|
||||
return i;
|
||||
}
|
||||
int i5 = i & (~i4);
|
||||
if (i2 == 0) {
|
||||
i3 = i4 << 2;
|
||||
} else {
|
||||
int i6 = i4 << 1;
|
||||
i5 |= (-789517) & i6;
|
||||
i3 = (i6 & ABS_HORIZONTAL_DIR_FLAGS) << 2;
|
||||
}
|
||||
return i5 | i3;
|
||||
}
|
||||
|
||||
public static ItemTouchUIUtil getDefaultUIUtil() {
|
||||
return ItemTouchUIUtilImpl.a;
|
||||
}
|
||||
|
||||
private int getMaxDragScroll(RecyclerView recyclerView) {
|
||||
if (this.mCachedMaxScrollSpeed == -1) {
|
||||
this.mCachedMaxScrollSpeed = recyclerView.getResources().getDimensionPixelSize(R$dimen.item_touch_helper_max_drag_scroll_per_frame);
|
||||
}
|
||||
return this.mCachedMaxScrollSpeed;
|
||||
}
|
||||
|
||||
public static int makeFlag(int i, int i2) {
|
||||
return i2 << (i * 8);
|
||||
}
|
||||
|
||||
public static int makeMovementFlags(int i, int i2) {
|
||||
return makeFlag(2, i) | makeFlag(1, i2) | makeFlag(0, i2 | i);
|
||||
}
|
||||
|
||||
public boolean canDropOver(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public RecyclerView.ViewHolder chooseDropTarget(RecyclerView.ViewHolder viewHolder, List<RecyclerView.ViewHolder> list, int i, int i2) {
|
||||
int i3;
|
||||
int bottom;
|
||||
int top;
|
||||
int abs;
|
||||
int left;
|
||||
int abs2;
|
||||
int right;
|
||||
int width = i + viewHolder.itemView.getWidth();
|
||||
int height = i2 + viewHolder.itemView.getHeight();
|
||||
int left2 = i - viewHolder.itemView.getLeft();
|
||||
int top2 = i2 - viewHolder.itemView.getTop();
|
||||
int size = list.size();
|
||||
RecyclerView.ViewHolder viewHolder2 = null;
|
||||
int i4 = -1;
|
||||
for (int i5 = 0; i5 < size; i5++) {
|
||||
RecyclerView.ViewHolder viewHolder3 = list.get(i5);
|
||||
if (left2 <= 0 || (right = viewHolder3.itemView.getRight() - width) >= 0 || viewHolder3.itemView.getRight() <= viewHolder.itemView.getRight() || (i3 = Math.abs(right)) <= i4) {
|
||||
i3 = i4;
|
||||
} else {
|
||||
viewHolder2 = viewHolder3;
|
||||
}
|
||||
if (left2 < 0 && (left = viewHolder3.itemView.getLeft() - i) > 0 && viewHolder3.itemView.getLeft() < viewHolder.itemView.getLeft() && (abs2 = Math.abs(left)) > i3) {
|
||||
i3 = abs2;
|
||||
viewHolder2 = viewHolder3;
|
||||
}
|
||||
if (top2 < 0 && (top = viewHolder3.itemView.getTop() - i2) > 0 && viewHolder3.itemView.getTop() < viewHolder.itemView.getTop() && (abs = Math.abs(top)) > i3) {
|
||||
i3 = abs;
|
||||
viewHolder2 = viewHolder3;
|
||||
}
|
||||
if (top2 <= 0 || (bottom = viewHolder3.itemView.getBottom() - height) >= 0 || viewHolder3.itemView.getBottom() <= viewHolder.itemView.getBottom() || (i4 = Math.abs(bottom)) <= i3) {
|
||||
i4 = i3;
|
||||
} else {
|
||||
viewHolder2 = viewHolder3;
|
||||
}
|
||||
}
|
||||
return viewHolder2;
|
||||
}
|
||||
|
||||
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
ItemTouchUIUtilImpl.a.a(viewHolder.itemView);
|
||||
}
|
||||
|
||||
public int convertToAbsoluteDirection(int i, int i2) {
|
||||
int i3;
|
||||
int i4 = i & RELATIVE_DIR_FLAGS;
|
||||
if (i4 == 0) {
|
||||
return i;
|
||||
}
|
||||
int i5 = i & (~i4);
|
||||
if (i2 == 0) {
|
||||
i3 = i4 >> 2;
|
||||
} else {
|
||||
int i6 = i4 >> 1;
|
||||
i5 |= (-3158065) & i6;
|
||||
i3 = (i6 & RELATIVE_DIR_FLAGS) >> 2;
|
||||
}
|
||||
return i5 | i3;
|
||||
}
|
||||
|
||||
final int getAbsoluteMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
return convertToAbsoluteDirection(getMovementFlags(recyclerView, viewHolder), ViewCompat.k(recyclerView));
|
||||
}
|
||||
|
||||
public long getAnimationDuration(RecyclerView recyclerView, int i, float f, float f2) {
|
||||
RecyclerView.ItemAnimator itemAnimator = recyclerView.getItemAnimator();
|
||||
return itemAnimator == null ? i == 8 ? 200L : 250L : i == 8 ? itemAnimator.e() : itemAnimator.f();
|
||||
}
|
||||
|
||||
public int getBoundingBoxMargin() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public abstract float getMoveThreshold(RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
public abstract int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
public float getSwipeEscapeVelocity(float f) {
|
||||
return f;
|
||||
}
|
||||
|
||||
public abstract float getSwipeThreshold(RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
public float getSwipeVelocityThreshold(float f) {
|
||||
return f;
|
||||
}
|
||||
|
||||
boolean hasDragFlag(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
return (getAbsoluteMovementFlags(recyclerView, viewHolder) & 16711680) != 0;
|
||||
}
|
||||
|
||||
boolean hasSwipeFlag(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
return (getAbsoluteMovementFlags(recyclerView, viewHolder) & 65280) != 0;
|
||||
}
|
||||
|
||||
public int interpolateOutOfBoundsScroll(RecyclerView recyclerView, int i, int i2, int i3, long j) {
|
||||
int signum = (int) (((int) (((int) Math.signum(i2)) * getMaxDragScroll(recyclerView) * sDragViewScrollCapInterpolator.getInterpolation(Math.min(1.0f, (Math.abs(i2) * 1.0f) / i)))) * sDragScrollInterpolator.getInterpolation(j <= DRAG_SCROLL_ACCELERATION_LIMIT_TIME_MS ? j / 2000.0f : 1.0f));
|
||||
return signum == 0 ? i2 > 0 ? 1 : -1 : signum;
|
||||
}
|
||||
|
||||
public abstract boolean isItemViewSwipeEnabled();
|
||||
|
||||
public abstract boolean isLongPressDragEnabled();
|
||||
|
||||
public void onChildDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float f, float f2, int i, boolean z) {
|
||||
ItemTouchUIUtilImpl.a.b(canvas, recyclerView, viewHolder.itemView, f, f2, i, z);
|
||||
}
|
||||
|
||||
public void onChildDrawOver(Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float f, float f2, int i, boolean z) {
|
||||
ItemTouchUIUtilImpl.a.a(canvas, recyclerView, viewHolder.itemView, f, f2, i, z);
|
||||
}
|
||||
|
||||
void onDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, List<RecoverAnimation> list, int i, float f, float f2) {
|
||||
int size = list.size();
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
RecoverAnimation recoverAnimation = list.get(i2);
|
||||
recoverAnimation.a();
|
||||
int save = canvas.save();
|
||||
onChildDraw(canvas, recyclerView, recoverAnimation.e, recoverAnimation.h, recoverAnimation.i, recoverAnimation.f, false);
|
||||
canvas.restoreToCount(save);
|
||||
}
|
||||
if (viewHolder != null) {
|
||||
int save2 = canvas.save();
|
||||
onChildDraw(canvas, recyclerView, viewHolder, f, f2, i, true);
|
||||
canvas.restoreToCount(save2);
|
||||
}
|
||||
}
|
||||
|
||||
void onDrawOver(Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, List<RecoverAnimation> list, int i, float f, float f2) {
|
||||
int size = list.size();
|
||||
boolean z = false;
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
RecoverAnimation recoverAnimation = list.get(i2);
|
||||
int save = canvas.save();
|
||||
onChildDrawOver(canvas, recyclerView, recoverAnimation.e, recoverAnimation.h, recoverAnimation.i, recoverAnimation.f, false);
|
||||
canvas.restoreToCount(save);
|
||||
}
|
||||
if (viewHolder != null) {
|
||||
int save2 = canvas.save();
|
||||
onChildDrawOver(canvas, recyclerView, viewHolder, f, f2, i, true);
|
||||
canvas.restoreToCount(save2);
|
||||
}
|
||||
for (int i3 = size - 1; i3 >= 0; i3--) {
|
||||
RecoverAnimation recoverAnimation2 = list.get(i3);
|
||||
if (recoverAnimation2.j && !recoverAnimation2.g) {
|
||||
list.remove(i3);
|
||||
} else if (!recoverAnimation2.j) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
recyclerView.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2);
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public void onMoved(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, int i, RecyclerView.ViewHolder viewHolder2, int i2, int i3, int i4) {
|
||||
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
|
||||
if (layoutManager instanceof ViewDropHandler) {
|
||||
((ViewDropHandler) layoutManager).a(viewHolder.itemView, viewHolder2.itemView, i3, i4);
|
||||
return;
|
||||
}
|
||||
if (layoutManager.a()) {
|
||||
if (layoutManager.f(viewHolder2.itemView) <= recyclerView.getPaddingLeft()) {
|
||||
recyclerView.j(i2);
|
||||
}
|
||||
if (layoutManager.i(viewHolder2.itemView) >= recyclerView.getWidth() - recyclerView.getPaddingRight()) {
|
||||
recyclerView.j(i2);
|
||||
}
|
||||
}
|
||||
if (layoutManager.b()) {
|
||||
if (layoutManager.j(viewHolder2.itemView) <= recyclerView.getPaddingTop()) {
|
||||
recyclerView.j(i2);
|
||||
}
|
||||
if (layoutManager.e(viewHolder2.itemView) >= recyclerView.getHeight() - recyclerView.getPaddingBottom()) {
|
||||
recyclerView.j(i2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int i) {
|
||||
if (viewHolder != null) {
|
||||
ItemTouchUIUtilImpl.a.b(viewHolder.itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onSwiped(RecyclerView.ViewHolder viewHolder, int i);
|
||||
}
|
||||
|
||||
private static class RecoverAnimation implements Animator.AnimatorListener {
|
||||
final float a;
|
||||
final float b;
|
||||
final float c;
|
||||
final float d;
|
||||
final RecyclerView.ViewHolder e;
|
||||
final int f;
|
||||
boolean g;
|
||||
float h;
|
||||
float i;
|
||||
boolean j;
|
||||
private float k;
|
||||
|
||||
public void a(float f) {
|
||||
this.k = f;
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
a(1.0f);
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (!this.j) {
|
||||
this.e.setIsRecyclable(true);
|
||||
}
|
||||
this.j = true;
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationRepeat(Animator animator) {
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
}
|
||||
|
||||
public void a() {
|
||||
float f = this.a;
|
||||
float f2 = this.c;
|
||||
if (f == f2) {
|
||||
this.h = this.e.itemView.getTranslationX();
|
||||
} else {
|
||||
this.h = f + (this.k * (f2 - f));
|
||||
}
|
||||
float f3 = this.b;
|
||||
float f4 = this.d;
|
||||
if (f3 == f4) {
|
||||
this.i = this.e.itemView.getTranslationY();
|
||||
} else {
|
||||
this.i = f3 + (this.k * (f4 - f3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ViewDropHandler {
|
||||
void a(View view, View view2, int i, int i2);
|
||||
}
|
||||
|
||||
public void a(RecyclerView.ViewHolder viewHolder) {
|
||||
throw null;
|
||||
}
|
||||
}
|
15
sources/androidx/recyclerview/widget/ItemTouchUIUtil.java
Normal file
15
sources/androidx/recyclerview/widget/ItemTouchUIUtil.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ItemTouchUIUtil {
|
||||
void a(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z);
|
||||
|
||||
void a(View view);
|
||||
|
||||
void b(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z);
|
||||
|
||||
void b(View view);
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.R$id;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ItemTouchUIUtilImpl implements ItemTouchUIUtil {
|
||||
static final ItemTouchUIUtil a = new ItemTouchUIUtilImpl();
|
||||
|
||||
ItemTouchUIUtilImpl() {
|
||||
}
|
||||
|
||||
private static float a(RecyclerView recyclerView, View view) {
|
||||
int childCount = recyclerView.getChildCount();
|
||||
float f = 0.0f;
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = recyclerView.getChildAt(i);
|
||||
if (childAt != view) {
|
||||
float g = ViewCompat.g(childAt);
|
||||
if (g > f) {
|
||||
f = g;
|
||||
}
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
||||
public void a(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
||||
public void b(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z) {
|
||||
if (Build.VERSION.SDK_INT >= 21 && z && view.getTag(R$id.item_touch_helper_previous_elevation) == null) {
|
||||
Float valueOf = Float.valueOf(ViewCompat.g(view));
|
||||
ViewCompat.b(view, a(recyclerView, view) + 1.0f);
|
||||
view.setTag(R$id.item_touch_helper_previous_elevation, valueOf);
|
||||
}
|
||||
view.setTranslationX(f);
|
||||
view.setTranslationY(f2);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
||||
public void b(View view) {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
||||
public void a(View view) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Object tag = view.getTag(R$id.item_touch_helper_previous_elevation);
|
||||
if (tag != null && (tag instanceof Float)) {
|
||||
ViewCompat.b(view, ((Float) tag).floatValue());
|
||||
}
|
||||
view.setTag(R$id.item_touch_helper_previous_elevation, null);
|
||||
}
|
||||
view.setTranslationX(0.0f);
|
||||
view.setTranslationY(0.0f);
|
||||
}
|
||||
}
|
35
sources/androidx/recyclerview/widget/LayoutState.java
Normal file
35
sources/androidx/recyclerview/widget/LayoutState.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class LayoutState {
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
int e;
|
||||
boolean h;
|
||||
boolean i;
|
||||
boolean a = true;
|
||||
int f = 0;
|
||||
int g = 0;
|
||||
|
||||
LayoutState() {
|
||||
}
|
||||
|
||||
boolean a(RecyclerView.State state) {
|
||||
int i = this.c;
|
||||
return i >= 0 && i < state.a();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "LayoutState{mAvailable=" + this.b + ", mCurrentPosition=" + this.c + ", mItemDirection=" + this.d + ", mLayoutDirection=" + this.e + ", mStartLine=" + this.f + ", mEndLine=" + this.g + '}';
|
||||
}
|
||||
|
||||
View a(RecyclerView.Recycler recycler) {
|
||||
View d = recycler.d(this.c);
|
||||
this.c += this.d;
|
||||
return d;
|
||||
}
|
||||
}
|
1438
sources/androidx/recyclerview/widget/LinearLayoutManager.java
Normal file
1438
sources/androidx/recyclerview/widget/LinearLayoutManager.java
Normal file
File diff suppressed because it is too large
Load Diff
154
sources/androidx/recyclerview/widget/LinearSmoothScroller.java
Normal file
154
sources/androidx/recyclerview/widget/LinearSmoothScroller.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LinearSmoothScroller extends RecyclerView.SmoothScroller {
|
||||
protected PointF k;
|
||||
private final float l;
|
||||
protected final LinearInterpolator i = new LinearInterpolator();
|
||||
protected final DecelerateInterpolator j = new DecelerateInterpolator();
|
||||
protected int m = 0;
|
||||
protected int n = 0;
|
||||
|
||||
public LinearSmoothScroller(Context context) {
|
||||
this.l = a(context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
private int b(int i, int i2) {
|
||||
int i3 = i - i2;
|
||||
if (i * i3 <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller
|
||||
protected void a(View view, RecyclerView.State state, RecyclerView.SmoothScroller.Action action) {
|
||||
int a = a(view, i());
|
||||
int b = b(view, j());
|
||||
int d = d((int) Math.sqrt((a * a) + (b * b)));
|
||||
if (d > 0) {
|
||||
action.a(-a, -b, d, this.j);
|
||||
}
|
||||
}
|
||||
|
||||
public int b(View view, int i) {
|
||||
RecyclerView.LayoutManager b = b();
|
||||
if (b == null || !b.b()) {
|
||||
return 0;
|
||||
}
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return a(b.j(view) - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, b.e(view) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin, b.q(), b.h() - b.n(), i);
|
||||
}
|
||||
|
||||
protected int d(int i) {
|
||||
return (int) Math.ceil(e(i) / 0.3356d);
|
||||
}
|
||||
|
||||
protected int e(int i) {
|
||||
return (int) Math.ceil(Math.abs(i) * this.l);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller
|
||||
protected void f() {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller
|
||||
protected void g() {
|
||||
this.n = 0;
|
||||
this.m = 0;
|
||||
this.k = null;
|
||||
}
|
||||
|
||||
protected int i() {
|
||||
PointF pointF = this.k;
|
||||
if (pointF != null) {
|
||||
float f = pointF.x;
|
||||
if (f != 0.0f) {
|
||||
return f > 0.0f ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected int j() {
|
||||
PointF pointF = this.k;
|
||||
if (pointF != null) {
|
||||
float f = pointF.y;
|
||||
if (f != 0.0f) {
|
||||
return f > 0.0f ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller
|
||||
protected void a(int i, int i2, RecyclerView.State state, RecyclerView.SmoothScroller.Action action) {
|
||||
if (a() == 0) {
|
||||
h();
|
||||
return;
|
||||
}
|
||||
this.m = b(this.m, i);
|
||||
this.n = b(this.n, i2);
|
||||
if (this.m == 0 && this.n == 0) {
|
||||
a(action);
|
||||
}
|
||||
}
|
||||
|
||||
protected float a(DisplayMetrics displayMetrics) {
|
||||
return 25.0f / displayMetrics.densityDpi;
|
||||
}
|
||||
|
||||
protected void a(RecyclerView.SmoothScroller.Action action) {
|
||||
PointF a = a(c());
|
||||
if (a != null && (a.x != 0.0f || a.y != 0.0f)) {
|
||||
a(a);
|
||||
this.k = a;
|
||||
this.m = (int) (a.x * 10000.0f);
|
||||
this.n = (int) (a.y * 10000.0f);
|
||||
action.a((int) (this.m * 1.2f), (int) (this.n * 1.2f), (int) (e(XStream.PRIORITY_VERY_HIGH) * 1.2f), this.i);
|
||||
return;
|
||||
}
|
||||
action.a(c());
|
||||
h();
|
||||
}
|
||||
|
||||
public int a(int i, int i2, int i3, int i4, int i5) {
|
||||
if (i5 == -1) {
|
||||
return i3 - i;
|
||||
}
|
||||
if (i5 != 0) {
|
||||
if (i5 == 1) {
|
||||
return i4 - i2;
|
||||
}
|
||||
throw new IllegalArgumentException("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
|
||||
}
|
||||
int i6 = i3 - i;
|
||||
if (i6 > 0) {
|
||||
return i6;
|
||||
}
|
||||
int i7 = i4 - i2;
|
||||
if (i7 < 0) {
|
||||
return i7;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int a(View view, int i) {
|
||||
RecyclerView.LayoutManager b = b();
|
||||
if (b == null || !b.a()) {
|
||||
return 0;
|
||||
}
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return a(b.f(view) - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, b.i(view) + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, b.o(), b.r() - b.p(), i);
|
||||
}
|
||||
}
|
260
sources/androidx/recyclerview/widget/OpReorderer.java
Normal file
260
sources/androidx/recyclerview/widget/OpReorderer.java
Normal file
@@ -0,0 +1,260 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import androidx.recyclerview.widget.AdapterHelper;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OpReorderer {
|
||||
final Callback a;
|
||||
|
||||
interface Callback {
|
||||
AdapterHelper.UpdateOp a(int i, int i2, int i3, Object obj);
|
||||
|
||||
void a(AdapterHelper.UpdateOp updateOp);
|
||||
}
|
||||
|
||||
OpReorderer(Callback callback) {
|
||||
this.a = callback;
|
||||
}
|
||||
|
||||
private void c(List<AdapterHelper.UpdateOp> list, int i, AdapterHelper.UpdateOp updateOp, int i2, AdapterHelper.UpdateOp updateOp2) {
|
||||
int i3 = updateOp.d < updateOp2.b ? -1 : 0;
|
||||
if (updateOp.b < updateOp2.b) {
|
||||
i3++;
|
||||
}
|
||||
int i4 = updateOp2.b;
|
||||
int i5 = updateOp.b;
|
||||
if (i4 <= i5) {
|
||||
updateOp.b = i5 + updateOp2.d;
|
||||
}
|
||||
int i6 = updateOp2.b;
|
||||
int i7 = updateOp.d;
|
||||
if (i6 <= i7) {
|
||||
updateOp.d = i7 + updateOp2.d;
|
||||
}
|
||||
updateOp2.b += i3;
|
||||
list.set(i, updateOp2);
|
||||
list.set(i2, updateOp);
|
||||
}
|
||||
|
||||
void a(List<AdapterHelper.UpdateOp> list) {
|
||||
while (true) {
|
||||
int b = b(list);
|
||||
if (b == -1) {
|
||||
return;
|
||||
} else {
|
||||
a(list, b, b + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:10:0x0048 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x0056 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x005b */
|
||||
/* JADX WARN: Removed duplicated region for block: B:17:? A[RETURN, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:18:0x004c */
|
||||
/* JADX WARN: Removed duplicated region for block: B:19:0x002b */
|
||||
/* JADX WARN: Removed duplicated region for block: B:7:0x0027 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void b(java.util.List<androidx.recyclerview.widget.AdapterHelper.UpdateOp> r9, int r10, androidx.recyclerview.widget.AdapterHelper.UpdateOp r11, int r12, androidx.recyclerview.widget.AdapterHelper.UpdateOp r13) {
|
||||
/*
|
||||
r8 = this;
|
||||
int r0 = r11.d
|
||||
int r1 = r13.b
|
||||
r2 = 4
|
||||
r3 = 0
|
||||
r4 = 1
|
||||
if (r0 >= r1) goto Ld
|
||||
int r1 = r1 - r4
|
||||
r13.b = r1
|
||||
goto L20
|
||||
Ld:
|
||||
int r5 = r13.d
|
||||
int r1 = r1 + r5
|
||||
if (r0 >= r1) goto L20
|
||||
int r5 = r5 - r4
|
||||
r13.d = r5
|
||||
androidx.recyclerview.widget.OpReorderer$Callback r0 = r8.a
|
||||
int r1 = r11.b
|
||||
java.lang.Object r5 = r13.c
|
||||
androidx.recyclerview.widget.AdapterHelper$UpdateOp r0 = r0.a(r2, r1, r4, r5)
|
||||
goto L21
|
||||
L20:
|
||||
r0 = r3
|
||||
L21:
|
||||
int r1 = r11.b
|
||||
int r5 = r13.b
|
||||
if (r1 > r5) goto L2b
|
||||
int r5 = r5 + r4
|
||||
r13.b = r5
|
||||
goto L41
|
||||
L2b:
|
||||
int r6 = r13.d
|
||||
int r7 = r5 + r6
|
||||
if (r1 >= r7) goto L41
|
||||
int r5 = r5 + r6
|
||||
int r5 = r5 - r1
|
||||
androidx.recyclerview.widget.OpReorderer$Callback r3 = r8.a
|
||||
int r1 = r1 + r4
|
||||
java.lang.Object r4 = r13.c
|
||||
androidx.recyclerview.widget.AdapterHelper$UpdateOp r3 = r3.a(r2, r1, r5, r4)
|
||||
int r1 = r13.d
|
||||
int r1 = r1 - r5
|
||||
r13.d = r1
|
||||
L41:
|
||||
r9.set(r12, r11)
|
||||
int r11 = r13.d
|
||||
if (r11 <= 0) goto L4c
|
||||
r9.set(r10, r13)
|
||||
goto L54
|
||||
L4c:
|
||||
r9.remove(r10)
|
||||
androidx.recyclerview.widget.OpReorderer$Callback r11 = r8.a
|
||||
r11.a(r13)
|
||||
L54:
|
||||
if (r0 == 0) goto L59
|
||||
r9.add(r10, r0)
|
||||
L59:
|
||||
if (r3 == 0) goto L5e
|
||||
r9.add(r10, r3)
|
||||
L5e:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.OpReorderer.b(java.util.List, int, androidx.recyclerview.widget.AdapterHelper$UpdateOp, int, androidx.recyclerview.widget.AdapterHelper$UpdateOp):void");
|
||||
}
|
||||
|
||||
private void a(List<AdapterHelper.UpdateOp> list, int i, int i2) {
|
||||
AdapterHelper.UpdateOp updateOp = list.get(i);
|
||||
AdapterHelper.UpdateOp updateOp2 = list.get(i2);
|
||||
int i3 = updateOp2.a;
|
||||
if (i3 == 1) {
|
||||
c(list, i, updateOp, i2, updateOp2);
|
||||
} else if (i3 == 2) {
|
||||
a(list, i, updateOp, i2, updateOp2);
|
||||
} else {
|
||||
if (i3 != 4) {
|
||||
return;
|
||||
}
|
||||
b(list, i, updateOp, i2, updateOp2);
|
||||
}
|
||||
}
|
||||
|
||||
void a(List<AdapterHelper.UpdateOp> list, int i, AdapterHelper.UpdateOp updateOp, int i2, AdapterHelper.UpdateOp updateOp2) {
|
||||
boolean z;
|
||||
int i3 = updateOp.b;
|
||||
int i4 = updateOp.d;
|
||||
boolean z2 = false;
|
||||
if (i3 < i4) {
|
||||
if (updateOp2.b == i3 && updateOp2.d == i4 - i3) {
|
||||
z = false;
|
||||
z2 = true;
|
||||
} else {
|
||||
z = false;
|
||||
}
|
||||
} else if (updateOp2.b == i4 + 1 && updateOp2.d == i3 - i4) {
|
||||
z = true;
|
||||
z2 = true;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
int i5 = updateOp.d;
|
||||
int i6 = updateOp2.b;
|
||||
if (i5 < i6) {
|
||||
updateOp2.b = i6 - 1;
|
||||
} else {
|
||||
int i7 = updateOp2.d;
|
||||
if (i5 < i6 + i7) {
|
||||
updateOp2.d = i7 - 1;
|
||||
updateOp.a = 2;
|
||||
updateOp.d = 1;
|
||||
if (updateOp2.d == 0) {
|
||||
list.remove(i2);
|
||||
this.a.a(updateOp2);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
int i8 = updateOp.b;
|
||||
int i9 = updateOp2.b;
|
||||
AdapterHelper.UpdateOp updateOp3 = null;
|
||||
if (i8 <= i9) {
|
||||
updateOp2.b = i9 + 1;
|
||||
} else {
|
||||
int i10 = updateOp2.d;
|
||||
if (i8 < i9 + i10) {
|
||||
updateOp3 = this.a.a(2, i8 + 1, (i9 + i10) - i8, null);
|
||||
updateOp2.d = updateOp.b - updateOp2.b;
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
list.set(i, updateOp2);
|
||||
list.remove(i2);
|
||||
this.a.a(updateOp);
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
if (updateOp3 != null) {
|
||||
int i11 = updateOp.b;
|
||||
if (i11 > updateOp3.b) {
|
||||
updateOp.b = i11 - updateOp3.d;
|
||||
}
|
||||
int i12 = updateOp.d;
|
||||
if (i12 > updateOp3.b) {
|
||||
updateOp.d = i12 - updateOp3.d;
|
||||
}
|
||||
}
|
||||
int i13 = updateOp.b;
|
||||
if (i13 > updateOp2.b) {
|
||||
updateOp.b = i13 - updateOp2.d;
|
||||
}
|
||||
int i14 = updateOp.d;
|
||||
if (i14 > updateOp2.b) {
|
||||
updateOp.d = i14 - updateOp2.d;
|
||||
}
|
||||
} else {
|
||||
if (updateOp3 != null) {
|
||||
int i15 = updateOp.b;
|
||||
if (i15 >= updateOp3.b) {
|
||||
updateOp.b = i15 - updateOp3.d;
|
||||
}
|
||||
int i16 = updateOp.d;
|
||||
if (i16 >= updateOp3.b) {
|
||||
updateOp.d = i16 - updateOp3.d;
|
||||
}
|
||||
}
|
||||
int i17 = updateOp.b;
|
||||
if (i17 >= updateOp2.b) {
|
||||
updateOp.b = i17 - updateOp2.d;
|
||||
}
|
||||
int i18 = updateOp.d;
|
||||
if (i18 >= updateOp2.b) {
|
||||
updateOp.d = i18 - updateOp2.d;
|
||||
}
|
||||
}
|
||||
list.set(i, updateOp2);
|
||||
if (updateOp.b != updateOp.d) {
|
||||
list.set(i2, updateOp);
|
||||
} else {
|
||||
list.remove(i2);
|
||||
}
|
||||
if (updateOp3 != null) {
|
||||
list.add(i, updateOp3);
|
||||
}
|
||||
}
|
||||
|
||||
private int b(List<AdapterHelper.UpdateOp> list) {
|
||||
boolean z = false;
|
||||
for (int size = list.size() - 1; size >= 0; size--) {
|
||||
if (list.get(size).a != 8) {
|
||||
z = true;
|
||||
} else if (z) {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
224
sources/androidx/recyclerview/widget/OrientationHelper.java
Normal file
224
sources/androidx/recyclerview/widget/OrientationHelper.java
Normal file
@@ -0,0 +1,224 @@
|
||||
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 OrientationHelper {
|
||||
protected final RecyclerView.LayoutManager a;
|
||||
private int b;
|
||||
final Rect c;
|
||||
|
||||
public static OrientationHelper a(RecyclerView.LayoutManager layoutManager, int i) {
|
||||
if (i == 0) {
|
||||
return a(layoutManager);
|
||||
}
|
||||
if (i == 1) {
|
||||
return b(layoutManager);
|
||||
}
|
||||
throw new IllegalArgumentException("invalid orientation");
|
||||
}
|
||||
|
||||
public static OrientationHelper b(RecyclerView.LayoutManager layoutManager) {
|
||||
return new OrientationHelper(layoutManager) { // from class: androidx.recyclerview.widget.OrientationHelper.2
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int a() {
|
||||
return this.a.h();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int b() {
|
||||
return this.a.h() - this.a.n();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int c(View view) {
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return this.a.h(view) + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int d(View view) {
|
||||
return this.a.j(view) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) view.getLayoutParams())).topMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int e(View view) {
|
||||
this.a.a(view, true, this.c);
|
||||
return this.c.bottom;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int f() {
|
||||
return this.a.q();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int g() {
|
||||
return (this.a.h() - this.a.q()) - this.a.n();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public void a(int i) {
|
||||
this.a.f(i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int b(View view) {
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return this.a.g(view) + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int f(View view) {
|
||||
this.a.a(view, true, this.c);
|
||||
return this.c.top;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int a(View view) {
|
||||
return this.a.e(view) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) view.getLayoutParams())).bottomMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int c() {
|
||||
return this.a.n();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int d() {
|
||||
return this.a.i();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int e() {
|
||||
return this.a.s();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public abstract int a();
|
||||
|
||||
public abstract int a(View view);
|
||||
|
||||
public abstract void a(int i);
|
||||
|
||||
public abstract int b();
|
||||
|
||||
public abstract int b(View view);
|
||||
|
||||
public abstract int c();
|
||||
|
||||
public abstract int c(View view);
|
||||
|
||||
public abstract int d();
|
||||
|
||||
public abstract int d(View view);
|
||||
|
||||
public abstract int e();
|
||||
|
||||
public abstract int e(View view);
|
||||
|
||||
public abstract int f();
|
||||
|
||||
public abstract int f(View view);
|
||||
|
||||
public abstract int g();
|
||||
|
||||
public int h() {
|
||||
if (Integer.MIN_VALUE == this.b) {
|
||||
return 0;
|
||||
}
|
||||
return g() - this.b;
|
||||
}
|
||||
|
||||
public void i() {
|
||||
this.b = g();
|
||||
}
|
||||
|
||||
private OrientationHelper(RecyclerView.LayoutManager layoutManager) {
|
||||
this.b = Integer.MIN_VALUE;
|
||||
this.c = new Rect();
|
||||
this.a = layoutManager;
|
||||
}
|
||||
|
||||
public static OrientationHelper a(RecyclerView.LayoutManager layoutManager) {
|
||||
return new OrientationHelper(layoutManager) { // from class: androidx.recyclerview.widget.OrientationHelper.1
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int a() {
|
||||
return this.a.r();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int b() {
|
||||
return this.a.r() - this.a.p();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int c(View view) {
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return this.a.g(view) + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int d(View view) {
|
||||
return this.a.f(view) - ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) view.getLayoutParams())).leftMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int e(View view) {
|
||||
this.a.a(view, true, this.c);
|
||||
return this.c.right;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int f() {
|
||||
return this.a.o();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int g() {
|
||||
return (this.a.r() - this.a.o()) - this.a.p();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public void a(int i) {
|
||||
this.a.e(i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int b(View view) {
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
return this.a.h(view) + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int f(View view) {
|
||||
this.a.a(view, true, this.c);
|
||||
return this.c.left;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int a(View view) {
|
||||
return this.a.i(view) + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) view.getLayoutParams())).rightMargin;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int c() {
|
||||
return this.a.p();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int d() {
|
||||
return this.a.s();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.OrientationHelper
|
||||
public int e() {
|
||||
return this.a.i();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
6407
sources/androidx/recyclerview/widget/RecyclerView.java
Normal file
6407
sources/androidx/recyclerview/widget/RecyclerView.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,87 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import androidx.core.view.AccessibilityDelegateCompat;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RecyclerViewAccessibilityDelegate extends AccessibilityDelegateCompat {
|
||||
final RecyclerView c;
|
||||
final AccessibilityDelegateCompat d = new ItemDelegate(this);
|
||||
|
||||
public RecyclerViewAccessibilityDelegate(RecyclerView recyclerView) {
|
||||
this.c = recyclerView;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.AccessibilityDelegateCompat
|
||||
public boolean a(View view, int i, Bundle bundle) {
|
||||
if (super.a(view, i, bundle)) {
|
||||
return true;
|
||||
}
|
||||
if (c() || this.c.getLayoutManager() == null) {
|
||||
return false;
|
||||
}
|
||||
return this.c.getLayoutManager().a(i, bundle);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.AccessibilityDelegateCompat
|
||||
public void b(View view, AccessibilityEvent accessibilityEvent) {
|
||||
super.b(view, accessibilityEvent);
|
||||
accessibilityEvent.setClassName(RecyclerView.class.getName());
|
||||
if (!(view instanceof RecyclerView) || c()) {
|
||||
return;
|
||||
}
|
||||
RecyclerView recyclerView = (RecyclerView) view;
|
||||
if (recyclerView.getLayoutManager() != null) {
|
||||
recyclerView.getLayoutManager().a(accessibilityEvent);
|
||||
}
|
||||
}
|
||||
|
||||
boolean c() {
|
||||
return this.c.j();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.AccessibilityDelegateCompat
|
||||
public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
||||
super.a(view, accessibilityNodeInfoCompat);
|
||||
accessibilityNodeInfoCompat.a((CharSequence) RecyclerView.class.getName());
|
||||
if (c() || this.c.getLayoutManager() == null) {
|
||||
return;
|
||||
}
|
||||
this.c.getLayoutManager().a(accessibilityNodeInfoCompat);
|
||||
}
|
||||
|
||||
public static class ItemDelegate extends AccessibilityDelegateCompat {
|
||||
final RecyclerViewAccessibilityDelegate c;
|
||||
|
||||
public ItemDelegate(RecyclerViewAccessibilityDelegate recyclerViewAccessibilityDelegate) {
|
||||
this.c = recyclerViewAccessibilityDelegate;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.AccessibilityDelegateCompat
|
||||
public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
||||
super.a(view, accessibilityNodeInfoCompat);
|
||||
if (this.c.c() || this.c.c.getLayoutManager() == null) {
|
||||
return;
|
||||
}
|
||||
this.c.c.getLayoutManager().a(view, accessibilityNodeInfoCompat);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.AccessibilityDelegateCompat
|
||||
public boolean a(View view, int i, Bundle bundle) {
|
||||
if (super.a(view, i, bundle)) {
|
||||
return true;
|
||||
}
|
||||
if (this.c.c() || this.c.c.getLayoutManager() == null) {
|
||||
return false;
|
||||
}
|
||||
return this.c.c.getLayoutManager().a(view, i, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
public AccessibilityDelegateCompat b() {
|
||||
return this.d;
|
||||
}
|
||||
}
|
38
sources/androidx/recyclerview/widget/ScrollbarHelper.java
Normal file
38
sources/androidx/recyclerview/widget/ScrollbarHelper.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ScrollbarHelper {
|
||||
static int a(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z, boolean z2) {
|
||||
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
||||
return 0;
|
||||
}
|
||||
int max = z2 ? Math.max(0, (state.a() - Math.max(layoutManager.l(view), layoutManager.l(view2))) - 1) : Math.max(0, Math.min(layoutManager.l(view), layoutManager.l(view2)));
|
||||
if (z) {
|
||||
return Math.round((max * (Math.abs(orientationHelper.a(view2) - orientationHelper.d(view)) / (Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1))) + (orientationHelper.f() - orientationHelper.d(view)));
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
static int b(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z) {
|
||||
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (!z) {
|
||||
return state.a();
|
||||
}
|
||||
return (int) (((orientationHelper.a(view2) - orientationHelper.d(view)) / (Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1)) * state.a());
|
||||
}
|
||||
|
||||
static int a(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z) {
|
||||
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (!z) {
|
||||
return Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1;
|
||||
}
|
||||
return Math.min(orientationHelper.g(), orientationHelper.a(view2) - orientationHelper.d(view));
|
||||
}
|
||||
}
|
127
sources/androidx/recyclerview/widget/SimpleItemAnimator.java
Normal file
127
sources/androidx/recyclerview/widget/SimpleItemAnimator.java
Normal file
@@ -0,0 +1,127 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SimpleItemAnimator extends RecyclerView.ItemAnimator {
|
||||
boolean g = true;
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder) {
|
||||
return !this.g || viewHolder.isInvalid();
|
||||
}
|
||||
|
||||
public abstract boolean a(RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4);
|
||||
|
||||
public abstract boolean a(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2, int i, int i2, int i3, int i4);
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean b(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2) {
|
||||
int i = itemHolderInfo.a;
|
||||
int i2 = itemHolderInfo.b;
|
||||
View view = viewHolder.itemView;
|
||||
int left = itemHolderInfo2 == null ? view.getLeft() : itemHolderInfo2.a;
|
||||
int top = itemHolderInfo2 == null ? view.getTop() : itemHolderInfo2.b;
|
||||
if (viewHolder.isRemoved() || (i == left && i2 == top)) {
|
||||
return g(viewHolder);
|
||||
}
|
||||
view.layout(left, top, view.getWidth() + left, view.getHeight() + top);
|
||||
return a(viewHolder, i, i2, left, top);
|
||||
}
|
||||
|
||||
public void c(RecyclerView.ViewHolder viewHolder, boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean c(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2) {
|
||||
if (itemHolderInfo.a != itemHolderInfo2.a || itemHolderInfo.b != itemHolderInfo2.b) {
|
||||
return a(viewHolder, itemHolderInfo.a, itemHolderInfo.b, itemHolderInfo2.a, itemHolderInfo2.b);
|
||||
}
|
||||
j(viewHolder);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void d(RecyclerView.ViewHolder viewHolder, boolean z) {
|
||||
}
|
||||
|
||||
public abstract boolean f(RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
public abstract boolean g(RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
public final void h(RecyclerView.ViewHolder viewHolder) {
|
||||
n(viewHolder);
|
||||
b(viewHolder);
|
||||
}
|
||||
|
||||
public final void i(RecyclerView.ViewHolder viewHolder) {
|
||||
o(viewHolder);
|
||||
}
|
||||
|
||||
public final void j(RecyclerView.ViewHolder viewHolder) {
|
||||
p(viewHolder);
|
||||
b(viewHolder);
|
||||
}
|
||||
|
||||
public final void k(RecyclerView.ViewHolder viewHolder) {
|
||||
q(viewHolder);
|
||||
}
|
||||
|
||||
public final void l(RecyclerView.ViewHolder viewHolder) {
|
||||
r(viewHolder);
|
||||
b(viewHolder);
|
||||
}
|
||||
|
||||
public final void m(RecyclerView.ViewHolder viewHolder) {
|
||||
s(viewHolder);
|
||||
}
|
||||
|
||||
public void n(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
public void o(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
public void p(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
public void q(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
public void r(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
public void s(RecyclerView.ViewHolder viewHolder) {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2) {
|
||||
return (itemHolderInfo == null || (itemHolderInfo.a == itemHolderInfo2.a && itemHolderInfo.b == itemHolderInfo2.b)) ? f(viewHolder) : a(viewHolder, itemHolderInfo.a, itemHolderInfo.b, itemHolderInfo2.a, itemHolderInfo2.b);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator
|
||||
public boolean a(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2) {
|
||||
int i;
|
||||
int i2;
|
||||
int i3 = itemHolderInfo.a;
|
||||
int i4 = itemHolderInfo.b;
|
||||
if (viewHolder2.shouldIgnore()) {
|
||||
int i5 = itemHolderInfo.a;
|
||||
i2 = itemHolderInfo.b;
|
||||
i = i5;
|
||||
} else {
|
||||
i = itemHolderInfo2.a;
|
||||
i2 = itemHolderInfo2.b;
|
||||
}
|
||||
return a(viewHolder, viewHolder2, i3, i4, i, i2);
|
||||
}
|
||||
|
||||
public final void b(RecyclerView.ViewHolder viewHolder, boolean z) {
|
||||
d(viewHolder, z);
|
||||
}
|
||||
|
||||
public final void a(RecyclerView.ViewHolder viewHolder, boolean z) {
|
||||
c(viewHolder, z);
|
||||
b(viewHolder);
|
||||
}
|
||||
}
|
2530
sources/androidx/recyclerview/widget/StaggeredGridLayoutManager.java
Normal file
2530
sources/androidx/recyclerview/widget/StaggeredGridLayoutManager.java
Normal file
File diff suppressed because it is too large
Load Diff
112
sources/androidx/recyclerview/widget/ViewBoundsCheck.java
Normal file
112
sources/androidx/recyclerview/widget/ViewBoundsCheck.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ViewBoundsCheck {
|
||||
final Callback a;
|
||||
BoundFlags b = new BoundFlags();
|
||||
|
||||
interface Callback {
|
||||
int a();
|
||||
|
||||
int a(View view);
|
||||
|
||||
View a(int i);
|
||||
|
||||
int b();
|
||||
|
||||
int b(View view);
|
||||
}
|
||||
|
||||
ViewBoundsCheck(Callback callback) {
|
||||
this.a = callback;
|
||||
}
|
||||
|
||||
View a(int i, int i2, int i3, int i4) {
|
||||
int a = this.a.a();
|
||||
int b = this.a.b();
|
||||
int i5 = i2 > i ? 1 : -1;
|
||||
View view = null;
|
||||
while (i != i2) {
|
||||
View a2 = this.a.a(i);
|
||||
this.b.a(a, b, this.a.a(a2), this.a.b(a2));
|
||||
if (i3 != 0) {
|
||||
this.b.b();
|
||||
this.b.a(i3);
|
||||
if (this.b.a()) {
|
||||
return a2;
|
||||
}
|
||||
}
|
||||
if (i4 != 0) {
|
||||
this.b.b();
|
||||
this.b.a(i4);
|
||||
if (this.b.a()) {
|
||||
view = a2;
|
||||
}
|
||||
}
|
||||
i += i5;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
static class BoundFlags {
|
||||
int a = 0;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
int e;
|
||||
|
||||
BoundFlags() {
|
||||
}
|
||||
|
||||
int a(int i, int i2) {
|
||||
if (i > i2) {
|
||||
return 1;
|
||||
}
|
||||
return i == i2 ? 2 : 4;
|
||||
}
|
||||
|
||||
void a(int i, int i2, int i3, int i4) {
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
this.d = i3;
|
||||
this.e = i4;
|
||||
}
|
||||
|
||||
void b() {
|
||||
this.a = 0;
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
this.a = i | this.a;
|
||||
}
|
||||
|
||||
boolean a() {
|
||||
int i = this.a;
|
||||
if ((i & 7) != 0 && (i & (a(this.d, this.b) << 0)) == 0) {
|
||||
return false;
|
||||
}
|
||||
int i2 = this.a;
|
||||
if ((i2 & 112) != 0 && (i2 & (a(this.d, this.c) << 4)) == 0) {
|
||||
return false;
|
||||
}
|
||||
int i3 = this.a;
|
||||
if ((i3 & 1792) != 0 && (i3 & (a(this.e, this.b) << 8)) == 0) {
|
||||
return false;
|
||||
}
|
||||
int i4 = this.a;
|
||||
return (i4 & 28672) == 0 || (i4 & (a(this.e, this.c) << 12)) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
boolean a(View view, int i) {
|
||||
this.b.a(this.a.a(), this.a.b(), this.a.a(view), this.a.b(view));
|
||||
if (i == 0) {
|
||||
return false;
|
||||
}
|
||||
this.b.b();
|
||||
this.b.a(i);
|
||||
return this.b.a();
|
||||
}
|
||||
}
|
209
sources/androidx/recyclerview/widget/ViewInfoStore.java
Normal file
209
sources/androidx/recyclerview/widget/ViewInfoStore.java
Normal file
@@ -0,0 +1,209 @@
|
||||
package androidx.recyclerview.widget;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import androidx.core.util.Pools$SimplePool;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ViewInfoStore {
|
||||
final ArrayMap<RecyclerView.ViewHolder, InfoRecord> a = new ArrayMap<>();
|
||||
final LongSparseArray<RecyclerView.ViewHolder> b = new LongSparseArray<>();
|
||||
|
||||
interface ProcessCallback {
|
||||
void a(RecyclerView.ViewHolder viewHolder);
|
||||
|
||||
void a(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2);
|
||||
|
||||
void b(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2);
|
||||
|
||||
void c(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo2);
|
||||
}
|
||||
|
||||
ViewInfoStore() {
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.a.clear();
|
||||
this.b.a();
|
||||
}
|
||||
|
||||
boolean b(RecyclerView.ViewHolder viewHolder) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
return (infoRecord == null || (infoRecord.a & 1) == 0) ? false : true;
|
||||
}
|
||||
|
||||
void c(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
if (infoRecord == null) {
|
||||
infoRecord = InfoRecord.b();
|
||||
this.a.put(viewHolder, infoRecord);
|
||||
}
|
||||
infoRecord.b = itemHolderInfo;
|
||||
infoRecord.a |= 4;
|
||||
}
|
||||
|
||||
public void d(RecyclerView.ViewHolder viewHolder) {
|
||||
g(viewHolder);
|
||||
}
|
||||
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo e(RecyclerView.ViewHolder viewHolder) {
|
||||
return a(viewHolder, 8);
|
||||
}
|
||||
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo f(RecyclerView.ViewHolder viewHolder) {
|
||||
return a(viewHolder, 4);
|
||||
}
|
||||
|
||||
void g(RecyclerView.ViewHolder viewHolder) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
if (infoRecord == null) {
|
||||
return;
|
||||
}
|
||||
infoRecord.a &= -2;
|
||||
}
|
||||
|
||||
void h(RecyclerView.ViewHolder viewHolder) {
|
||||
int b = this.b.b() - 1;
|
||||
while (true) {
|
||||
if (b < 0) {
|
||||
break;
|
||||
}
|
||||
if (viewHolder == this.b.c(b)) {
|
||||
this.b.b(b);
|
||||
break;
|
||||
}
|
||||
b--;
|
||||
}
|
||||
InfoRecord remove = this.a.remove(viewHolder);
|
||||
if (remove != null) {
|
||||
InfoRecord.a(remove);
|
||||
}
|
||||
}
|
||||
|
||||
private RecyclerView.ItemAnimator.ItemHolderInfo a(RecyclerView.ViewHolder viewHolder, int i) {
|
||||
InfoRecord d;
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo;
|
||||
int a = this.a.a(viewHolder);
|
||||
if (a >= 0 && (d = this.a.d(a)) != null) {
|
||||
int i2 = d.a;
|
||||
if ((i2 & i) != 0) {
|
||||
d.a = (~i) & i2;
|
||||
if (i == 4) {
|
||||
itemHolderInfo = d.b;
|
||||
} else if (i == 8) {
|
||||
itemHolderInfo = d.c;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Must provide flag PRE or POST");
|
||||
}
|
||||
if ((d.a & 12) == 0) {
|
||||
this.a.c(a);
|
||||
InfoRecord.a(d);
|
||||
}
|
||||
return itemHolderInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void b(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
if (infoRecord == null) {
|
||||
infoRecord = InfoRecord.b();
|
||||
this.a.put(viewHolder, infoRecord);
|
||||
}
|
||||
infoRecord.c = itemHolderInfo;
|
||||
infoRecord.a |= 8;
|
||||
}
|
||||
|
||||
static class InfoRecord {
|
||||
static Pools$Pool<InfoRecord> d = new Pools$SimplePool(20);
|
||||
int a;
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo b;
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo c;
|
||||
|
||||
private InfoRecord() {
|
||||
}
|
||||
|
||||
static void a(InfoRecord infoRecord) {
|
||||
infoRecord.a = 0;
|
||||
infoRecord.b = null;
|
||||
infoRecord.c = null;
|
||||
d.a(infoRecord);
|
||||
}
|
||||
|
||||
static InfoRecord b() {
|
||||
InfoRecord a = d.a();
|
||||
return a == null ? new InfoRecord() : a;
|
||||
}
|
||||
|
||||
static void a() {
|
||||
while (d.a() != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean c(RecyclerView.ViewHolder viewHolder) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
return (infoRecord == null || (infoRecord.a & 4) == 0) ? false : true;
|
||||
}
|
||||
|
||||
void b() {
|
||||
InfoRecord.a();
|
||||
}
|
||||
|
||||
void a(long j, RecyclerView.ViewHolder viewHolder) {
|
||||
this.b.c(j, viewHolder);
|
||||
}
|
||||
|
||||
void a(RecyclerView.ViewHolder viewHolder, RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
if (infoRecord == null) {
|
||||
infoRecord = InfoRecord.b();
|
||||
this.a.put(viewHolder, infoRecord);
|
||||
}
|
||||
infoRecord.a |= 2;
|
||||
infoRecord.b = itemHolderInfo;
|
||||
}
|
||||
|
||||
RecyclerView.ViewHolder a(long j) {
|
||||
return this.b.b(j);
|
||||
}
|
||||
|
||||
void a(RecyclerView.ViewHolder viewHolder) {
|
||||
InfoRecord infoRecord = this.a.get(viewHolder);
|
||||
if (infoRecord == null) {
|
||||
infoRecord = InfoRecord.b();
|
||||
this.a.put(viewHolder, infoRecord);
|
||||
}
|
||||
infoRecord.a |= 1;
|
||||
}
|
||||
|
||||
void a(ProcessCallback processCallback) {
|
||||
for (int size = this.a.size() - 1; size >= 0; size--) {
|
||||
RecyclerView.ViewHolder b = this.a.b(size);
|
||||
InfoRecord c = this.a.c(size);
|
||||
int i = c.a;
|
||||
if ((i & 3) == 3) {
|
||||
processCallback.a(b);
|
||||
} else if ((i & 1) != 0) {
|
||||
RecyclerView.ItemAnimator.ItemHolderInfo itemHolderInfo = c.b;
|
||||
if (itemHolderInfo == null) {
|
||||
processCallback.a(b);
|
||||
} else {
|
||||
processCallback.b(b, itemHolderInfo, c.c);
|
||||
}
|
||||
} else if ((i & 14) == 14) {
|
||||
processCallback.a(b, c.b, c.c);
|
||||
} else if ((i & 12) == 12) {
|
||||
processCallback.c(b, c.b, c.c);
|
||||
} else if ((i & 4) != 0) {
|
||||
processCallback.b(b, c.b, null);
|
||||
} else if ((i & 8) != 0) {
|
||||
processCallback.a(b, c.b, c.c);
|
||||
}
|
||||
InfoRecord.a(c);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user