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, CategoryTemp::class,
Installed::class, Installed::class,
Lock::class Lock::class
], version = 5 ], version = 6
) )
@TypeConverters(Converters::class) @TypeConverters(Converters::class)
abstract class DatabaseX : RoomDatabase() { abstract class DatabaseX : RoomDatabase() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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