Grouping menu sheet shows "ungrouped" instead of "categories" by use case

For those who not have any categories
This commit is contained in:
Jay 2020-05-18 00:50:58 -04:00
parent 1d0545f5de
commit 89ea8388ad
2 changed files with 3 additions and 3 deletions

View File

@ -445,7 +445,7 @@ class LibraryController(
MaterialMenuSheet.MenuSheetItem(
id,
LibraryGroup.groupTypeDrawableRes(id),
LibraryGroup.groupTypeStringRes(id)
LibraryGroup.groupTypeStringRes(id, presenter.allCategories.size > 1)
)
}
MaterialMenuSheet(

View File

@ -11,14 +11,14 @@ object LibraryGroup {
const val BY_TRACK_STATUS = 4
const val UNGROUPED = 5
fun groupTypeStringRes(type: Int): Int {
fun groupTypeStringRes(type: Int, hasCategories: Boolean = true): Int {
return when (type) {
BY_STATUS -> R.string.status
BY_TAG -> R.string.tag
BY_SOURCE -> R.string.sources
BY_TRACK_STATUS -> R.string.tracking_status
UNGROUPED -> R.string.ungrouped
else -> R.string.categories
else -> if (hasCategories) R.string.categories else R.string.ungrouped
}
}