Bug 834399 - Tab sidebar should switch views to show newly selected tab [r=sriram]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 29 Jan 2013 10:58:09 -0800
changeset 120256 2313ce68cff0a616d76029124a19846abc55209e
parent 120255 e881841cd418134d0fd640ed28a875b66d23ff0f
child 120257 c6e0a815401ac48b9d22cf58a5ad586f4372faaa
push id22114
push usermbrubeck@mozilla.com
push dateTue, 29 Jan 2013 19:03:31 +0000
treeherdermozilla-inbound@2313ce68cff0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs834399
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 834399 - Tab sidebar should switch views to show newly selected tab [r=sriram]
mobile/android/base/BrowserApp.java
mobile/android/base/TabsPanel.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -96,16 +96,27 @@ abstract public class BrowserApp extends
                 }
                 // fall through
             case SELECTED:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
                     if ("about:home".equals(tab.getURL()))
                         showAboutHome();
                     else
                         hideAboutHome();
+
+                    final TabsPanel.Panel panel = tab.isPrivate()
+                                                ? TabsPanel.Panel.PRIVATE_TABS
+                                                : TabsPanel.Panel.NORMAL_TABS;
+                    if (areTabsShown() && mTabsPanel.getCurrentPanel() != panel) {
+                        mMainHandler.post(new Runnable() {
+                            public void run() {
+                                showTabs(panel);
+                            }
+                        });
+                    }
                 }
                 break;
             case LOAD_ERROR:
             case START:
             case STOP:
             case MENU_UPDATED:
                 if (Tabs.getInstance().isSelectedTab(tab)) {
                     invalidateOptionsMenu();
--- a/mobile/android/base/TabsPanel.java
+++ b/mobile/android/base/TabsPanel.java
@@ -223,17 +223,17 @@ public class TabsPanel extends LinearLay
 
             case R.id.new_tab:
             case R.id.new_private_tab:
                 hide();
             // fall through
             default:
                 return mActivity.onOptionsItemSelected(item);
         }
-    }  
+    }
 
     private static int getTabContainerHeight(View view) {
         Context context = view.getContext();
 
         int actionBarHeight = context.getResources().getDimensionPixelSize(R.dimen.browser_toolbar_height);
         int screenHeight = context.getResources().getDisplayMetrics().heightPixels;
 
         Rect windowRect = new Rect();
@@ -431,16 +431,20 @@ public class TabsPanel extends LinearLay
     public boolean isShown() {
         return mVisible;
     }
 
     public boolean isSideBar() {
         return mIsSideBar;
     }
 
+    public Panel getCurrentPanel() {
+        return mCurrentPanel;
+    }
+
     public void setTabsLayoutChangeListener(TabsLayoutChangeListener listener) {
         mLayoutChangeListener = listener;
     }
 
     private void dispatchLayoutChange(int width, int height) {
         if (mLayoutChangeListener != null)
             mLayoutChangeListener.onTabsLayoutChange(width, height);
     }