mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-16 04:19:19 +00:00
Update: Migrate transformers (4.3/5 in replacing SQLite with Room)
This commit is contained in:
@ -3,11 +3,14 @@ package com.looker.droidify.utility
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.Signature
|
||||
import android.database.Cursor
|
||||
import android.graphics.drawable.Drawable
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.*
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.database.Database.jsonParse
|
||||
import com.looker.droidify.entity.InstalledItem
|
||||
import com.looker.droidify.entity.Product
|
||||
import com.looker.droidify.entity.ProductItem
|
||||
import com.looker.droidify.entity.Repository
|
||||
import com.looker.droidify.service.Connection
|
||||
import com.looker.droidify.service.DownloadService
|
||||
@ -109,3 +112,34 @@ object Utils {
|
||||
} else Unit
|
||||
}
|
||||
}
|
||||
|
||||
fun Cursor.getProduct(): Product = getBlob(getColumnIndex(ROW_DATA))
|
||||
.jsonParse {
|
||||
Product.deserialize(it).apply {
|
||||
this.repositoryId = getLong(getColumnIndex(ROW_REPOSITORY_ID))
|
||||
this.description = getString(getColumnIndex(ROW_DESCRIPTION))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Cursor.getProductItem(): ProductItem = getBlob(getColumnIndex(ROW_DATA_ITEM))
|
||||
.jsonParse {
|
||||
ProductItem.deserialize(it).apply {
|
||||
this.repositoryId = getLong(getColumnIndex(ROW_REPOSITORY_ID))
|
||||
this.packageName = getString(getColumnIndex(ROW_PACKAGE_NAME))
|
||||
this.name = getString(getColumnIndex(ROW_NAME))
|
||||
this.summary = getString(getColumnIndex(ROW_SUMMARY))
|
||||
this.installedVersion = getString(getColumnIndex(ROW_VERSION))
|
||||
.orEmpty()
|
||||
this.compatible = getInt(getColumnIndex(ROW_COMPATIBLE)) != 0
|
||||
this.canUpdate = getInt(getColumnIndex(ROW_CAN_UPDATE)) != 0
|
||||
this.matchRank = getInt(getColumnIndex(ROW_MATCH_RANK))
|
||||
}
|
||||
}
|
||||
|
||||
fun Cursor.getRepository(): Repository = getBlob(getColumnIndex(ROW_DATA))
|
||||
.jsonParse {
|
||||
Repository.deserialize(it).apply {
|
||||
this.id = getLong(getColumnIndex(ROW_ID))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user