|
|
@ -50,16 +50,46 @@ private fun normalModeAdapterItems(
|
|
|
|
|
|
|
|
|
|
|
|
items.add(AdapterItem.TabHeader(false, tabs.isNotEmpty()))
|
|
|
|
items.add(AdapterItem.TabHeader(false, tabs.isNotEmpty()))
|
|
|
|
|
|
|
|
|
|
|
|
if (tabs.isNotEmpty()) {
|
|
|
|
when {
|
|
|
|
|
|
|
|
tabs.isNotEmpty() && collections.isNotEmpty() -> {
|
|
|
|
|
|
|
|
showTabs(items, tabs)
|
|
|
|
|
|
|
|
showCollections(collections, expandedCollections, tabs, items)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tabs.isNotEmpty() && collections.isEmpty() -> {
|
|
|
|
|
|
|
|
showTabs(items, tabs)
|
|
|
|
|
|
|
|
items.add(noCollectionMessage)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tabs.isEmpty() && collections.isNotEmpty() -> {
|
|
|
|
|
|
|
|
items.add(noTabMessage)
|
|
|
|
|
|
|
|
showCollections(collections, expandedCollections, tabs, items)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tabs.isEmpty() && collections.isEmpty() -> {
|
|
|
|
|
|
|
|
items.add(noTabMessage)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return items
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showTabs(
|
|
|
|
|
|
|
|
items: MutableList<AdapterItem>,
|
|
|
|
|
|
|
|
tabs: List<Tab>
|
|
|
|
|
|
|
|
) {
|
|
|
|
items.addAll(tabs.reversed().map(AdapterItem::TabItem))
|
|
|
|
items.addAll(tabs.reversed().map(AdapterItem::TabItem))
|
|
|
|
items.add(AdapterItem.SaveTabGroup)
|
|
|
|
items.add(AdapterItem.SaveTabGroup)
|
|
|
|
} else {
|
|
|
|
|
|
|
|
items.add(noTabMessage)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
items.add(AdapterItem.CollectionHeader)
|
|
|
|
private fun showCollections(
|
|
|
|
if (collections.isNotEmpty()) {
|
|
|
|
collections: List<TabCollection>,
|
|
|
|
|
|
|
|
expandedCollections: Set<Long>,
|
|
|
|
|
|
|
|
tabs: List<Tab>,
|
|
|
|
|
|
|
|
items: MutableList<AdapterItem>
|
|
|
|
|
|
|
|
) {
|
|
|
|
// If the collection is expanded, we want to add all of its tabs beneath it in the adapter
|
|
|
|
// If the collection is expanded, we want to add all of its tabs beneath it in the adapter
|
|
|
|
|
|
|
|
items.add(AdapterItem.CollectionHeader)
|
|
|
|
collections.map {
|
|
|
|
collections.map {
|
|
|
|
AdapterItem.CollectionItem(it, expandedCollections.contains(it.id), tabs.isNotEmpty())
|
|
|
|
AdapterItem.CollectionItem(it, expandedCollections.contains(it.id), tabs.isNotEmpty())
|
|
|
|
}.forEach {
|
|
|
|
}.forEach {
|
|
|
@ -68,11 +98,6 @@ private fun normalModeAdapterItems(
|
|
|
|
items.addAll(collectionTabItems(it.collection))
|
|
|
|
items.addAll(collectionTabItems(it.collection))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
items.add(noCollectionMessage)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return items
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun privateModeAdapterItems(tabs: List<Tab>): List<AdapterItem> {
|
|
|
|
private fun privateModeAdapterItems(tabs: List<Tab>): List<AdapterItem> {
|
|
|
|