Bug 1444549 - Remove unused IconTabWidget XML attr. r=mcomella, a=RyanVM FENNEC_59_0_2_BUILD1 FENNEC_59_0_2_RELEASE FIREFOX_59_0_2_BUILD1 FIREFOX_59_0_2_RELEASE
authorVlad Baicu <vlad.baicu@softvision.ro>
Thu, 22 Mar 2018 13:46:41 -0700
changeset 455152 239e434d6d2b8e1e2b697c3416d1e96d48fe98e5
parent 455151 a4854aa5357768752538e132463bf7a157256546
child 455153 ebd585545b53241a489bbe5171eecb119f3fe1b0
push id1678
push userryanvm@gmail.com
push dateFri, 23 Mar 2018 15:49:52 +0000
treeherdermozilla-release@239e434d6d2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella, RyanVM
bugs1444549
milestone59.0.2
Bug 1444549 - Remove unused IconTabWidget XML attr. r=mcomella, a=RyanVM This code was crashing in the framework; removing it should hopefully fix the crash. MozReview-Commit-ID: 2G3q4JrJ9tP
mobile/android/app/src/main/res/values/attrs.xml
mobile/android/base/java/org/mozilla/gecko/widget/IconTabWidget.java
--- a/mobile/android/app/src/main/res/values/attrs.xml
+++ b/mobile/android/app/src/main/res/values/attrs.xml
@@ -121,22 +121,16 @@
     <declare-styleable name="FadedMultiColorTextView">
         <!-- The background color we should be fading over. Useful because the
              background is full alpha and we need to copy the background underneath. -->
         <attr name="fadeBackgroundColor" format="dimension"/>
     </declare-styleable>
 
     <declare-styleable name="IconTabWidget">
         <attr name="android:layout"/>
-
-        <!-- Sets the tab's content type. Defaults to icon. -->
-        <attr name="display">
-            <enum name="icon" value="0x00" />
-            <enum name="text" value="0x01" />
-        </attr>
     </declare-styleable>
 
     <declare-styleable name="TopSitesGridView">
         <attr name="android:horizontalSpacing"/>
         <attr name="android:verticalSpacing"/>
     </declare-styleable>
 
     <declare-styleable name="TabMenuStrip">
--- a/mobile/android/base/java/org/mozilla/gecko/widget/IconTabWidget.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/IconTabWidget.java
@@ -14,43 +14,38 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageButton;
 import android.widget.TabWidget;
 import android.widget.TextView;
 
 public class IconTabWidget extends TabWidget {
     OnTabChangedListener mListener;
     private final int mButtonLayoutId;
-    private final 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);
         mButtonLayoutId = a.getResourceId(R.styleable.IconTabWidget_android_layout, 0);
-        mIsIcon = (a.getInt(R.styleable.IconTabWidget_display, 0x00) == 0x00);
         a.recycle();
 
         if (mButtonLayoutId == 0) {
             throw new RuntimeException("You must supply layout attribute");
         }
     }
 
     public View addTab(final int imageResId, final int stringResId) {
         View button = LayoutInflater.from(getContext()).inflate(mButtonLayoutId, this, false);
-        if (mIsIcon) {
-            ((ImageButton) button).setImageResource(imageResId);
-            button.setContentDescription(getContext().getString(stringResId));
-        } else {
-            ((TextView) button).setText(getContext().getString(stringResId));
-        }
+
+        ((ImageButton) button).setImageResource(imageResId);
+        button.setContentDescription(getContext().getString(stringResId));
 
         addView(button);
         button.setOnClickListener(new TabClickListener(getTabCount() - 1));
         button.setOnFocusChangeListener(this);
         return button;
     }
 
     public void setTabSelectionListener(OnTabChangedListener listener) {
@@ -72,38 +67,33 @@ public class IconTabWidget extends TabWi
         public void onClick(View view) {
             if (mListener != null)
                 mListener.onTabChanged(mIndex);
         }
     }
 
     /**
      * Fetch the Drawable icon corresponding to the given panel.
+     *
      * @param panel to fetch icon for.
      * @return Drawable instance, or null if no icon is being displayed, or the icon does not exist.
      */
     public Drawable getIconDrawable(int index) {
-        if (!mIsIcon) {
-            return null;
-        }
         // We can have multiple views in the tabs panel for each child. This finds the
         // first view corresponding to the given tab. This varies by Android
         // version. The first view should always be our ImageButton, but let's
         // be safe.
         final View view = getChildTabViewAt(index);
         if (view instanceof ImageButton) {
             return ((ImageButton) view).getDrawable();
         }
         return null;
     }
 
     public void setIconDrawable(int index, int resource) {
-        if (!mIsIcon) {
-            return;
-        }
         // We can have multiple views in the tabs panel for each child. This finds the
         // first view corresponding to the given tab. This varies by Android
         // version. The first view should always be our ImageButton, but let's
         // be safe.
         final View view = getChildTabViewAt(index);
         if (view instanceof ImageButton) {
             ((ImageButton) view).setImageResource(resource);
         }