diff options
author | Michael Kolb <kolby@google.com> | 2011-05-11 09:30:34 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2011-05-12 15:20:51 -0700 |
commit | c831b63308dd1f8ef71808db8344ca2566ba4ed4 (patch) | |
tree | 00d447b01b488a1975db08aee05dc594ff419d00 /src/com/android/browser/TabBar.java | |
parent | 386a098b7cbd6ad1d6f02e0a6668ffa50dd653c1 (diff) | |
download | android_packages_apps_Gello-c831b63308dd1f8ef71808db8344ca2566ba4ed4.tar.gz android_packages_apps_Gello-c831b63308dd1f8ef71808db8344ca2566ba4ed4.tar.bz2 android_packages_apps_Gello-c831b63308dd1f8ef71808db8344ca2566ba4ed4.zip |
introduce tab IDs
Tabs are identified by IDs now, instead of their position
Refactored the save/restore code
Change-Id: I7133d55831201d097dc19ec938a85e7085f36749
Diffstat (limited to 'src/com/android/browser/TabBar.java')
-rw-r--r-- | src/com/android/browser/TabBar.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java index 31c07409..a574d26f 100644 --- a/src/com/android/browser/TabBar.java +++ b/src/com/android/browser/TabBar.java @@ -155,7 +155,7 @@ public class TabBar extends LinearLayout TabView tv = buildTabView(tab); mTabs.addTab(tv); } - mTabs.setSelectedTab(mTabControl.getCurrentIndex()); + mTabs.setSelectedTab(mTabControl.getCurrentPosition()); } @Override @@ -210,11 +210,12 @@ public class TabBar extends LinearLayout } else { showUrlBar(); } - } else { + } else if (view instanceof TabView) { + final Tab tab = ((TabView) view).mTab; int ix = mTabs.getChildIndex(view); if (ix >= 0) { mTabs.setSelectedTab(ix); - mUiController.switchToTab(ix); + mUiController.switchToTab(tab); } } } @@ -601,7 +602,7 @@ public class TabBar extends LinearLayout // TabChangeListener implementation public void onSetActiveTab(Tab tab) { - mTabs.setSelectedTab(mTabControl.getTabIndex(tab)); + mTabs.setSelectedTab(mTabControl.getTabPosition(tab)); TabView tv = mTabMap.get(tab); if (tv != null) { tv.setProgress(tv.mTab.getLoadProgress()); |