mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046209 - Part 2: Extract TabsLayout interface (r=lucasr)
This commit is contained in:
parent
e04d34ef33
commit
56d3538ac3
@ -11,6 +11,7 @@ import org.mozilla.gecko.BrowserLocaleManager;
|
|||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.Tabs;
|
import org.mozilla.gecko.Tabs;
|
||||||
import org.mozilla.gecko.tabs.TabsPanel.CloseAllPanelView;
|
import org.mozilla.gecko.tabs.TabsPanel.CloseAllPanelView;
|
||||||
|
import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@ -26,16 +27,16 @@ import android.widget.FrameLayout;
|
|||||||
*/
|
*/
|
||||||
class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView {
|
class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView {
|
||||||
private TabsPanel tabsPanel;
|
private TabsPanel tabsPanel;
|
||||||
private TabsListLayout tabsTray;
|
private TabsLayout tabsLayout;
|
||||||
|
|
||||||
public PrivateTabsPanel(Context context, AttributeSet attrs) {
|
public PrivateTabsPanel(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this);
|
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);
|
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);
|
final View learnMore = findViewById(R.id.private_tabs_learn_more);
|
||||||
learnMore.setOnClickListener(new OnClickListener() {
|
learnMore.setOnClickListener(new OnClickListener() {
|
||||||
@ -55,28 +56,28 @@ class PrivateTabsPanel extends FrameLayout implements CloseAllPanelView {
|
|||||||
@Override
|
@Override
|
||||||
public void setTabsPanel(TabsPanel panel) {
|
public void setTabsPanel(TabsPanel panel) {
|
||||||
tabsPanel = panel;
|
tabsPanel = panel;
|
||||||
tabsTray.setTabsPanel(panel);
|
tabsLayout.setTabsPanel(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
tabsTray.show();
|
tabsLayout.show();
|
||||||
setVisibility(View.VISIBLE);
|
setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hide() {
|
public void hide() {
|
||||||
setVisibility(View.GONE);
|
setVisibility(View.GONE);
|
||||||
tabsTray.hide();
|
tabsLayout.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldExpand() {
|
public boolean shouldExpand() {
|
||||||
return tabsTray.shouldExpand();
|
return tabsLayout.shouldExpand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeAll() {
|
public void closeAll() {
|
||||||
tabsTray.closeAll();
|
tabsLayout.closeAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import org.mozilla.gecko.GeckoEvent;
|
|||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.Tab;
|
import org.mozilla.gecko.Tab;
|
||||||
import org.mozilla.gecko.Tabs;
|
import org.mozilla.gecko.Tabs;
|
||||||
|
import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
|
||||||
import org.mozilla.gecko.animation.PropertyAnimator;
|
import org.mozilla.gecko.animation.PropertyAnimator;
|
||||||
import org.mozilla.gecko.animation.PropertyAnimator.Property;
|
import org.mozilla.gecko.animation.PropertyAnimator.Property;
|
||||||
import org.mozilla.gecko.animation.ViewHelper;
|
import org.mozilla.gecko.animation.ViewHelper;
|
||||||
@ -38,8 +39,8 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
class TabsListLayout extends TwoWayView implements
|
class TabsListLayout extends TwoWayView
|
||||||
TabsPanel.CloseAllPanelView {
|
implements TabsLayout {
|
||||||
private static final String LOGTAG = "Gecko" + TabsListLayout.class.getSimpleName();
|
private static final String LOGTAG = "Gecko" + TabsListLayout.class.getSimpleName();
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
@ -61,6 +61,10 @@ public class TabsPanel extends LinearLayout
|
|||||||
public void closeAll();
|
public void closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface TabsLayout extends CloseAllPanelView {
|
||||||
|
public void setEmptyView(View view);
|
||||||
|
}
|
||||||
|
|
||||||
public static interface TabsLayoutChangeListener {
|
public static interface TabsLayoutChangeListener {
|
||||||
public void onTabsLayoutChange(int width, int height);
|
public void onTabsLayoutChange(int width, int height);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user