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
--- 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);