Rabbit-R1/original r1/smali/smali_classes2/androidx/recyclerview/widget/RecyclerView$RecycledViewPool.smali
2024-05-21 17:08:36 -04:00

731 lines
19 KiB
Smali

.class public Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;
.super Ljava/lang/Object;
.source "RecyclerView.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Landroidx/recyclerview/widget/RecyclerView;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x9
name = "RecycledViewPool"
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
}
.end annotation
# static fields
.field private static final DEFAULT_MAX_SCRAP:I = 0x5
# instance fields
.field mAttachCountForClearing:I
.field mAttachedAdaptersForPoolingContainer:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Landroidx/recyclerview/widget/RecyclerView$Adapter<",
"*>;>;"
}
.end annotation
.end field
.field mScrap:Landroid/util/SparseArray;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/util/SparseArray<",
"Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
.line 6186
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 6210
new-instance v0, Landroid/util/SparseArray;
invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V
iput-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
const/4 v0, 0x0
iput v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
.line 6237
new-instance v0, Ljava/util/IdentityHashMap;
invoke-direct {v0}, Ljava/util/IdentityHashMap;-><init>()V
.line 6238
invoke-static {v0}, Ljava/util/Collections;->newSetFromMap(Ljava/util/Map;)Ljava/util/Set;
move-result-object v0
iput-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachedAdaptersForPoolingContainer:Ljava/util/Set;
return-void
.end method
.method private getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
.locals 1
iget-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6431
invoke-virtual {v0, p1}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
if-nez v0, :cond_0
.line 6433
new-instance v0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
invoke-direct {v0}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;-><init>()V
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6434
invoke-virtual {p0, p1, v0}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
:cond_0
return-object v0
.end method
# virtual methods
.method attach()V
.locals 1
iget v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
return-void
.end method
.method attachForPoolingContainer(Landroidx/recyclerview/widget/RecyclerView$Adapter;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/recyclerview/widget/RecyclerView$Adapter<",
"*>;)V"
}
.end annotation
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachedAdaptersForPoolingContainer:Ljava/util/Set;
.line 6379
invoke-interface {p0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public clear()V
.locals 4
const/4 v0, 0x0
:goto_0
iget-object v1, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6244
invoke-virtual {v1}, Landroid/util/SparseArray;->size()I
move-result v1
if-ge v0, v1, :cond_1
iget-object v1, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6245
invoke-virtual {v1, v0}, Landroid/util/SparseArray;->valueAt(I)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
.line 6246
iget-object v2, v1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_1
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_0
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
.line 6247
iget-object v3, v3, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;
invoke-static {v3}, Landroidx/customview/poolingcontainer/PoolingContainer;->callPoolingContainerOnRelease(Landroid/view/View;)V
goto :goto_1
.line 6249
:cond_0
iget-object v1, v1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
invoke-virtual {v1}, Ljava/util/ArrayList;->clear()V
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
return-void
.end method
.method detach()V
.locals 1
iget v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
add-int/lit8 v0, v0, -0x1
iput v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
return-void
.end method
.method detachForPoolingContainer(Landroidx/recyclerview/widget/RecyclerView$Adapter;Z)V
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/recyclerview/widget/RecyclerView$Adapter<",
"*>;Z)V"
}
.end annotation
iget-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachedAdaptersForPoolingContainer:Ljava/util/Set;
.line 6393
invoke-interface {v0, p1}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
iget-object p1, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachedAdaptersForPoolingContainer:Ljava/util/Set;
.line 6394
invoke-interface {p1}, Ljava/util/Set;->size()I
move-result p1
if-nez p1, :cond_1
if-nez p2, :cond_1
const/4 p1, 0x0
move p2, p1
:goto_0
iget-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6395
invoke-virtual {v0}, Landroid/util/SparseArray;->size()I
move-result v0
if-ge p2, v0, :cond_1
iget-object v0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6396
invoke-virtual {v0, p2}, Landroid/util/SparseArray;->keyAt(I)I
move-result v1
invoke-virtual {v0, v1}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
iget-object v0, v0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
move v1, p1
.line 6397
:goto_1
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v2
if-ge v1, v2, :cond_0
.line 6399
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
iget-object v2, v2, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;
.line 6398
invoke-static {v2}, Landroidx/customview/poolingcontainer/PoolingContainer;->callPoolingContainerOnRelease(Landroid/view/View;)V
add-int/lit8 v1, v1, 0x1
goto :goto_1
:cond_0
add-int/lit8 p2, p2, 0x1
goto :goto_0
:cond_1
return-void
.end method
.method factorInBindTime(IJ)V
.locals 2
.line 6348
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p1
.line 6349
iget-wide v0, p1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mBindRunningAverageNs:J
invoke-virtual {p0, v0, v1, p2, p3}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->runningAverage(JJ)J
move-result-wide p2
iput-wide p2, p1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mBindRunningAverageNs:J
return-void
.end method
.method factorInCreateTime(IJ)V
.locals 2
.line 6342
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p1
.line 6343
iget-wide v0, p1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mCreateRunningAverageNs:J
invoke-virtual {p0, v0, v1, p2, p3}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->runningAverage(JJ)J
move-result-wide p2
iput-wide p2, p1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mCreateRunningAverageNs:J
return-void
.end method
.method public getRecycledView(I)Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
.locals 1
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6285
invoke-virtual {p0, p1}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
move-result-object p0
check-cast p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
if-eqz p0, :cond_1
.line 6286
iget-object p1, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
invoke-virtual {p1}, Ljava/util/ArrayList;->isEmpty()Z
move-result p1
if-nez p1, :cond_1
.line 6287
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
.line 6288
invoke-virtual {p0}, Ljava/util/ArrayList;->size()I
move-result p1
add-int/lit8 p1, p1, -0x1
:goto_0
if-ltz p1, :cond_1
.line 6289
invoke-virtual {p0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->isAttachedToTransitionOverlay()Z
move-result v0
if-nez v0, :cond_0
.line 6290
invoke-virtual {p0, p1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
move-result-object p0
check-cast p0, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;
return-object p0
:cond_0
add-int/lit8 p1, p1, -0x1
goto :goto_0
:cond_1
const/4 p0, 0x0
return-object p0
.end method
.method public getRecycledViewCount(I)I
.locals 0
.line 6272
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p0
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
invoke-virtual {p0}, Ljava/util/ArrayList;->size()I
move-result p0
return p0
.end method
.method onAdapterChanged(Landroidx/recyclerview/widget/RecyclerView$Adapter;Landroidx/recyclerview/widget/RecyclerView$Adapter;Z)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/recyclerview/widget/RecyclerView$Adapter<",
"*>;",
"Landroidx/recyclerview/widget/RecyclerView$Adapter<",
"*>;Z)V"
}
.end annotation
if-eqz p1, :cond_0
.line 6420
invoke-virtual {p0}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->detach()V
:cond_0
if-nez p3, :cond_1
iget p1, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mAttachCountForClearing:I
if-nez p1, :cond_1
.line 6423
invoke-virtual {p0}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->clear()V
:cond_1
if-eqz p2, :cond_2
.line 6426
invoke-virtual {p0}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->attach()V
:cond_2
return-void
.end method
.method public putRecycledView(Landroidx/recyclerview/widget/RecyclerView$ViewHolder;)V
.locals 2
.line 6321
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->getItemViewType()I
move-result v0
.line 6322
invoke-direct {p0, v0}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object v1
iget-object v1, v1, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6323
invoke-virtual {p0, v0}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
move-result-object p0
check-cast p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
iget p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mMaxScrap:I
invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
move-result v0
if-gt p0, v0, :cond_0
.line 6324
iget-object p0, p1, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;
invoke-static {p0}, Landroidx/customview/poolingcontainer/PoolingContainer;->callPoolingContainerOnRelease(Landroid/view/View;)V
return-void
.line 6327
:cond_0
sget-boolean p0, Landroidx/recyclerview/widget/RecyclerView;->sDebugAssertionsEnabled:Z
if-eqz p0, :cond_2
invoke-virtual {v1, p1}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z
move-result p0
if-nez p0, :cond_1
goto :goto_0
.line 6328
:cond_1
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "this scrap item already exists"
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 6330
:cond_2
:goto_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->resetInternal()V
.line 6331
invoke-virtual {v1, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
return-void
.end method
.method runningAverage(JJ)J
.locals 4
const-wide/16 v0, 0x0
cmp-long p0, p1, v0
if-nez p0, :cond_0
return-wide p3
:cond_0
const-wide/16 v0, 0x4
.line 6338
div-long/2addr p1, v0
const-wide/16 v2, 0x3
mul-long/2addr p1, v2
div-long/2addr p3, v0
add-long/2addr p1, p3
return-wide p1
.end method
.method public setMaxRecycledViews(II)V
.locals 0
.line 6260
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p0
.line 6261
iput p2, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mMaxScrap:I
.line 6262
iget-object p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
.line 6263
:goto_0
invoke-virtual {p0}, Ljava/util/ArrayList;->size()I
move-result p1
if-le p1, p2, :cond_0
.line 6264
invoke-virtual {p0}, Ljava/util/ArrayList;->size()I
move-result p1
add-int/lit8 p1, p1, -0x1
invoke-virtual {p0, p1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
goto :goto_0
:cond_0
return-void
.end method
.method size()I
.locals 3
const/4 v0, 0x0
move v1, v0
:goto_0
iget-object v2, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6304
invoke-virtual {v2}, Landroid/util/SparseArray;->size()I
move-result v2
if-ge v0, v2, :cond_1
iget-object v2, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->mScrap:Landroid/util/SparseArray;
.line 6305
invoke-virtual {v2, v0}, Landroid/util/SparseArray;->valueAt(I)Ljava/lang/Object;
move-result-object v2
check-cast v2, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
iget-object v2, v2, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mScrapHeap:Ljava/util/ArrayList;
if-eqz v2, :cond_0
.line 6307
invoke-virtual {v2}, Ljava/util/ArrayList;->size()I
move-result v2
add-int/2addr v1, v2
:cond_0
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
return v1
.end method
.method willBindInTime(IJJ)Z
.locals 2
.line 6359
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p0
iget-wide p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mBindRunningAverageNs:J
const-wide/16 v0, 0x0
cmp-long v0, p0, v0
if-eqz v0, :cond_1
add-long/2addr p2, p0
cmp-long p0, p2, p4
if-gez p0, :cond_0
goto :goto_0
:cond_0
const/4 p0, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 p0, 0x1
:goto_1
return p0
.end method
.method willCreateInTime(IJJ)Z
.locals 2
.line 6354
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;->getScrapDataForType(I)Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;
move-result-object p0
iget-wide p0, p0, Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool$ScrapData;->mCreateRunningAverageNs:J
const-wide/16 v0, 0x0
cmp-long v0, p0, v0
if-eqz v0, :cond_1
add-long/2addr p2, p0
cmp-long p0, p2, p4
if-gez p0, :cond_0
goto :goto_0
:cond_0
const/4 p0, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 p0, 0x1
:goto_1
return p0
.end method