apkfuckery/com.discord/smali/androidx/room/paging/LimitOffsetDataSource.smali

436 lines
14 KiB
Smali
Raw Normal View History

2019-07-24 11:27:29 +00:00
.class public abstract Landroidx/room/paging/LimitOffsetDataSource;
.super Landroidx/paging/PositionalDataSource;
.source "LimitOffsetDataSource.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Landroidx/paging/PositionalDataSource<",
"TT;>;"
}
.end annotation
# instance fields
.field private final mCountQuery:Ljava/lang/String;
.field private final mDb:Landroidx/room/RoomDatabase;
.field private final mInTransaction:Z
.field private final mLimitOffsetQuery:Ljava/lang/String;
.field private final mObserver:Landroidx/room/InvalidationTracker$Observer;
.field private final mSourceQuery:Landroidx/room/RoomSQLiteQuery;
# direct methods
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;Z[Ljava/lang/String;)V
.locals 0
invoke-direct {p0}, Landroidx/paging/PositionalDataSource;-><init>()V
iput-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
iput-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
iput-boolean p3, p0, Landroidx/room/paging/LimitOffsetDataSource;->mInTransaction:Z
new-instance p2, Ljava/lang/StringBuilder;
const-string p3, "SELECT COUNT(*) FROM ( "
invoke-direct {p2, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget-object p3, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {p3}, Landroidx/room/RoomSQLiteQuery;->getSql()Ljava/lang/String;
move-result-object p3
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p3, " )"
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p2
iput-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mCountQuery:Ljava/lang/String;
new-instance p2, Ljava/lang/StringBuilder;
const-string p3, "SELECT * FROM ( "
invoke-direct {p2, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget-object p3, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {p3}, Landroidx/room/RoomSQLiteQuery;->getSql()Ljava/lang/String;
move-result-object p3
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p3, " ) LIMIT ? OFFSET ?"
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p2
iput-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mLimitOffsetQuery:Ljava/lang/String;
new-instance p2, Landroidx/room/paging/LimitOffsetDataSource$1;
invoke-direct {p2, p0, p4}, Landroidx/room/paging/LimitOffsetDataSource$1;-><init>(Landroidx/room/paging/LimitOffsetDataSource;[Ljava/lang/String;)V
iput-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mObserver:Landroidx/room/InvalidationTracker$Observer;
invoke-virtual {p1}, Landroidx/room/RoomDatabase;->getInvalidationTracker()Landroidx/room/InvalidationTracker;
move-result-object p1
iget-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mObserver:Landroidx/room/InvalidationTracker$Observer;
invoke-virtual {p1, p2}, Landroidx/room/InvalidationTracker;->addWeakObserver(Landroidx/room/InvalidationTracker$Observer;)V
return-void
.end method
.method protected varargs constructor <init>(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z[Ljava/lang/String;)V
.locals 0
invoke-static {p2}, Landroidx/room/RoomSQLiteQuery;->copyFrom(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroidx/room/RoomSQLiteQuery;
move-result-object p2
invoke-direct {p0, p1, p2, p3, p4}, Landroidx/room/paging/LimitOffsetDataSource;-><init>(Landroidx/room/RoomDatabase;Landroidx/room/RoomSQLiteQuery;Z[Ljava/lang/String;)V
return-void
.end method
# virtual methods
.method protected abstract convertRows(Landroid/database/Cursor;)Ljava/util/List;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/database/Cursor;",
")",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
.end method
.method public countItems()I
.locals 4
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mCountQuery:Ljava/lang/String;
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {v1}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result v1
invoke-static {v0, v1}, Landroidx/room/RoomSQLiteQuery;->acquire(Ljava/lang/String;I)Landroidx/room/RoomSQLiteQuery;
move-result-object v0
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {v0, v1}, Landroidx/room/RoomSQLiteQuery;->copyArgumentsFrom(Landroidx/room/RoomSQLiteQuery;)V
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {v1, v0}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object v1
:try_start_0
invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z
move-result v2
const/4 v3, 0x0
if-eqz v2, :cond_0
invoke-interface {v1, v3}, Landroid/database/Cursor;->getInt(I)I
move-result v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-interface {v1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return v2
:cond_0
invoke-interface {v1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return v3
:catchall_0
move-exception v2
invoke-interface {v1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
throw v2
.end method
.method public isInvalid()Z
.locals 1
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {v0}, Landroidx/room/RoomDatabase;->getInvalidationTracker()Landroidx/room/InvalidationTracker;
move-result-object v0
invoke-virtual {v0}, Landroidx/room/InvalidationTracker;->refreshVersionsSync()V
invoke-super {p0}, Landroidx/paging/PositionalDataSource;->isInvalid()Z
move-result v0
return v0
.end method
.method public loadInitial(Landroidx/paging/PositionalDataSource$LoadInitialParams;Landroidx/paging/PositionalDataSource$LoadInitialCallback;)V
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/paging/PositionalDataSource$LoadInitialParams;",
"Landroidx/paging/PositionalDataSource$LoadInitialCallback<",
"TT;>;)V"
}
.end annotation
invoke-virtual {p0}, Landroidx/room/paging/LimitOffsetDataSource;->countItems()I
move-result v0
if-nez v0, :cond_0
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object p1
const/4 v0, 0x0
invoke-virtual {p2, p1, v0, v0}, Landroidx/paging/PositionalDataSource$LoadInitialCallback;->onResult(Ljava/util/List;II)V
return-void
:cond_0
invoke-static {p1, v0}, Landroidx/room/paging/LimitOffsetDataSource;->computeInitialLoadPosition(Landroidx/paging/PositionalDataSource$LoadInitialParams;I)I
move-result v1
invoke-static {p1, v1, v0}, Landroidx/room/paging/LimitOffsetDataSource;->computeInitialLoadSize(Landroidx/paging/PositionalDataSource$LoadInitialParams;II)I
move-result p1
invoke-virtual {p0, v1, p1}, Landroidx/room/paging/LimitOffsetDataSource;->loadRange(II)Ljava/util/List;
move-result-object v2
if-eqz v2, :cond_1
invoke-interface {v2}, Ljava/util/List;->size()I
move-result v3
if-ne v3, p1, :cond_1
invoke-virtual {p2, v2, v1, v0}, Landroidx/paging/PositionalDataSource$LoadInitialCallback;->onResult(Ljava/util/List;II)V
return-void
:cond_1
invoke-virtual {p0}, Landroidx/room/paging/LimitOffsetDataSource;->invalidate()V
return-void
.end method
.method public loadRange(II)Ljava/util/List;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(II)",
"Ljava/util/List<",
"TT;>;"
}
.end annotation
iget-object v0, p0, Landroidx/room/paging/LimitOffsetDataSource;->mLimitOffsetQuery:Ljava/lang/String;
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {v1}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result v1
add-int/lit8 v1, v1, 0x2
invoke-static {v0, v1}, Landroidx/room/RoomSQLiteQuery;->acquire(Ljava/lang/String;I)Landroidx/room/RoomSQLiteQuery;
move-result-object v0
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mSourceQuery:Landroidx/room/RoomSQLiteQuery;
invoke-virtual {v0, v1}, Landroidx/room/RoomSQLiteQuery;->copyArgumentsFrom(Landroidx/room/RoomSQLiteQuery;)V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result v1
add-int/lit8 v1, v1, -0x1
int-to-long v2, p2
invoke-virtual {v0, v1, v2, v3}, Landroidx/room/RoomSQLiteQuery;->bindLong(IJ)V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->getArgCount()I
move-result p2
int-to-long v1, p1
invoke-virtual {v0, p2, v1, v2}, Landroidx/room/RoomSQLiteQuery;->bindLong(IJ)V
iget-boolean p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mInTransaction:Z
if-eqz p1, :cond_2
iget-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {p1}, Landroidx/room/RoomDatabase;->beginTransaction()V
const/4 p1, 0x0
:try_start_0
iget-object p2, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {p2, v0}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p1
invoke-virtual {p0, p1}, Landroidx/room/paging/LimitOffsetDataSource;->convertRows(Landroid/database/Cursor;)Ljava/util/List;
move-result-object p2
iget-object v1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {v1}, Landroidx/room/RoomDatabase;->setTransactionSuccessful()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz p1, :cond_0
invoke-interface {p1}, Landroid/database/Cursor;->close()V
:cond_0
iget-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {p1}, Landroidx/room/RoomDatabase;->endTransaction()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return-object p2
:catchall_0
move-exception p2
if-eqz p1, :cond_1
invoke-interface {p1}, Landroid/database/Cursor;->close()V
:cond_1
iget-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {p1}, Landroidx/room/RoomDatabase;->endTransaction()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
throw p2
:cond_2
iget-object p1, p0, Landroidx/room/paging/LimitOffsetDataSource;->mDb:Landroidx/room/RoomDatabase;
invoke-virtual {p1, v0}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p1
:try_start_1
invoke-virtual {p0, p1}, Landroidx/room/paging/LimitOffsetDataSource;->convertRows(Landroid/database/Cursor;)Ljava/util/List;
move-result-object p2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
invoke-interface {p1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
return-object p2
:catchall_1
move-exception p2
invoke-interface {p1}, Landroid/database/Cursor;->close()V
invoke-virtual {v0}, Landroidx/room/RoomSQLiteQuery;->release()V
throw p2
.end method
.method public loadRange(Landroidx/paging/PositionalDataSource$LoadRangeParams;Landroidx/paging/PositionalDataSource$LoadRangeCallback;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroidx/paging/PositionalDataSource$LoadRangeParams;",
"Landroidx/paging/PositionalDataSource$LoadRangeCallback<",
"TT;>;)V"
}
.end annotation
iget v0, p1, Landroidx/paging/PositionalDataSource$LoadRangeParams;->startPosition:I
iget p1, p1, Landroidx/paging/PositionalDataSource$LoadRangeParams;->loadSize:I
invoke-virtual {p0, v0, p1}, Landroidx/room/paging/LimitOffsetDataSource;->loadRange(II)Ljava/util/List;
move-result-object p1
if-eqz p1, :cond_0
invoke-virtual {p2, p1}, Landroidx/paging/PositionalDataSource$LoadRangeCallback;->onResult(Ljava/util/List;)V
return-void
:cond_0
invoke-virtual {p0}, Landroidx/room/paging/LimitOffsetDataSource;->invalidate()V
return-void
.end method