Bug 697122 - Show only a label on AwesomeBar's tab indicators (r=mfinkle)

This commit is contained in:
Lucas Rocha 2011-10-31 16:42:56 +00:00
parent e0d04795c9
commit 0d4cb003be
12 changed files with 68 additions and 3 deletions

View File

@ -423,9 +423,14 @@ public class AwesomeBarTabs extends TabHost {
private TabSpec addAwesomeTab(String id, int titleId, int contentId) {
TabSpec tab = newTabSpec(id);
Resources resources = mContext.getResources();
tab.setIndicator(resources.getString(titleId));
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View indicatorView = inflater.inflate(R.layout.awesomebar_tab_indicator, null);
TextView title = (TextView) indicatorView.findViewById(R.id.title);
title.setText(titleId);
tab.setIndicator(indicatorView);
tab.setContent(contentId);
addTab(tab);

View File

@ -135,6 +135,7 @@ RES_LAYOUT = \
res/layout/awesomebar_header_row.xml \
res/layout/awesomebar_row.xml \
res/layout/awesomebar_search.xml \
res/layout/awesomebar_tab_indicator.xml \
res/layout/awesomebar_tabs.xml \
res/layout/browser_toolbar.xml \
res/layout/doorhangerpopup.xml \
@ -177,6 +178,14 @@ endif
MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/addons.png \
embedding/android/resources/drawable/address_bar_bg.xml \
embedding/android/resources/drawable/awesomebar_tab_focus.9.png \
embedding/android/resources/drawable/awesomebar_tab_focus_selected.9.png \
embedding/android/resources/drawable/awesomebar_tab_indicator.xml \
embedding/android/resources/drawable/awesomebar_tab_press.9.png \
embedding/android/resources/drawable/awesomebar_tab_press_selected.9.png \
embedding/android/resources/drawable/awesomebar_tab_selected.9.png \
embedding/android/resources/drawable/awesomebar_tab_separator.9.png \
embedding/android/resources/drawable/awesomebar_tab_unselected.9.png \
embedding/android/resources/drawable/bookmark_add.png \
embedding/android/resources/drawable/bookmark_remove.png \
embedding/android/resources/drawable/desktop_notification.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/awesomebar_tab_unselected"/>
<item android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/awesomebar_tab_selected"/>
<!-- Focused states -->
<item android:state_focused="true"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/awesomebar_tab_focus"/>
<item android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/awesomebar_tab_focus_selected"/>
<!-- Pressed -->
<item android:state_pressed="true"
android:state_selected="false"
android:drawable="@drawable/awesomebar_tab_press"/>
<item android:state_pressed="true"
android:state_selected="true"
android:drawable="@drawable/awesomebar_tab_press_selected"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10sp"
android:gravity="center"
android:background="@drawable/awesomebar_tab_indicator">
<TextView android:id="@+id/title"
style="?android:attr/tabWidgetStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

View File

@ -7,7 +7,9 @@
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:background="#3f3f3f"
android:divider="@drawable/awesomebar_tab_separator"/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"