Merge pull request #10568 from abextm/banktags-new-at-end

banktags: move new tagtab button to the bottom of the list
This commit is contained in:
Abex
2020-01-09 04:41:05 -07:00
committed by GitHub

View File

@@ -859,19 +859,21 @@ public class TabInterface
--maxTabs;
}
if (currentTabIndex + direction >= tabManager.size() || currentTabIndex + direction < 0)
int proposedIndex = currentTabIndex + direction;
int numTabs = tabManager.size() + 1;
if (proposedIndex >= numTabs || proposedIndex < 0)
{
currentTabIndex = 0;
}
if ((tabManager.size() - (currentTabIndex + direction) >= maxTabs) && (currentTabIndex + direction > -1))
else if (numTabs - proposedIndex >= maxTabs)
{
currentTabIndex += direction;
currentTabIndex = proposedIndex;
}
else if (maxTabs < tabManager.size() && tabManager.size() - (currentTabIndex + direction) < maxTabs)
else if (maxTabs < numTabs && numTabs - proposedIndex < maxTabs)
{
// Edge case when only 1 tab displays instead of up to maxTabs when one is deleted at the end of the list
currentTabIndex += direction;
currentTabIndex = proposedIndex;
scrollTab(-1);
}
@@ -952,7 +954,7 @@ public class TabInterface
{
int y = bounds.y + MARGIN + BUTTON_HEIGHT;
if (maxTabs >= tabManager.size())
if (maxTabs > tabManager.size())
{
currentTabIndex = 0;
}
@@ -978,6 +980,8 @@ public class TabInterface
y += TAB_HEIGHT + MARGIN;
}
updateWidget(newTab, y);
boolean hidden = !(tabManager.size() > 0);
upButton.setHidden(hidden);