diff options
author | Michael Kolb <kolby@google.com> | 2011-12-15 16:01:27 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-15 16:01:27 -0800 |
commit | 13ea24d82c748d1a2ca701ad79e63772f73a5e66 (patch) | |
tree | 54be8c71ffcd52a64574a969e7366f72cab33ddb /src/com | |
parent | 1c3a6d2630b372ad2ecbe11f5cf9fcf033a0e365 (diff) | |
parent | f5261da39d50e722587772e5c230c4cc19f8decc (diff) | |
download | packages_apps_browser-13ea24d82c748d1a2ca701ad79e63772f73a5e66.zip packages_apps_browser-13ea24d82c748d1a2ca701ad79e63772f73a5e66.tar.gz packages_apps_browser-13ea24d82c748d1a2ca701ad79e63772f73a5e66.tar.bz2 |
Merge "Make Ctl-Tab and Shift-Ctl-Tab cycle tabs"
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/Controller.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 9683a47..c395935 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -2569,8 +2569,11 @@ public class Controller * returns the current tab if it can't advance */ private Tab getNextTab() { - return mTabControl.getTab(Math.min(mTabControl.getTabCount() - 1, - mTabControl.getCurrentPosition() + 1)); + int pos = mTabControl.getCurrentPosition() + 1; + if (pos >= mTabControl.getTabCount()) { + pos = 0; + } + return mTabControl.getTab(pos); } /** @@ -2578,8 +2581,11 @@ public class Controller * returns the current tab if it can't advance */ private Tab getPrevTab() { - return mTabControl.getTab(Math.max(0, - mTabControl.getCurrentPosition() - 1)); + int pos = mTabControl.getCurrentPosition() - 1; + if ( pos < 0) { + pos = mTabControl.getTabCount() - 1; + } + return mTabControl.getTab(pos); } /** |