Update the Smartspace UI templates APIs.

- Add the 3rd-line data in BaseTemplateData to support new Android T
  use case;
- Remove the optional constructor from Text for API review comments in
  b/218860086;
- Add SubItemLoggingInfo to support the sub-card logging on the base
  card.

Fixes: 218860086
Test: atest CtsSmartspaceServiceTestCases
Change-Id: I39d7014f4f5b36719f54e191ed5af1fa45429a53
This commit is contained in:
Cecilia
2022-02-16 00:10:48 +00:00
parent 99deef06b1
commit e6a676af11
11 changed files with 576 additions and 65 deletions

View File

@@ -2254,13 +2254,20 @@ package android.app.smartspace.uitemplatedata {
public class BaseTemplateData implements android.os.Parcelable {
method public int describeContents();
method public int getLayoutWeight();
method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getPrimaryLoggingInfo();
method @Nullable public android.app.smartspace.uitemplatedata.TapAction getPrimaryTapAction();
method @Nullable public android.app.smartspace.uitemplatedata.Icon getSubtitleIcon();
method @Nullable public android.app.smartspace.uitemplatedata.Text getSubtitleText();
method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalAlarmText();
method @Nullable public android.app.smartspace.uitemplatedata.Icon getSupplementalIcon();
method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getSupplementalLoggingInfo();
method @Nullable public android.app.smartspace.uitemplatedata.Icon getSupplementalSubtitleIcon();
method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getSupplementalSubtitleLoggingInfo();
method @Nullable public android.app.smartspace.uitemplatedata.TapAction getSupplementalSubtitleTapAction();
method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalSubtitleText();
method @Nullable public android.app.smartspace.uitemplatedata.TapAction getSupplementalTapAction();
method @Nullable public android.app.smartspace.uitemplatedata.Text getSupplementalText();
method public int getTemplateType();
method @Nullable public android.app.smartspace.uitemplatedata.Icon getTitleIcon();
method @Nullable public android.app.smartspace.uitemplatedata.Text getTitleText();
@@ -2271,17 +2278,37 @@ package android.app.smartspace.uitemplatedata {
public static class BaseTemplateData.Builder {
ctor public BaseTemplateData.Builder(int);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData build();
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setLayoutWeight(int);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setPrimaryLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setPrimaryTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalAlarmText(@NonNull android.app.smartspace.uitemplatedata.Text);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalSubtitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalText(@NonNull android.app.smartspace.uitemplatedata.Text);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setTitleIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setTitleText(@NonNull android.app.smartspace.uitemplatedata.Text);
}
public static final class BaseTemplateData.SubItemLoggingInfo implements android.os.Parcelable {
method public int describeContents();
method public int getFeatureType();
method public int getInstanceId();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo> CREATOR;
}
public static final class BaseTemplateData.SubItemLoggingInfo.Builder {
ctor public BaseTemplateData.SubItemLoggingInfo.Builder(int, int);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo build();
}
public final class CarouselTemplateData extends android.app.smartspace.uitemplatedata.BaseTemplateData {
method @Nullable public android.app.smartspace.uitemplatedata.TapAction getCarouselAction();
method @NonNull public java.util.List<android.app.smartspace.uitemplatedata.CarouselTemplateData.CarouselItem> getCarouselItems();
@@ -2408,6 +2435,7 @@ package android.app.smartspace.uitemplatedata {
method @Nullable public android.content.Intent getIntent();
method @Nullable public android.app.PendingIntent getPendingIntent();
method @Nullable public android.os.UserHandle getUserHandle();
method public boolean shouldShowOnLockscreen();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.TapAction> CREATOR;
}
@@ -2418,6 +2446,7 @@ package android.app.smartspace.uitemplatedata {
method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setExtras(@NonNull android.os.Bundle);
method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setIntent(@NonNull android.content.Intent);
method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setPendingIntent(@NonNull android.app.PendingIntent);
method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setShouldShowOnLockscreen(@NonNull boolean);
method @NonNull public android.app.smartspace.uitemplatedata.TapAction.Builder setUserHandle(@Nullable android.os.UserHandle);
}
@@ -2432,7 +2461,6 @@ package android.app.smartspace.uitemplatedata {
public static final class Text.Builder {
ctor public Text.Builder(@NonNull CharSequence);
ctor public Text.Builder(@NonNull CharSequence, @NonNull android.text.TextUtils.TruncateAt);
method @NonNull public android.app.smartspace.uitemplatedata.Text build();
method @NonNull public android.app.smartspace.uitemplatedata.Text.Builder setMaxLines(int);
method @NonNull public android.app.smartspace.uitemplatedata.Text.Builder setTruncateAtType(@NonNull android.text.TextUtils.TruncateAt);

View File

@@ -33,6 +33,9 @@ import java.util.Objects;
* <li> title_text (may contain a start drawable) </li>
* <li> subtitle_text (may contain a start drawable) . supplemental_subtitle_text (may
* contain a start drawable) </li>
*
* <li> supplemental_text (contain a start drawable) . do_not_disturb_view </li>
* Or
* <li> next_alarm_text (contain a start drawable) + supplemental_alarm_text .
* do_not_disturb_view </li>
* </ul>
@@ -76,6 +79,14 @@ public class BaseTemplateData implements Parcelable {
@Nullable
private final TapAction mPrimaryTapAction;
/**
* Primary logging info for the entire card. This will only be used when rendering a sub card
* within the base card. For the base card itself, BcSmartspaceCardLoggingInfo should be used,
* which has the display-specific info (e.g. display surface).
*/
@Nullable
private final SubItemLoggingInfo mPrimaryLoggingInfo;
/**
* Supplemental subtitle text and icon are shown at the second row following the subtitle text.
* Mainly used for weather info on non-weather card.
@@ -87,12 +98,34 @@ public class BaseTemplateData implements Parcelable {
private final Icon mSupplementalSubtitleIcon;
/**
* Tap action for the supplemental subtitle's text and icon. Will use the primary tap action if
* Tap action for the supplemental subtitle's text and icon. Uses the primary tap action if
* not being set.
*/
@Nullable
private final TapAction mSupplementalSubtitleTapAction;
/**
* Logging info for the supplemental subtitle's are. Uses the primary logging info if not being
* set.
*/
@Nullable
private final SubItemLoggingInfo mSupplementalSubtitleLoggingInfo;
@Nullable
private final Text mSupplementalText;
@Nullable
private final Icon mSupplementalIcon;
@Nullable
private final TapAction mSupplementalTapAction;
/**
* Logging info for the supplemental line. Uses the primary logging info if not being set.
*/
@Nullable
private final SubItemLoggingInfo mSupplementalLoggingInfo;
/**
* Supplemental alarm text is specifically used for holiday alarm, which is appended to "next
* alarm".
@@ -100,6 +133,12 @@ public class BaseTemplateData implements Parcelable {
@Nullable
private final Text mSupplementalAlarmText;
/**
* The layout weight info for the card, which indicates how much space it should occupy on the
* screen. Default weight is 0.
*/
private final int mLayoutWeight;
BaseTemplateData(@NonNull Parcel in) {
mTemplateType = in.readInt();
mTitleText = in.readTypedObject(Text.CREATOR);
@@ -107,10 +146,17 @@ public class BaseTemplateData implements Parcelable {
mSubtitleText = in.readTypedObject(Text.CREATOR);
mSubtitleIcon = in.readTypedObject(Icon.CREATOR);
mPrimaryTapAction = in.readTypedObject(TapAction.CREATOR);
mPrimaryLoggingInfo = in.readTypedObject(SubItemLoggingInfo.CREATOR);
mSupplementalSubtitleText = in.readTypedObject(Text.CREATOR);
mSupplementalSubtitleIcon = in.readTypedObject(Icon.CREATOR);
mSupplementalSubtitleTapAction = in.readTypedObject(TapAction.CREATOR);
mSupplementalSubtitleLoggingInfo = in.readTypedObject(SubItemLoggingInfo.CREATOR);
mSupplementalText = in.readTypedObject(Text.CREATOR);
mSupplementalIcon = in.readTypedObject(Icon.CREATOR);
mSupplementalTapAction = in.readTypedObject(TapAction.CREATOR);
mSupplementalLoggingInfo = in.readTypedObject(SubItemLoggingInfo.CREATOR);
mSupplementalAlarmText = in.readTypedObject(Text.CREATOR);
mLayoutWeight = in.readInt();
}
/**
@@ -123,20 +169,34 @@ public class BaseTemplateData implements Parcelable {
@Nullable Text subtitleText,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable Text supplementalAlarmText) {
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight) {
mTemplateType = templateType;
mTitleText = titleText;
mTitleIcon = titleIcon;
mSubtitleText = subtitleText;
mSubtitleIcon = subtitleIcon;
mPrimaryTapAction = primaryTapAction;
mPrimaryLoggingInfo = primaryLoggingInfo;
mSupplementalSubtitleText = supplementalSubtitleText;
mSupplementalSubtitleIcon = supplementalSubtitleIcon;
mSupplementalSubtitleTapAction = supplementalSubtitleTapAction;
mSupplementalSubtitleLoggingInfo = supplementalSubtitleLoggingInfo;
mSupplementalText = supplementalText;
mSupplementalIcon = supplementalIcon;
mSupplementalTapAction = supplementalTapAction;
mSupplementalLoggingInfo = supplementalLoggingInfo;
mSupplementalAlarmText = supplementalAlarmText;
mLayoutWeight = layoutWeight;
}
/** Returns the template type. By default is UNDEFINED. */
@@ -175,6 +235,12 @@ public class BaseTemplateData implements Parcelable {
return mPrimaryTapAction;
}
/** Returns the card's primary logging info. */
@Nullable
public SubItemLoggingInfo getPrimaryLoggingInfo() {
return mPrimaryLoggingInfo;
}
/** Returns the supplemental subtitle's text. */
@Nullable
public Text getSupplementalSubtitleText() {
@@ -193,12 +259,47 @@ public class BaseTemplateData implements Parcelable {
return mSupplementalSubtitleTapAction;
}
/** Returns the card's supplemental title's logging info. */
@Nullable
public SubItemLoggingInfo getSupplementalSubtitleLoggingInfo() {
return mSupplementalSubtitleLoggingInfo;
}
/** Returns the supplemental text. */
@Nullable
public Text getSupplementalText() {
return mSupplementalText;
}
/** Returns the supplemental icon. */
@Nullable
public Icon getSupplementalIcon() {
return mSupplementalIcon;
}
/** Returns the supplemental line's tap action. Can be null if not being set. */
@Nullable
public TapAction getSupplementalTapAction() {
return mSupplementalTapAction;
}
/** Returns the card's supplemental line logging info. */
@Nullable
public SubItemLoggingInfo getSupplementalLoggingInfo() {
return mSupplementalLoggingInfo;
}
/** Returns the supplemental alarm text. */
@Nullable
public Text getSupplementalAlarmText() {
return mSupplementalAlarmText;
}
/** Returns the card layout weight info. Default weight is 0. */
public int getLayoutWeight() {
return mLayoutWeight;
}
/**
* @see Parcelable.Creator
*/
@@ -229,10 +330,17 @@ public class BaseTemplateData implements Parcelable {
out.writeTypedObject(mSubtitleText, flags);
out.writeTypedObject(mSubtitleIcon, flags);
out.writeTypedObject(mPrimaryTapAction, flags);
out.writeTypedObject(mPrimaryLoggingInfo, flags);
out.writeTypedObject(mSupplementalSubtitleText, flags);
out.writeTypedObject(mSupplementalSubtitleIcon, flags);
out.writeTypedObject(mSupplementalSubtitleTapAction, flags);
out.writeTypedObject(mSupplementalSubtitleLoggingInfo, flags);
out.writeTypedObject(mSupplementalText, flags);
out.writeTypedObject(mSupplementalIcon, flags);
out.writeTypedObject(mSupplementalTapAction, flags);
out.writeTypedObject(mSupplementalLoggingInfo, flags);
out.writeTypedObject(mSupplementalAlarmText, flags);
out.writeInt(mLayoutWeight);
}
@Override
@@ -246,19 +354,31 @@ public class BaseTemplateData implements Parcelable {
&& SmartspaceUtils.isEqual(mSubtitleText, that.mSubtitleText)
&& Objects.equals(mSubtitleIcon, that.mSubtitleIcon)
&& Objects.equals(mPrimaryTapAction, that.mPrimaryTapAction)
&& Objects.equals(mPrimaryLoggingInfo, that.mPrimaryLoggingInfo)
&& SmartspaceUtils.isEqual(mSupplementalSubtitleText,
that.mSupplementalSubtitleText)
&& Objects.equals(mSupplementalSubtitleIcon, that.mSupplementalSubtitleIcon)
&& Objects.equals(mSupplementalSubtitleTapAction,
that.mSupplementalSubtitleTapAction)
&& SmartspaceUtils.isEqual(mSupplementalAlarmText, that.mSupplementalAlarmText);
&& Objects.equals(mSupplementalSubtitleLoggingInfo,
that.mSupplementalSubtitleLoggingInfo)
&& SmartspaceUtils.isEqual(mSupplementalText,
that.mSupplementalText)
&& Objects.equals(mSupplementalIcon, that.mSupplementalIcon)
&& Objects.equals(mSupplementalTapAction, that.mSupplementalTapAction)
&& Objects.equals(mSupplementalLoggingInfo, that.mSupplementalLoggingInfo)
&& SmartspaceUtils.isEqual(mSupplementalAlarmText, that.mSupplementalAlarmText)
&& mLayoutWeight == that.mLayoutWeight;
}
@Override
public int hashCode() {
return Objects.hash(mTemplateType, mTitleText, mTitleIcon, mSubtitleText, mSubtitleIcon,
mPrimaryTapAction, mSupplementalSubtitleText, mSupplementalSubtitleIcon,
mSupplementalSubtitleTapAction, mSupplementalAlarmText);
mPrimaryTapAction, mPrimaryLoggingInfo, mSupplementalSubtitleText,
mSupplementalSubtitleIcon, mSupplementalSubtitleTapAction,
mSupplementalSubtitleLoggingInfo,
mSupplementalText, mSupplementalIcon, mSupplementalTapAction,
mSupplementalLoggingInfo, mSupplementalAlarmText, mLayoutWeight);
}
@Override
@@ -270,10 +390,17 @@ public class BaseTemplateData implements Parcelable {
+ ", mSubtitleText=" + mSubtitleText
+ ", mSubTitleIcon=" + mSubtitleIcon
+ ", mPrimaryTapAction=" + mPrimaryTapAction
+ ", mPrimaryLoggingInfo=" + mPrimaryLoggingInfo
+ ", mSupplementalSubtitleText=" + mSupplementalSubtitleText
+ ", mSupplementalSubtitleIcon=" + mSupplementalSubtitleIcon
+ ", mSupplementalSubtitleTapAction=" + mSupplementalSubtitleTapAction
+ ", mSupplementalSubtitleLoggingInfo=" + mSupplementalSubtitleLoggingInfo
+ ", mSupplementalText=" + mSupplementalText
+ ", mSupplementalIcon=" + mSupplementalIcon
+ ", mSupplementalTapAction=" + mSupplementalTapAction
+ ", mSupplementalLoggingInfo=" + mSupplementalLoggingInfo
+ ", mSupplementalAlarmText=" + mSupplementalAlarmText
+ ", mLayoutWeight=" + mLayoutWeight
+ '}';
}
@@ -292,18 +419,26 @@ public class BaseTemplateData implements Parcelable {
private Text mSubtitleText;
private Icon mSubtitleIcon;
private TapAction mPrimaryTapAction;
private SubItemLoggingInfo mPrimaryLoggingInfo;
private Text mSupplementalSubtitleText;
private Icon mSupplementalSubtitleIcon;
private TapAction mSupplementalSubtitleTapAction;
private SubItemLoggingInfo mSupplementalSubtitleLoggingInfo;
private Text mSupplementalText;
private Icon mSupplementalIcon;
private TapAction mSupplementalTapAction;
private SubItemLoggingInfo mSupplementalLoggingInfo;
private Text mSupplementalAlarmText;
private int mLayoutWeight;
/**
* A builder for {@link BaseTemplateData}.
* A builder for {@link BaseTemplateData}. By default sets the layout weight to be 0.
*
* @param templateType the {@link UiTemplateType} of this template data.
*/
public Builder(@UiTemplateType int templateType) {
mTemplateType = templateType;
mLayoutWeight = 0;
}
/** Should ONLY be used by the subclasses */
@@ -348,6 +483,13 @@ public class BaseTemplateData implements Parcelable {
return mPrimaryTapAction;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
SubItemLoggingInfo getPrimaryLoggingInfo() {
return mPrimaryLoggingInfo;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
@@ -369,6 +511,41 @@ public class BaseTemplateData implements Parcelable {
return mSupplementalSubtitleTapAction;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
SubItemLoggingInfo getSupplementalSubtitleLoggingInfo() {
return mSupplementalSubtitleLoggingInfo;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
Text getSupplementalText() {
return mSupplementalText;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
Icon getSupplementalIcon() {
return mSupplementalIcon;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
TapAction getSupplementalTapAction() {
return mSupplementalTapAction;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
SubItemLoggingInfo getSupplementalLoggingInfo() {
return mSupplementalLoggingInfo;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
@@ -376,6 +553,12 @@ public class BaseTemplateData implements Parcelable {
return mSupplementalAlarmText;
}
/** Should ONLY be used by the subclasses */
@SuppressLint("GetterOnBuilder")
int getLayoutWeight() {
return mLayoutWeight;
}
/**
* Sets the card title.
*/
@@ -421,6 +604,15 @@ public class BaseTemplateData implements Parcelable {
return this;
}
/**
* Sets the card primary logging info.
*/
@NonNull
public Builder setPrimaryLoggingInfo(@NonNull SubItemLoggingInfo primaryLoggingInfo) {
mPrimaryLoggingInfo = primaryLoggingInfo;
return this;
}
/**
* Sets the supplemental subtitle text.
*/
@@ -443,8 +635,7 @@ public class BaseTemplateData implements Parcelable {
/**
* Sets the supplemental subtitle tap action. {@code mPrimaryTapAction} will be used if not
* being
* set.
* being set.
*/
@NonNull
public Builder setSupplementalSubtitleTapAction(
@@ -453,6 +644,54 @@ public class BaseTemplateData implements Parcelable {
return this;
}
/**
* Sets the card supplemental title's logging info.
*/
@NonNull
public Builder setSupplementalSubtitleLoggingInfo(
@NonNull SubItemLoggingInfo supplementalSubtitleLoggingInfo) {
mSupplementalSubtitleLoggingInfo = supplementalSubtitleLoggingInfo;
return this;
}
/**
* Sets the supplemental text.
*/
@NonNull
public Builder setSupplementalText(@NonNull Text supplementalText) {
mSupplementalText = supplementalText;
return this;
}
/**
* Sets the supplemental icon.
*/
@NonNull
public Builder setSupplementalIcon(@NonNull Icon supplementalIcon) {
mSupplementalIcon = supplementalIcon;
return this;
}
/**
* Sets the supplemental line tap action. {@code mPrimaryTapAction} will be used if not
* being set.
*/
@NonNull
public Builder setSupplementalTapAction(@NonNull TapAction supplementalTapAction) {
mSupplementalTapAction = supplementalTapAction;
return this;
}
/**
* Sets the card supplemental line's logging info.
*/
@NonNull
public Builder setSupplementalLoggingInfo(
@NonNull SubItemLoggingInfo supplementalLoggingInfo) {
mSupplementalLoggingInfo = supplementalLoggingInfo;
return this;
}
/**
* Sets the supplemental alarm text.
*/
@@ -462,15 +701,137 @@ public class BaseTemplateData implements Parcelable {
return this;
}
/**
* Sets the layout weight.
*/
@NonNull
public Builder setLayoutWeight(int layoutWeight) {
mLayoutWeight = layoutWeight;
return this;
}
/**
* Builds a new SmartspaceDefaultUiTemplateData instance.
*/
@NonNull
public BaseTemplateData build() {
return new BaseTemplateData(mTemplateType, mTitleText, mTitleIcon,
mSubtitleText, mSubtitleIcon, mPrimaryTapAction, mSupplementalSubtitleText,
mSupplementalSubtitleIcon, mSupplementalSubtitleTapAction,
mSupplementalAlarmText);
mSubtitleText, mSubtitleIcon, mPrimaryTapAction,
mPrimaryLoggingInfo,
mSupplementalSubtitleText, mSupplementalSubtitleIcon,
mSupplementalSubtitleTapAction, mSupplementalSubtitleLoggingInfo,
mSupplementalText, mSupplementalIcon,
mSupplementalTapAction, mSupplementalLoggingInfo,
mSupplementalAlarmText, mLayoutWeight);
}
}
/**
* Holds all the logging info needed for a sub item within the base card. For example, the
* supplemental-subtitle part should have its own logging info.
*/
public static final class SubItemLoggingInfo implements Parcelable {
/** A unique instance id for the sub item. */
private final int mInstanceId;
/** The feature type for this sub item. */
private final int mFeatureType;
SubItemLoggingInfo(@NonNull Parcel in) {
mInstanceId = in.readInt();
mFeatureType = in.readInt();
}
private SubItemLoggingInfo(int instanceId, int featureType) {
mInstanceId = instanceId;
mFeatureType = featureType;
}
public int getInstanceId() {
return mInstanceId;
}
public int getFeatureType() {
return mFeatureType;
}
/**
* @see Parcelable.Creator
*/
@NonNull
public static final Creator<SubItemLoggingInfo> CREATOR =
new Creator<SubItemLoggingInfo>() {
@Override
public SubItemLoggingInfo createFromParcel(Parcel in) {
return new SubItemLoggingInfo(in);
}
@Override
public SubItemLoggingInfo[] newArray(int size) {
return new SubItemLoggingInfo[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
out.writeInt(mInstanceId);
out.writeInt(mFeatureType);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SubItemLoggingInfo)) return false;
SubItemLoggingInfo that = (SubItemLoggingInfo) o;
return mInstanceId == that.mInstanceId && mFeatureType == that.mFeatureType;
}
@Override
public int hashCode() {
return Objects.hash(mInstanceId, mFeatureType);
}
@Override
public String toString() {
return "SubItemLoggingInfo{"
+ "mInstanceId=" + mInstanceId
+ ", mFeatureType=" + mFeatureType
+ '}';
}
/**
* A builder for {@link SubItemLoggingInfo} object.
*
* @hide
*/
@SystemApi
public static final class Builder {
private final int mInstanceId;
private final int mFeatureType;
/**
* A builder for {@link SubItemLoggingInfo}.
*
* @param instanceId A unique instance id for the sub item
* @param featureType The feature type for this sub item
*/
public Builder(int instanceId, int featureType) {
mInstanceId = instanceId;
mFeatureType = featureType;
}
/** Builds a new {@link SubItemLoggingInfo} instance. */
@NonNull
public SubItemLoggingInfo build() {
return new SubItemLoggingInfo(mInstanceId, mFeatureType);
}
}
}
}

View File

@@ -59,17 +59,29 @@ public final class CarouselTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@NonNull List<CarouselItem> carouselItems,
@Nullable TapAction carouselAction) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mCarouselItems = carouselItems;
mCarouselAction = carouselAction;
}
@@ -179,10 +191,14 @@ public final class CarouselTemplateData extends BaseTemplateData {
}
return new CarouselTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(), mCarouselItems,
mCarouselAction);
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mCarouselItems, mCarouselAction);
}
}

View File

@@ -54,16 +54,27 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@NonNull List<BaseTemplateData> combinedCardDataList) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mCombinedCardDataList = combinedCardDataList;
}
@@ -151,9 +162,13 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
throw new IllegalStateException("Please assign a value to all @NonNull args.");
}
return new CombinedCardsTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(),
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mCombinedCardDataList);
}
}

View File

@@ -69,21 +69,33 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@Nullable Text headToHeadTitle,
@Nullable Icon headToHeadFirstCompetitorIcon,
@Nullable Icon headToHeadSecondCompetitorIcon,
@Nullable Text headToHeadFirstCompetitorText,
@Nullable Text headToHeadSecondCompetitorText,
@Nullable TapAction headToHeadAction) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mHeadToHeadTitle = headToHeadTitle;
mHeadToHeadFirstCompetitorIcon = headToHeadFirstCompetitorIcon;
mHeadToHeadSecondCompetitorIcon = headToHeadSecondCompetitorIcon;
@@ -285,9 +297,13 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
@NonNull
public HeadToHeadTemplateData build() {
return new HeadToHeadTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(),
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mHeadToHeadTitle,
mHeadToHeadFirstCompetitorIcon,
mHeadToHeadSecondCompetitorIcon, mHeadToHeadFirstCompetitorText,

View File

@@ -69,7 +69,10 @@ public final class Icon implements Parcelable {
return mContentDescription;
}
/** Return shouldTint value. The default value is true. */
/**
* Return shouldTint value, which means whether should tint the icon with the system's theme
* color. The default value is true.
*/
public boolean shouldTint() {
return mShouldTint;
}
@@ -155,7 +158,7 @@ public final class Icon implements Parcelable {
}
/**
* Sets should tint icon.
* Sets should tint icon with the system's theme color.
*/
@NonNull
public Builder setShouldTint(boolean shouldTint) {

View File

@@ -62,18 +62,30 @@ public final class SubCardTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@NonNull Icon subCardIcon,
@Nullable Text subCardText,
@Nullable TapAction subCardAction) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mSubCardIcon = subCardIcon;
mSubCardText = subCardText;
mSubCardAction = subCardAction;
@@ -196,9 +208,14 @@ public final class SubCardTemplateData extends BaseTemplateData {
@NonNull
public SubCardTemplateData build() {
return new SubCardTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(), mSubCardIcon,
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mSubCardIcon,
mSubCardText,
mSubCardAction);
}

View File

@@ -63,18 +63,30 @@ public final class SubImageTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@NonNull List<Text> subImageTexts,
@NonNull List<Icon> subImages,
@Nullable TapAction subImageAction) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mSubImageTexts = subImageTexts;
mSubImages = subImages;
mSubImageAction = subImageAction;
@@ -193,9 +205,14 @@ public final class SubImageTemplateData extends BaseTemplateData {
@NonNull
public SubImageTemplateData build() {
return new SubImageTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(), mSubImageTexts,
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mSubImageTexts,
mSubImages,
mSubImageAction);
}

View File

@@ -62,18 +62,30 @@ public final class SubListTemplateData extends BaseTemplateData {
@Nullable Text titleText,
@Nullable Icon titleIcon,
@Nullable Text subtitleText,
@Nullable Icon subTitleIcon,
@Nullable Icon subtitleIcon,
@Nullable TapAction primaryTapAction,
@Nullable SubItemLoggingInfo primaryLoggingInfo,
@Nullable Text supplementalSubtitleText,
@Nullable Icon supplementalSubtitleIcon,
@Nullable TapAction supplementalSubtitleTapAction,
@Nullable SubItemLoggingInfo supplementalSubtitleLoggingInfo,
@Nullable Text supplementalText,
@Nullable Icon supplementalIcon,
@Nullable TapAction supplementalTapAction,
@Nullable SubItemLoggingInfo supplementalLoggingInfo,
@Nullable Text supplementalAlarmText,
int layoutWeight,
@Nullable Icon subListIcon,
@NonNull List<Text> subListTexts,
@Nullable TapAction subListAction) {
super(templateType, titleText, titleIcon, subtitleText, subTitleIcon, primaryTapAction,
supplementalSubtitleText, supplementalSubtitleIcon, supplementalSubtitleTapAction,
supplementalAlarmText);
super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
primaryTapAction, primaryLoggingInfo,
supplementalSubtitleText, supplementalSubtitleIcon,
supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
supplementalText, supplementalIcon,
supplementalTapAction, supplementalLoggingInfo,
supplementalAlarmText, layoutWeight);
mSubListIcon = subListIcon;
mSubListTexts = subListTexts;
mSubListAction = subListAction;
@@ -196,9 +208,14 @@ public final class SubListTemplateData extends BaseTemplateData {
@NonNull
public SubListTemplateData build() {
return new SubListTemplateData(getTemplateType(), getTitleText(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(), getPrimaryTapAction(),
getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
getPrimaryTapAction(), getPrimaryLoggingInfo(),
getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
getSupplementalSubtitleTapAction(), getSupplementalAlarmText(), mSubListIcon,
getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
getSupplementalText(), getSupplementalIcon(),
getSupplementalTapAction(), getSupplementalLoggingInfo(),
getSupplementalAlarmText(), getLayoutWeight(),
mSubListIcon,
mSubListTexts,
mSubListAction);
}

View File

@@ -58,7 +58,13 @@ public final class TapAction implements Parcelable {
private final UserHandle mUserHandle;
@Nullable
private Bundle mExtras;
private final Bundle mExtras;
/**
* Whether the tap action's result should be shown on the lockscreen (e.g. turn off the
* flashlight can be done on LS bypassing the keyguard). Default value is false.
*/
private final boolean mShouldShowOnLockscreen;
TapAction(@NonNull Parcel in) {
mId = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
@@ -66,16 +72,18 @@ public final class TapAction implements Parcelable {
mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
mUserHandle = in.readTypedObject(UserHandle.CREATOR);
mExtras = in.readBundle();
mShouldShowOnLockscreen = in.readBoolean();
}
private TapAction(@Nullable CharSequence id, @Nullable Intent intent,
@Nullable PendingIntent pendingIntent, @Nullable UserHandle userHandle,
@Nullable Bundle extras) {
@Nullable Bundle extras, boolean shouldShowOnLockscreen) {
mId = id;
mIntent = intent;
mPendingIntent = pendingIntent;
mUserHandle = userHandle;
mExtras = extras;
mShouldShowOnLockscreen = shouldShowOnLockscreen;
}
/** Returns the unique id of the tap action. */
@@ -110,6 +118,14 @@ public final class TapAction implements Parcelable {
return mExtras;
}
/**
* Whether the tap action's result should be shown on the lockscreen. If true, the tap action's
* handling should bypass the keyguard. Default value is false.
*/
public boolean shouldShowOnLockscreen() {
return mShouldShowOnLockscreen;
}
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
TextUtils.writeToParcel(mId, out, flags);
@@ -117,6 +133,7 @@ public final class TapAction implements Parcelable {
out.writeTypedObject(mPendingIntent, flags);
out.writeTypedObject(mUserHandle, flags);
out.writeBundle(mExtras);
out.writeBoolean(mShouldShowOnLockscreen);
}
@Override
@@ -158,6 +175,7 @@ public final class TapAction implements Parcelable {
+ ", mPendingIntent=" + mPendingIntent
+ ", mUserHandle=" + mUserHandle
+ ", mExtras=" + mExtras
+ ", mShouldShowOnLockscreen=" + mShouldShowOnLockscreen
+ '}';
}
@@ -174,14 +192,16 @@ public final class TapAction implements Parcelable {
private PendingIntent mPendingIntent;
private UserHandle mUserHandle;
private Bundle mExtras;
private boolean mShouldShowOnLockScreen;
/**
* A builder for {@link TapAction}.
* A builder for {@link TapAction}. By default sets should_show_on_lockscreen to false.
*
* @param id A unique Id of this {@link TapAction}.
*/
public Builder(@NonNull CharSequence id) {
mId = Objects.requireNonNull(id);
mShouldShowOnLockScreen = false;
}
/**
@@ -221,6 +241,16 @@ public final class TapAction implements Parcelable {
return this;
}
/**
* Sets whether the tap action's result should be shown on the lockscreen, to bypass the
* keyguard when the tap action is triggered.
*/
@NonNull
public Builder setShouldShowOnLockscreen(@NonNull boolean shouldShowOnLockScreen) {
mShouldShowOnLockScreen = shouldShowOnLockScreen;
return this;
}
/**
* Builds a new SmartspaceTapAction instance.
*
@@ -231,7 +261,8 @@ public final class TapAction implements Parcelable {
if (mIntent == null && mPendingIntent == null && mExtras == null) {
throw new IllegalStateException("Please assign at least 1 valid tap field");
}
return new TapAction(mId, mIntent, mPendingIntent, mUserHandle, mExtras);
return new TapAction(mId, mIntent, mPendingIntent, mUserHandle, mExtras,
mShouldShowOnLockScreen);
}
}
}

View File

@@ -130,16 +130,6 @@ public final class Text implements Parcelable {
mMaxLines = 1;
}
/**
* A builder for {@link Text} with specifying {@link TextUtils.TruncateAt} type, and by
* default set the max lines to 1.
*/
public Builder(@NonNull CharSequence text, @NonNull TextUtils.TruncateAt truncateAtType) {
mText = Objects.requireNonNull(text);
mTruncateAtType = Objects.requireNonNull(truncateAtType);
mMaxLines = 1;
}
/**
* Sets truncateAtType, where the text content should be truncated if not all the content
* can be presented.