Fix blank library categories when using source categories

This commit is contained in:
Jobobby04 2023-06-24 10:35:07 -04:00
parent 3912757758
commit c95d6e79f4

View File

@ -1151,7 +1151,7 @@ class LibraryScreenModel(
.map { .map {
sourceManager.getOrStub(it) sourceManager.getOrStub(it)
} }
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name }) .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name.ifBlank { it.id.toString() } })
.map { it.id } .map { it.id }
}.mapKeys { }.mapKeys {
Category( Category(
@ -1159,7 +1159,8 @@ class LibraryScreenModel(
name = if (it.key == LocalSource.ID) { name = if (it.key == LocalSource.ID) {
context.getString(R.string.local_source) context.getString(R.string.local_source)
} else { } else {
sourceManager.getOrStub(it.key).name val source = sourceManager.getOrStub(it.key)
source.name.ifBlank { source.id.toString() }
}, },
order = sources.indexOf(it.key).takeUnless { it == -1 }?.toLong() ?: Long.MAX_VALUE, order = sources.indexOf(it.key).takeUnless { it == -1 }?.toLong() ?: Long.MAX_VALUE,
flags = displayMode.flag, flags = displayMode.flag,