Bug 1357778 - Exclude non browsing tabs in the TabStripView, too. r?walkingice draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 26 May 2017 20:15:27 +0200
changeset 585241 f14686f56a6b06c1eefe53b79cfeecc007082166
parent 584573 dc33cf1148f660a4389cad857f2fee531b1213b7
child 630686 be987f298df4be8c8560abbdee0c57dde0145228
push id61069
push usermozilla@buttercookie.de
push dateFri, 26 May 2017 18:18:20 +0000
reviewerswalkingice
bugs1357778
milestone55.0a1
Bug 1357778 - Exclude non browsing tabs in the TabStripView, too. r?walkingice We're already doing this in the tab strip, but this presumably didn't cover the initialisation via TabStripView.refreshTabs(). MozReview-Commit-ID: Abdk1mD5HyZ
mobile/android/base/java/org/mozilla/gecko/tabs/TabStripView.java
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripView.java
@@ -26,32 +26,37 @@ import android.support.v7.widget.helper.
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewTreeObserver;
 import android.view.animation.DecelerateInterpolator;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.mozilla.gecko.Tab.TabType;
+
 public class TabStripView extends RecyclerView
                           implements TabsTouchHelperCallback.DragListener {
     private static final int ANIM_TIME_MS = 200;
     private static final DecelerateInterpolator ANIM_INTERPOLATOR = new DecelerateInterpolator();
 
     private final TabStripAdapter adapter;
+    private final TabType type;
     private boolean isPrivate;
 
     private final TabAnimatorListener animatorListener;
 
     private final Paint fadingEdgePaint;
     private final int fadingEdgeSize;
 
     public TabStripView(Context context, AttributeSet attrs) {
         super(context, attrs);
 
+        type = TabType.BROWSING;
+
         fadingEdgePaint = new Paint();
         final Resources resources = getResources();
         fadingEdgeSize =
                 resources.getDimensionPixelOffset(R.dimen.tablet_tab_strip_fading_edge_size);
 
         animatorListener = new TabAnimatorListener();
 
         setChildrenDrawingOrderEnabled(true);
@@ -75,17 +80,17 @@ public class TabStripView extends Recycl
     }
 
     /* package */ void refreshTabs() {
         // Store a different copy of the tabs, so that we don't have
         // to worry about accidentally updating it on the wrong thread.
         final List<Tab> tabs = new ArrayList<>();
 
         for (final Tab tab : Tabs.getInstance().getTabsInOrder()) {
-            if (tab.isPrivate() == isPrivate) {
+            if (tab.isPrivate() == isPrivate && tab.getType() == type) {
                 tabs.add(tab);
             }
         }
 
         adapter.refresh(tabs);
         updateSelectedPosition();
     }
 
@@ -94,17 +99,17 @@ public class TabStripView extends Recycl
     }
 
     /* package */ void restoreTabs() {
         refreshTabs();
         animateRestoredTabs();
     }
 
     /* package */ void addTab(Tab tab, int position) {
-        if (tab.isPrivate() != isPrivate) {
+        if (tab.isPrivate() != isPrivate || tab.getType() != type) {
             return;
         }
 
         adapter.addTab(tab, position);
     }
 
     /* package */ void removeTab(Tab tab) {
         adapter.removeTab(tab);