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

For those who not have any categories
pull/3372/head
Jay 4 years ago
parent 1d0545f5de
commit 89ea8388ad

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

@ -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
}
}

Loading…
Cancel
Save