ADD week 5
This commit is contained in:
66
02-Easy5/E5/sources/androidx/core/database/CursorKt.java
Normal file
66
02-Easy5/E5/sources/androidx/core/database/CursorKt.java
Normal file
@ -0,0 +1,66 @@
|
||||
package androidx.core.database;
|
||||
|
||||
import android.database.Cursor;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Cursor.kt */
|
||||
@Metadata(d1 = {"\u00008\n\u0000\n\u0002\u0010\u0012\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0006\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\b\u0004\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\n\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\u001a\u0017\u0010\u0000\u001a\u0004\u0018\u00010\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b\u001a\u001c\u0010\u0005\u001a\u0004\u0018\u00010\u0006*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¢\u0006\u0002\u0010\u0007\u001a\u001c\u0010\b\u001a\u0004\u0018\u00010\t*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¢\u0006\u0002\u0010\n\u001a\u001c\u0010\u000b\u001a\u0004\u0018\u00010\u0004*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¢\u0006\u0002\u0010\f\u001a\u001c\u0010\r\u001a\u0004\u0018\u00010\u000e*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¢\u0006\u0002\u0010\u000f\u001a\u001c\u0010\u0010\u001a\u0004\u0018\u00010\u0011*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¢\u0006\u0002\u0010\u0012\u001a\u0017\u0010\u0013\u001a\u0004\u0018\u00010\u0014*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¨\u0006\u0015"}, d2 = {"getBlobOrNull", "", "Landroid/database/Cursor;", "index", "", "getDoubleOrNull", "", "(Landroid/database/Cursor;I)Ljava/lang/Double;", "getFloatOrNull", "", "(Landroid/database/Cursor;I)Ljava/lang/Float;", "getIntOrNull", "(Landroid/database/Cursor;I)Ljava/lang/Integer;", "getLongOrNull", "", "(Landroid/database/Cursor;I)Ljava/lang/Long;", "getShortOrNull", "", "(Landroid/database/Cursor;I)Ljava/lang/Short;", "getStringOrNull", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class CursorKt {
|
||||
public static final byte[] getBlobOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return cursor.getBlob(i);
|
||||
}
|
||||
|
||||
public static final Double getDoubleOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return Double.valueOf(cursor.getDouble(i));
|
||||
}
|
||||
|
||||
public static final Float getFloatOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return Float.valueOf(cursor.getFloat(i));
|
||||
}
|
||||
|
||||
public static final Integer getIntOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return Integer.valueOf(cursor.getInt(i));
|
||||
}
|
||||
|
||||
public static final Long getLongOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return Long.valueOf(cursor.getLong(i));
|
||||
}
|
||||
|
||||
public static final Short getShortOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return Short.valueOf(cursor.getShort(i));
|
||||
}
|
||||
|
||||
public static final String getStringOrNull(Cursor cursor, int i) {
|
||||
Intrinsics.checkNotNullParameter(cursor, "<this>");
|
||||
if (cursor.isNull(i)) {
|
||||
return null;
|
||||
}
|
||||
return cursor.getString(i);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package androidx.core.database;
|
||||
|
||||
import android.database.CursorWindow;
|
||||
import android.os.Build;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CursorWindowCompat {
|
||||
private CursorWindowCompat() {
|
||||
}
|
||||
|
||||
public static CursorWindow create(String str, long j) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.createCursorWindow(str, j);
|
||||
}
|
||||
return Api15Impl.createCursorWindow(str);
|
||||
}
|
||||
|
||||
static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static CursorWindow createCursorWindow(String str, long j) {
|
||||
return new CursorWindow(str, j);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api15Impl {
|
||||
private Api15Impl() {
|
||||
}
|
||||
|
||||
static CursorWindow createCursorWindow(String str) {
|
||||
return new CursorWindow(str);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package androidx.core.database;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public final class DatabaseUtilsCompat {
|
||||
private DatabaseUtilsCompat() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String concatenateWhere(String str, String str2) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return str2;
|
||||
}
|
||||
if (TextUtils.isEmpty(str2)) {
|
||||
return str;
|
||||
}
|
||||
return "(" + str + ") AND (" + str2 + ")";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String[] appendSelectionArgs(String[] strArr, String[] strArr2) {
|
||||
if (strArr == null || strArr.length == 0) {
|
||||
return strArr2;
|
||||
}
|
||||
String[] strArr3 = new String[strArr.length + strArr2.length];
|
||||
System.arraycopy(strArr, 0, strArr3, 0, strArr.length);
|
||||
System.arraycopy(strArr2, 0, strArr3, strArr.length, strArr2.length);
|
||||
return strArr3;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package androidx.core.database.sqlite;
|
||||
|
||||
import android.database.sqlite.SQLiteCursor;
|
||||
import android.os.Build;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SQLiteCursorCompat {
|
||||
private SQLiteCursorCompat() {
|
||||
}
|
||||
|
||||
public static void setFillWindowForwardOnly(SQLiteCursor sQLiteCursor, boolean z) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
Api28Impl.setFillWindowForwardOnly(sQLiteCursor, z);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static void setFillWindowForwardOnly(SQLiteCursor sQLiteCursor, boolean z) {
|
||||
sQLiteCursor.setFillWindowForwardOnly(z);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package androidx.core.database.sqlite;
|
||||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.InlineMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: SQLiteDatabase.kt */
|
||||
@Metadata(d1 = {"\u0000\u001c\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a>\u0010\u0000\u001a\u0002H\u0001\"\u0004\b\u0000\u0010\u0001*\u00020\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u00042\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u0002H\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000¢\u0006\u0002\u0010\b\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\t"}, d2 = {"transaction", "T", "Landroid/database/sqlite/SQLiteDatabase;", "exclusive", "", "body", "Lkotlin/Function1;", "Lkotlin/ExtensionFunctionType;", "(Landroid/database/sqlite/SQLiteDatabase;ZLkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class SQLiteDatabaseKt {
|
||||
public static /* synthetic */ Object transaction$default(SQLiteDatabase sQLiteDatabase, boolean z, Function1 body, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
z = true;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(sQLiteDatabase, "<this>");
|
||||
Intrinsics.checkNotNullParameter(body, "body");
|
||||
if (z) {
|
||||
sQLiteDatabase.beginTransaction();
|
||||
} else {
|
||||
sQLiteDatabase.beginTransactionNonExclusive();
|
||||
}
|
||||
try {
|
||||
Object invoke = body.invoke(sQLiteDatabase);
|
||||
sQLiteDatabase.setTransactionSuccessful();
|
||||
return invoke;
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
sQLiteDatabase.endTransaction();
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final <T> T transaction(SQLiteDatabase sQLiteDatabase, boolean z, Function1<? super SQLiteDatabase, ? extends T> body) {
|
||||
Intrinsics.checkNotNullParameter(sQLiteDatabase, "<this>");
|
||||
Intrinsics.checkNotNullParameter(body, "body");
|
||||
if (z) {
|
||||
sQLiteDatabase.beginTransaction();
|
||||
} else {
|
||||
sQLiteDatabase.beginTransactionNonExclusive();
|
||||
}
|
||||
try {
|
||||
T invoke = body.invoke(sQLiteDatabase);
|
||||
sQLiteDatabase.setTransactionSuccessful();
|
||||
return invoke;
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
sQLiteDatabase.endTransaction();
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user