Bug 874014: Revert back to icon based TabsPanel headers. [r=margaret]
authorSriram Ramasubramanian <sriram@mozilla.com>
Thu, 20 Jun 2013 16:52:02 -0700
changeset 147421 65f68cc061ec7372d5b5ebffe2d0e006ac0f35bd
parent 147420 03fcdac57879d4b98125e461a942475ab5689a55
child 147422 16ddd7268abc50388dbfe2860c815d73ecff4fa7
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs874014
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 874014: Revert back to icon based TabsPanel headers. [r=margaret]
mobile/android/base/TabsPanel.java
mobile/android/base/resources/layout-large-land-v11/tabs_panel_header.xml
mobile/android/base/resources/layout/tabs_panel_indicator.xml
mobile/android/base/resources/values/attrs.xml
mobile/android/base/widget/IconTabWidget.java
--- a/mobile/android/base/TabsPanel.java
+++ b/mobile/android/base/TabsPanel.java
@@ -100,24 +100,29 @@ public class TabsPanel extends LinearLay
         mAddTab = (ImageButton) findViewById(R.id.add_tab);
         mAddTab.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View v) {
                 TabsPanel.this.addTab();
             }
         });
 
-        Button button;
+        ImageButton button;
         Resources resources = getContext().getResources();
 
         mTabWidget = (IconTabWidget) findViewById(R.id.tab_widget);
 
-        button = mTabWidget.addTab(R.drawable.tabs_normal, R.string.tabs_normal);
-        button = mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
-        button = mTabWidget.addTab(R.drawable.tabs_synced, R.string.tabs_synced);
+        button = mTabWidget.addTab(R.drawable.tabs_normal);
+        button.setContentDescription(resources.getString(R.string.tabs_normal));
+
+        button = mTabWidget.addTab(R.drawable.tabs_private);
+        button.setContentDescription(resources.getString(R.string.tabs_private));
+
+        button = mTabWidget.addTab(R.drawable.tabs_synced);
+        button.setContentDescription(resources.getString(R.string.tabs_synced));
 
         mTabWidget.setTabSelectionListener(this);
     }
 
     public void addTab() {
         if (mCurrentPanel == Panel.NORMAL_TABS)
            mActivity.addTab();
         else
--- a/mobile/android/base/resources/layout-large-land-v11/tabs_panel_header.xml
+++ b/mobile/android/base/resources/layout-large-land-v11/tabs_panel_header.xml
@@ -1,16 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:gecko="http://schemas.android.com/apk/res-auto">
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <Gecko.IconTabWidget android:id="@+id/tab_widget"
                          android:layout_width="wrap_content"
                          android:layout_height="fill_parent"
                          android:tabStripEnabled="false"
-                         android:divider="@drawable/tab_indicator_divider"
-                         gecko:display="icon"/>
+                         android:divider="@drawable/tab_indicator_divider"/>
 
 </merge>
--- a/mobile/android/base/resources/layout/tabs_panel_indicator.xml
+++ b/mobile/android/base/resources/layout/tabs_panel_indicator.xml
@@ -1,14 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<Button xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="@dimen/browser_toolbar_height"
-        android:minWidth="@dimen/tabs_panel_indicator_width"
-        android:padding="@dimen/browser_toolbar_button_padding"
-        android:background="@drawable/tabs_panel_indicator"
-        android:textAppearance="@style/TextAppearance.Micro"
-        android:textColor="#99FFFFFF"
-        android:textStyle="bold"/>
+<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
+             android:layout_width="@dimen/tabs_panel_indicator_width"
+             android:layout_height="@dimen/browser_toolbar_height"
+             android:minWidth="@dimen/tabs_panel_indicator_width"
+             android:paddingTop="@dimen/browser_toolbar_button_padding"
+             android:paddingBottom="@dimen/browser_toolbar_button_padding"
+             android:background="@drawable/tabs_panel_indicator"/>
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -166,21 +166,14 @@
         <attr name="android:orientation"/>
 
         <!-- Imported from AbsListView -->
         <attr name="android:choiceMode"/>
         <attr name="android:drawSelectorOnTop"/>
         <attr name="android:listSelector"/>
     </declare-styleable>
 
-    <declare-styleable name="IconTabWidget">
-        <attr name="display">
-            <flag name="text" value="0x00" />
-            <flag name="icon" value="0x01" />
-        </attr>
-    </declare-styleable>
-
     <declare-styleable name="GeckoView">
         <attr name="url" format="string"/>
     </declare-styleable>
 
 </resources>
 
--- a/mobile/android/base/widget/IconTabWidget.java
+++ b/mobile/android/base/widget/IconTabWidget.java
@@ -2,49 +2,36 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.widget;
 
 import org.mozilla.gecko.R;
 
 import android.content.Context;
-import android.content.res.TypedArray;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.widget.Button;
+import android.widget.ImageButton;
 import android.widget.TabWidget;
 
 public class IconTabWidget extends TabWidget {
     private OnTabChangedListener mListener;
-    private boolean mIsIcon;
 
     public static interface OnTabChangedListener {
         public void onTabChanged(int tabIndex);
     }
 
     public IconTabWidget(Context context, AttributeSet attrs) {
         super(context, attrs);
-
-        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconTabWidget);
-        int type = a.getInt(R.styleable.IconTabWidget_display, 0x00);
-        a.recycle();
-
-        mIsIcon = (type == 0x01);
     }
 
-    public Button addTab(int imageResId, int stringResId) {
-        Button button = (Button) LayoutInflater.from(getContext()).inflate(R.layout.tabs_panel_indicator, null);
-        if (mIsIcon) {
-            button.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
-            button.setContentDescription(getContext().getString(stringResId));
-        } else {
-            button.setText(getContext().getString(stringResId).toUpperCase());
-        }
+    public ImageButton addTab(int resId) {
+        ImageButton button = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.tabs_panel_indicator, null);
+        button.setImageResource(resId);
 
         addView(button);
         button.setOnClickListener(new TabClickListener(getTabCount() - 1));
         button.setOnFocusChangeListener(this);
         return button;
     }
 
     public void setTabSelectionListener(OnTabChangedListener listener) {