Bug 834399 - Tab sidebar should switch views to show newly selected tab. r=sriram, a=bajaj
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 29 Jan 2013 10:58:09 -0800
changeset 127373 1ae5eca14cfed3e97fe70c7358aed65082d41998
parent 127372 c8641ce92c72edd5a17b74cde60c3f0049daef7e
child 127374 edd364a9f0d5ec40b79cac6da6809795ccab3972
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram, bajaj
bugs834399
milestone20.0a2
Bug 834399 - Tab sidebar should switch views to show newly selected tab. r=sriram, a=bajaj
mobile/android/base/BrowserApp.java
mobile/android/base/TabsPanel.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -98,16 +98,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
@@ -225,17 +225,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();
@@ -433,16 +433,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);
     }