Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32555f34 authored by Adam Powell's avatar Adam Powell
Browse files

Add resource ID variants of ActionBar tab setters

Bugs 3204153 and 2901235

Change-Id: Ib430f96da77f8e7647b22d190243a2fcd766d842
parent d348bb4f
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -20395,6 +20395,19 @@
<parameter name="view" type="android.view.View">
</parameter>
</method>
<method name="setCustomView"
 return="android.app.ActionBar.Tab"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="layoutResId" type="int">
</parameter>
</method>
<method name="setIcon"
 return="android.app.ActionBar.Tab"
 abstract="true"
@@ -20408,6 +20421,19 @@
<parameter name="icon" type="android.graphics.drawable.Drawable">
</parameter>
</method>
<method name="setIcon"
 return="android.app.ActionBar.Tab"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="resId" type="int">
</parameter>
</method>
<method name="setTabListener"
 return="android.app.ActionBar.Tab"
 abstract="true"
@@ -20447,6 +20473,19 @@
<parameter name="text" type="java.lang.CharSequence">
</parameter>
</method>
<method name="setText"
 return="android.app.ActionBar.Tab"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="resId" type="int">
</parameter>
</method>
<field name="INVALID_POSITION"
 type="int"
 transient="false"
+26 −0
Original line number Diff line number Diff line
@@ -589,6 +589,14 @@ public abstract class ActionBar {
         */
        public abstract Tab setIcon(Drawable icon);

        /**
         * Set the icon displayed on this tab.
         *
         * @param resId Resource ID referring to the drawable to use as an icon
         * @return The current instance for call chaining
         */
        public abstract Tab setIcon(int resId);

        /**
         * Set the text displayed on this tab. Text may be truncated if there is not
         * room to display the entire string.
@@ -598,6 +606,15 @@ public abstract class ActionBar {
         */
        public abstract Tab setText(CharSequence text);

        /**
         * Set the text displayed on this tab. Text may be truncated if there is not
         * room to display the entire string.
         *
         * @param resId A resource ID referring to the text that should be displayed
         * @return The current instance for call chaining
         */
        public abstract Tab setText(int resId);

        /**
         * Set a custom view to be used for this tab. This overrides values set by
         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
@@ -607,6 +624,15 @@ public abstract class ActionBar {
         */
        public abstract Tab setCustomView(View view);

        /**
         * Set a custom view to be used for this tab. This overrides values set by
         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
         *
         * @param layoutResId A layout resource to inflate and use as a custom tab view
         * @return The current instance for call chaining
         */
        public abstract Tab setCustomView(int layoutResId);

        /**
         * Retrieve a previously set custom view for this tab.
         *
+16 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -562,6 +563,11 @@ public class ActionBarImpl extends ActionBar {
            return this;
        }

        @Override
        public Tab setCustomView(int layoutResId) {
            return setCustomView(LayoutInflater.from(mContext).inflate(layoutResId, null));
        }

        @Override
        public Drawable getIcon() {
            return mIcon;
@@ -587,12 +593,22 @@ public class ActionBarImpl extends ActionBar {
            return this;
        }

        @Override
        public Tab setIcon(int resId) {
            return setIcon(mContext.getResources().getDrawable(resId));
        }

        @Override
        public Tab setText(CharSequence text) {
            mText = text;
            return this;
        }

        @Override
        public Tab setText(int resId) {
            return setText(mContext.getResources().getText(resId));
        }

        @Override
        public void select() {
            selectTab(this);