2512: Allow more than 5 tabs (#4051)
Fixes #2512  Can add an arbitrary number of tabs. Graphical behavior is unchanged for small numbers: the whole space if filled with the tabs - they are enlarged if needed. If there are more the mode switches to "scrollable". This does not, however, look very differently (see screenshot with the current tab scrolled out). --------- Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
This commit is contained in:
parent
1f8bf728db
commit
81a04c8977
5 changed files with 46 additions and 27 deletions
|
|
@ -164,18 +164,12 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
|
|||
toggleFab(false)
|
||||
}
|
||||
|
||||
binding.maxTabsInfo.text = resources.getQuantityString(R.plurals.max_tab_number_reached, MAX_TAB_COUNT, MAX_TAB_COUNT)
|
||||
|
||||
updateAvailableTabs()
|
||||
|
||||
onBackPressedDispatcher.addCallback(onFabDismissedCallback)
|
||||
}
|
||||
|
||||
override fun onTabAdded(tab: TabData) {
|
||||
if (currentTabs.size >= MAX_TAB_COUNT) {
|
||||
return
|
||||
}
|
||||
|
||||
toggleFab(false)
|
||||
|
||||
if (tab.id == HASHTAG) {
|
||||
|
|
@ -395,8 +389,6 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
|
|||
addableTabs.add(createTabDataFromId(LIST))
|
||||
|
||||
addTabAdapter.updateData(addableTabs)
|
||||
|
||||
binding.maxTabsInfo.visible(addableTabs.size == 0 || currentTabs.size >= MAX_TAB_COUNT)
|
||||
currentTabsAdapter.setRemoveButtonVisible(currentTabs.size > MIN_TAB_COUNT)
|
||||
}
|
||||
|
||||
|
|
@ -429,6 +421,5 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
|
|||
|
||||
companion object {
|
||||
private const val MIN_TAB_COUNT = 2
|
||||
private const val MAX_TAB_COUNT = 5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue