Update: Rename Product's name to label

This commit is contained in:
machiav3lli 2022-04-08 02:23:06 +02:00
parent 13479e27d2
commit 92035ba7da
9 changed files with 20 additions and 20 deletions

View File

@ -21,7 +21,7 @@ import kotlinx.coroutines.launch
CategoryTemp::class,
Installed::class,
Lock::class
], version = 5
], version = 6
)
@TypeConverters(Converters::class)
abstract class DatabaseX : RoomDatabase() {

View File

@ -18,7 +18,7 @@ open class Product(
var repositoryId: Long,
var packageName: String
) {
var name: String = ""
var label: String = ""
var summary: String = ""
var description: String = ""
var added: Long = 0L
@ -45,7 +45,7 @@ open class Product(
constructor(
repositoryId: Long,
packageName: String,
name: String,
label: String,
summary: String,
description: String,
added: Long,
@ -66,7 +66,7 @@ open class Product(
changelog: String = "",
whatsNew: String = ""
) : this(repositoryId, packageName) {
this.name = name
this.label = label
this.summary = summary
this.description = description
this.added = added
@ -104,7 +104,7 @@ open class Product(
ProductItem(
repositoryId,
packageName,
name,
label,
summary,
icon,
metadataIcon,
@ -135,7 +135,7 @@ open class Product(
class ProductTemp(
repositoryId: Long,
packageName: String,
name: String,
label: String,
summary: String,
description: String,
added: Long,
@ -158,7 +158,7 @@ class ProductTemp(
) : Product(
repositoryId = repositoryId,
packageName = packageName,
name = name,
label = label,
summary = summary,
description = description,
added = added,
@ -183,7 +183,7 @@ class ProductTemp(
fun Product.asProductTemp(): ProductTemp = ProductTemp(
repositoryId = repositoryId,
packageName = packageName,
name = name,
label = label,
summary = summary,
description = description,
added = added,

View File

@ -92,7 +92,7 @@ class IndexHandler(private val repositoryId: Long, private val callback: Callbac
fun build(): Product = Product(
repositoryId = repositoryId,
packageName = packageName,
name = name,
label = name,
summary = summary,
description = description,
added = added,

View File

@ -219,7 +219,7 @@ object IndexV1Parser {
return Product(
repositoryId = repositoryId,
packageName = packageName,
name = name,
label = name,
summary = summary,
description = description,
added = added,

View File

@ -148,7 +148,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
val product: Product
) : Item() {
override val descriptor: String
get() = "app_info.${product.name}"
get() = "app_info.${product.label}"
override val viewType: ViewType
get() = ViewType.APP_INFO
@ -645,7 +645,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
}
val description = formatHtml(productRepository.first.description).apply {
if (productRepository.first.let { it.summary.isNotEmpty() && it.name != it.summary }) {
if (productRepository.first.let { it.summary.isNotEmpty() && it.label != it.summary }) {
if (isNotEmpty()) {
insert(0, "\n\n")
}
@ -1111,7 +1111,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
placeholder(holder.defaultIcon)
error(holder.defaultIcon)
}
holder.name.text = item.product.name
holder.name.text = item.product.label
holder.packageName.apply {
text = item.product.packageName
}

View File

@ -348,7 +348,7 @@ class AppDetailFragment() : ScreenFragment(), AppDetailAdapter.Callbacks {
?.let { (it.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() != 0 } == true
launch {
collapsingToolbar.title =
if (showPackageName) products[0].first.name.trimAfter(' ', 2)
if (showPackageName) products[0].first.label.trimAfter(' ', 2)
else getString(R.string.application)
}
}
@ -465,7 +465,7 @@ class AppDetailFragment() : ScreenFragment(), AppDetailAdapter.Callbacks {
} else Unit
}
AppDetailAdapter.Action.SHARE -> {
shareIntent(packageName, products[0].first.name)
shareIntent(packageName, products[0].first.label)
}
}::class
}
@ -552,7 +552,7 @@ class AppDetailFragment() : ScreenFragment(), AppDetailAdapter.Callbacks {
.firstOrNull()
if (productRepository != null) {
downloadConnection.binder?.enqueue(
packageName, productRepository.first.name,
packageName, productRepository.first.label,
productRepository.second, release
)
}

View File

@ -345,7 +345,7 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), AppDetailAdapter.Call
} else Unit
}
AppDetailAdapter.Action.SHARE -> {
shareIntent(packageName, productRepos[0].first.name)
shareIntent(packageName, productRepos[0].first.label)
}
}::class
}
@ -433,7 +433,7 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), AppDetailAdapter.Call
.firstOrNull()
if (productRepository != null) {
downloadConnection.binder?.enqueue(
packageName, productRepository.first.name,
packageName, productRepository.first.label,
productRepository.second, release
)
}

View File

@ -56,7 +56,7 @@ class InstalledFragment : MainNavFragmentX() {
}
) {
Scaffold { _ ->
ProductsVerticalRecycler(it.sortedBy(Product::name), repositories,
ProductsVerticalRecycler(it.sortedBy(Product::label), repositories,
onUserClick = { item ->
AppSheetX(item.packageName)
.showNow(parentFragmentManager, "Product ${item.packageName}")

View File

@ -102,7 +102,7 @@ object Utils {
if (productRepository != null && it != null && binder != null) {
binder.enqueue(
packageName,
productRepository.first.name,
productRepository.first.label,
productRepository.second,
it
)