Bug 1060345: Create a way of dynamically inflating the correct tab layout (r=lucasr)

This commit is contained in:
Martyn Haigh 2014-09-05 16:52:44 +01:00
parent 1588fe4cbe
commit c5c80e62bc
5 changed files with 29 additions and 20 deletions

View File

@ -237,6 +237,8 @@ public class BrowserApp extends GeckoApp
final View view;
if (BrowserToolbar.class.getName().equals(name)) {
view = BrowserToolbar.create(context, attrs);
} else if (TabsPanel.TabsLayout.class.getName().equals(name)) {
view = TabsPanel.createTabsLayout(context, attrs);
} else {
view = super.onCreateView(name, context, attrs);
}

View File

@ -32,13 +32,14 @@
android:layout_height="0dip"
android:layout_weight="1.0">
<org.mozilla.gecko.tabs.TabsListLayout android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.tabs.PrivateTabsPanel
android:id="@+id/private_tabs_panel"

View File

@ -47,11 +47,12 @@
<!-- Note: for an unknown reason, scrolling in the TabsListLayout
does not work unless it is laid out after the empty view. -->
<org.mozilla.gecko.tabs.TabsListLayout android:id="@+id/private_tabs_tray"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
gecko:tabs="tabs_private"/>
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
android:id="@+id/private_tabs_tray"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
gecko:tabs="tabs_private"/>
</merge>

View File

@ -31,13 +31,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mozilla.gecko.tabs.TabsListLayout android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<view class="org.mozilla.gecko.tabs.TabsPanel$TabsLayout"
android:id="@+id/normal_tabs"
style="@style/TabsList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:visibility="gone"
gecko:tabs="tabs_normal"/>
<org.mozilla.gecko.tabs.PrivateTabsPanel
android:id="@+id/private_tabs_panel"

View File

@ -65,6 +65,10 @@ public class TabsPanel extends LinearLayout
public void setEmptyView(View view);
}
public static View createTabsLayout(final Context context, final AttributeSet attrs) {
return new TabsListLayout(context, attrs);
}
public static interface TabsLayoutChangeListener {
public void onTabsLayoutChange(int width, int height);
}