Add support for setting action mode titles/subtitles by resource ID
Change-Id: Ia0d5234cc16f325eeb29127fb87e2616d67379ec
This commit is contained in:
@@ -177071,6 +177071,19 @@
|
||||
<parameter name="subtitle" type="java.lang.CharSequence">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setSubtitle"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="resId" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setTitle"
|
||||
return="void"
|
||||
abstract="true"
|
||||
@@ -177084,6 +177097,19 @@
|
||||
<parameter name="title" type="java.lang.CharSequence">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setTitle"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="resId" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
</class>
|
||||
<interface name="ActionMode.Callback"
|
||||
abstract="true"
|
||||
|
||||
@@ -29,20 +29,44 @@ public abstract class ActionMode {
|
||||
*
|
||||
* @param title Title string to set
|
||||
*
|
||||
* @see #setTitle(int)
|
||||
* @see #setCustomView(View)
|
||||
*/
|
||||
public abstract void setTitle(CharSequence title);
|
||||
|
||||
/**
|
||||
* Set the title of the action mode. This method will have no visible effect if
|
||||
* a custom view has been set.
|
||||
*
|
||||
* @param resId Resource ID of a string to set as the title
|
||||
*
|
||||
* @see #setTitle(CharSequence)
|
||||
* @see #setCustomView(View)
|
||||
*/
|
||||
public abstract void setTitle(int resId);
|
||||
|
||||
/**
|
||||
* Set the subtitle of the action mode. This method will have no visible effect if
|
||||
* a custom view has been set.
|
||||
*
|
||||
* @param subtitle Subtitle string to set
|
||||
*
|
||||
* @see #setSubtitle(int)
|
||||
* @see #setCustomView(View)
|
||||
*/
|
||||
public abstract void setSubtitle(CharSequence subtitle);
|
||||
|
||||
/**
|
||||
* Set the subtitle of the action mode. This method will have no visible effect if
|
||||
* a custom view has been set.
|
||||
*
|
||||
* @param resId Resource ID of a string to set as the subtitle
|
||||
*
|
||||
* @see #setSubtitle(CharSequence)
|
||||
* @see #setCustomView(View)
|
||||
*/
|
||||
public abstract void setSubtitle(int resId);
|
||||
|
||||
/**
|
||||
* Set a custom view for this action mode. The custom view will take the place of
|
||||
* the title and subtitle. Useful for things like search boxes.
|
||||
|
||||
@@ -421,6 +421,16 @@ public class ActionBarImpl extends ActionBar {
|
||||
mUpperContextView.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(int resId) {
|
||||
setTitle(mActivity.getString(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubtitle(int resId) {
|
||||
setSubtitle(mActivity.getString(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle() {
|
||||
return mUpperContextView.getTitle();
|
||||
|
||||
@@ -57,6 +57,16 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
|
||||
mContextView.setSubtitle(subtitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(int resId) {
|
||||
setTitle(mContext.getString(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubtitle(int resId) {
|
||||
setSubtitle(mContext.getString(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomView(View view) {
|
||||
mContextView.setCustomView(view);
|
||||
|
||||
Reference in New Issue
Block a user