Commit c49d74ff authored by Ryan Landay's avatar Ryan Landay Committed by Commit Bot

Change StackLayout#setActiveStackState() to take an int

StackLayout#setActiveStackState() is used by StackLayout to set the currently
active tab stack. This method currently takes a boolean (true for the incognito
stack, false for the normal stack). This CL changes this method to instead take
an integer representing an index, so we can support more than two tab stacks.

This CL also changes this method to return void (previously it was returning a
boolean: true if the active stack was actually changed, and false if it wasn't),
since the return value is never actually used.

Bug: 648314
Change-Id: Ief119b4a1a92f8345b2b3556f9003cf4e3092f61
Reviewed-on: https://chromium-review.googlesource.com/957274
Commit-Queue: Ryan Landay <rlanday@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542266}
parent c685293e
...@@ -285,7 +285,7 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper ...@@ -285,7 +285,7 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper
nextIndex = currentIndex - 1; nextIndex = currentIndex - 1;
} }
if (mStacks.get(nextIndex).isDisplayable()) { if (mStacks.get(nextIndex).isDisplayable()) {
setActiveStackState(nextIndex == 1); setActiveStackState(nextIndex);
} }
} }
...@@ -1081,7 +1081,7 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper ...@@ -1081,7 +1081,7 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper
*/ */
private void flingStacks(int index) { private void flingStacks(int index) {
// velocityX is measured in pixel per second. // velocityX is measured in pixel per second.
setActiveStackState(index == INCOGNITO_STACK_INDEX); setActiveStackState(index);
finishScrollStacks(); finishScrollStacks();
requestStackUpdate(); requestStackUpdate();
} }
...@@ -1226,13 +1226,10 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper ...@@ -1226,13 +1226,10 @@ public class StackLayout extends Layout implements Animatable<StackLayout.Proper
/** /**
* Sets the active tab stack. * Sets the active tab stack.
* *
* @param isIncognito True if the model to select is incognito. * @param stackIndex Index of the tab stack to be made active.
* @return Whether the tab stack index passed in differed from the currently selected stack.
*/ */
public boolean setActiveStackState(boolean isIncognito) { public void setActiveStackState(int stackIndex) {
if (isIncognito == mTabModelSelector.isIncognitoSelected()) return false; mTemporarySelectedStack = stackIndex;
mTemporarySelectedStack = isIncognito ? INCOGNITO_STACK_INDEX : NORMAL_STACK_INDEX;
return true;
} }
private void resetScrollData() { private void resetScrollData() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment