506 lines
13 KiB
Smali
506 lines
13 KiB
Smali
.class public abstract Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;
|
|
.super Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple;
|
|
.source "DragAndDropAdapter.kt"
|
|
|
|
# interfaces
|
|
.implements Lcom/discord/utilities/mg_recycler/DragAndDropHelper$Adapter;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T::",
|
|
"Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;",
|
|
">",
|
|
"Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple<",
|
|
"TT;>;",
|
|
"Lcom/discord/utilities/mg_recycler/DragAndDropHelper$Adapter;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private dataCopy:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private origPositions:Ljava/util/Map;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Integer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroidx/recyclerview/widget/RecyclerView;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-direct {p0, p1, v0}, Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple;-><init>(Landroidx/recyclerview/widget/RecyclerView;Z)V
|
|
|
|
new-instance p1, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
check-cast p1, Ljava/util/List;
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
new-instance p1, Ljava/util/HashMap;
|
|
|
|
invoke-direct {p1}, Ljava/util/HashMap;-><init>()V
|
|
|
|
check-cast p1, Ljava/util/Map;
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final computeOriginalPositions(Ljava/util/List;)V
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"+TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
invoke-interface {v0}, Ljava/util/Map;->clear()V
|
|
|
|
invoke-interface {p1}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-static {v1, v0}, Lkotlin/ranges/c;->Y(II)Lkotlin/ranges/IntRange;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/lang/Iterable;
|
|
|
|
new-instance v1, Ljava/util/ArrayList;
|
|
|
|
const/16 v2, 0xa
|
|
|
|
invoke-static {v0, v2}, Lkotlin/a/m;->a(Ljava/lang/Iterable;I)I
|
|
|
|
move-result v2
|
|
|
|
invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
check-cast v1, Ljava/util/Collection;
|
|
|
|
invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_0
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
move-object v2, v0
|
|
|
|
check-cast v2, Lkotlin/a/ab;
|
|
|
|
invoke-virtual {v2}, Lkotlin/a/ab;->nextInt()I
|
|
|
|
move-result v2
|
|
|
|
invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;
|
|
|
|
invoke-interface {v1, v2}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
check-cast v1, Ljava/util/List;
|
|
|
|
check-cast v1, Ljava/lang/Iterable;
|
|
|
|
invoke-interface {v1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_1
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;
|
|
|
|
iget-object v1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
invoke-interface {v0}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;->getKey()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v3, "item.key"
|
|
|
|
invoke-static {v2, v3}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {v0}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;->getPosition()I
|
|
|
|
move-result v0
|
|
|
|
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method private final setAndCopyData(Ljava/util/List;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"+TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-super {p0, p1}, Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple;->setData(Ljava/util/List;)V
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
check-cast p1, Ljava/util/Collection;
|
|
|
|
invoke-direct {v0, p1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
|
|
|
|
check-cast v0, Ljava/util/List;
|
|
|
|
iput-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public computeChangedPositions()Ljava/util/Map;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Integer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
|
|
|
check-cast v0, Ljava/util/Map;
|
|
|
|
iget-object v1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v1}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, v1, :cond_2
|
|
|
|
iget-object v3, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;
|
|
|
|
invoke-interface {v3}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;->getKey()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
iget-object v4, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
invoke-interface {v4, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Ljava/lang/Integer;
|
|
|
|
if-nez v4, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I
|
|
|
|
move-result v4
|
|
|
|
if-eq v2, v4, :cond_1
|
|
|
|
:goto_1
|
|
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-interface {v0, v3, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
:cond_1
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method protected final getDataCopy()Ljava/util/List;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/List<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method protected final getOrigPositions()Ljava/util/Map;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Integer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method protected final isMoveWithinBounds(II)Z
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
new-instance v0, Lkotlin/ranges/IntRange;
|
|
|
|
iget-object v2, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v2}, Ljava/util/List;->size()I
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, 0x1
|
|
|
|
sub-int/2addr v2, v3
|
|
|
|
invoke-direct {v0, v1, v2}, Lkotlin/ranges/IntRange;-><init>(II)V
|
|
|
|
invoke-virtual {v0, p1}, Lkotlin/ranges/IntRange;->contains(I)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
invoke-virtual {v0, p2}, Lkotlin/ranges/IntRange;->contains(I)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
return v3
|
|
|
|
:cond_1
|
|
return v1
|
|
.end method
|
|
|
|
.method public onDrop()V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
check-cast v0, Ljava/util/Collection;
|
|
|
|
invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
xor-int/lit8 v0, v0, 0x1
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-virtual {p0}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->computeChangedPositions()Ljava/util/Map;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Ljava/util/Map;->isEmpty()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->onNewPositions(Ljava/util/Map;)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public onItemMove(II)V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter$Payload;
|
|
|
|
iget-object v1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {v1, p1}, Ljava/util/List;->remove(I)Ljava/lang/Object;
|
|
|
|
iget-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-interface {p1, p2, v0}, Ljava/util/List;->add(ILjava/lang/Object;)V
|
|
|
|
iget-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->setAndCopyData(Ljava/util/List;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public abstract onNewPositions(Ljava/util/Map;)V
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Integer;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
.end method
|
|
|
|
.method public setData(Ljava/util/List;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "data"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->computeOriginalPositions(Ljava/util/List;)V
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->setAndCopyData(Ljava/util/List;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected final setDataCopy(Ljava/util/List;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "<set-?>"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->dataCopy:Ljava/util/List;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected final setOrigPositions(Ljava/util/Map;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Integer;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "<set-?>"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iput-object p1, p0, Lcom/discord/utilities/mg_recycler/DragAndDropAdapter;->origPositions:Ljava/util/Map;
|
|
|
|
return-void
|
|
.end method
|