From 56d3538ac3f2191b969022e66931be8a8b62a6dd Mon Sep 17 00:00:00 2001 From: Martyn Haigh Date: Wed, 27 Aug 2014 16:17:59 +0100 Subject: [PATCH] Bug 1046209 - Part 2: Extract TabsLayout interface (r=lucasr) --- mobile/android/base/tabs/PrivateTabsPanel.java | 17 +++++++++-------- mobile/android/base/tabs/TabsListLayout.java | 5 +++-- mobile/android/base/tabs/TabsPanel.java | 4 ++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/mobile/android/base/tabs/PrivateTabsPanel.java b/mobile/android/base/tabs/PrivateTabsPanel.java index 353824747f4..5d0629ecdfd 100644 --- a/mobile/android/base/tabs/PrivateTabsPanel.java +++ b/mobile/android/base/tabs/PrivateTabsPanel.java @@ -11,6 +11,7 @@ import org.mozilla.gecko.BrowserLocaleManager; import org.mozilla.gecko.R; import org.mozilla.gecko.Tabs; import org.mozilla.gecko.tabs.TabsPanel.CloseAllPanelView; +import org.mozilla.gecko.tabs.TabsPanel.TabsLayout; import android.content.Context; import android.util.AttributeSet; @@ -26,16 +27,16 @@ import android.widget.FrameLayout; */ class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView { private TabsPanel tabsPanel; - private TabsListLayout tabsTray; + private TabsLayout tabsLayout; public PrivateTabsPanel(Context context, AttributeSet attrs) { super(context, attrs); LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this); - tabsTray = (TabsListLayout) findViewById(R.id.private_tabs_tray); + tabsLayout = (TabsLayout) findViewById(R.id.private_tabs_tray); final View emptyView = findViewById(R.id.private_tabs_empty); - tabsTray.setEmptyView(emptyView); + tabsLayout.setEmptyView(emptyView); final View learnMore = findViewById(R.id.private_tabs_learn_more); learnMore.setOnClickListener(new OnClickListener() { @@ -55,28 +56,28 @@ class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView { @Override public void setTabsPanel(TabsPanel panel) { tabsPanel = panel; - tabsTray.setTabsPanel(panel); + tabsLayout.setTabsPanel(panel); } @Override public void show() { - tabsTray.show(); + tabsLayout.show(); setVisibility(View.VISIBLE); } @Override public void hide() { setVisibility(View.GONE); - tabsTray.hide(); + tabsLayout.hide(); } @Override public boolean shouldExpand() { - return tabsTray.shouldExpand(); + return tabsLayout.shouldExpand(); } @Override public void closeAll() { - tabsTray.closeAll(); + tabsLayout.closeAll(); } } diff --git a/mobile/android/base/tabs/TabsListLayout.java b/mobile/android/base/tabs/TabsListLayout.java index 62ca780a6bc..8b0b8ce4288 100644 --- a/mobile/android/base/tabs/TabsListLayout.java +++ b/mobile/android/base/tabs/TabsListLayout.java @@ -14,6 +14,7 @@ import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.R; import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tabs; +import org.mozilla.gecko.tabs.TabsPanel.TabsLayout; import org.mozilla.gecko.animation.PropertyAnimator; import org.mozilla.gecko.animation.PropertyAnimator.Property; import org.mozilla.gecko.animation.ViewHelper; @@ -38,8 +39,8 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; -class TabsListLayout extends TwoWayView implements - TabsPanel.CloseAllPanelView { +class TabsListLayout extends TwoWayView + implements TabsLayout { private static final String LOGTAG = "Gecko" + TabsListLayout.class.getSimpleName(); private Context mContext; diff --git a/mobile/android/base/tabs/TabsPanel.java b/mobile/android/base/tabs/TabsPanel.java index 0d20309cf70..689257a2aad 100644 --- a/mobile/android/base/tabs/TabsPanel.java +++ b/mobile/android/base/tabs/TabsPanel.java @@ -61,6 +61,10 @@ public class TabsPanel extends LinearLayout public void closeAll(); } + public static interface TabsLayout extends CloseAllPanelView { + public void setEmptyView(View view); + } + public static interface TabsLayoutChangeListener { public void onTabsLayoutChange(int width, int height); }