summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cecilia Hong <xiaotinghong@google.com> 2022-02-24 01:36:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-02-24 01:36:55 +0000
commit77f82a27cff98dabc981c4a28e0cb1b9665461c9 (patch)
tree295b76445121aa396db99437cf814df45635538c
parentcdc7d70d4f1852086221c6bd80d8a2751cf4baf6 (diff)
parent36376d66a3a8785e286c304ce96972554f2ef3e3 (diff)
Merge "[DO NOT MERGE] Address the Smartspace UI templates APIs review comments." into tm-dev
-rw-r--r--core/api/system-current.txt79
-rw-r--r--core/java/android/app/smartspace/SmartspaceTarget.java38
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/BaseTemplateData.java739
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/CarouselTemplateData.java40
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/CombinedCardsTemplateData.java41
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/HeadToHeadTemplateData.java40
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/SubCardTemplateData.java40
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/SubImageTemplateData.java40
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/SubListTemplateData.java40
-rw-r--r--core/java/android/app/smartspace/uitemplatedata/Text.java9
10 files changed, 460 insertions, 646 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index e18a3088c820..d209432eb804 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -2172,23 +2172,41 @@ package android.app.smartspace {
field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.SmartspaceTarget> CREATOR;
field public static final int FEATURE_ALARM = 7; // 0x7
field public static final int FEATURE_BEDTIME_ROUTINE = 16; // 0x10
+ field public static final int FEATURE_BLAZE_BUILD_PROGRESS = 40; // 0x28
field public static final int FEATURE_CALENDAR = 2; // 0x2
field public static final int FEATURE_COMMUTE_TIME = 3; // 0x3
field public static final int FEATURE_CONSENT = 11; // 0xb
+ field public static final int FEATURE_CROSS_DEVICE_TIMER = 32; // 0x20
+ field public static final int FEATURE_DOORBELL = 30; // 0x1e
+ field public static final int FEATURE_DRIVING_MODE = 26; // 0x1a
+ field public static final int FEATURE_EARTHQUAKE_ALERT = 38; // 0x26
+ field public static final int FEATURE_EARTHQUAKE_OCCURRED = 41; // 0x29
field public static final int FEATURE_ETA_MONITORING = 18; // 0x12
field public static final int FEATURE_FITNESS_TRACKING = 17; // 0x11
+ field public static final int FEATURE_FLASHLIGHT = 28; // 0x1c
field public static final int FEATURE_FLIGHT = 4; // 0x4
+ field public static final int FEATURE_GAS_STATION_PAYMENT = 24; // 0x18
+ field public static final int FEATURE_HOLIDAY_ALARM = 34; // 0x22
field public static final int FEATURE_LOYALTY_CARD = 14; // 0xe
field public static final int FEATURE_MEDIA = 15; // 0xf
+ field public static final int FEATURE_MEDIA_HEADS_UP = 36; // 0x24
+ field public static final int FEATURE_MEDIA_RESUME = 31; // 0x1f
field public static final int FEATURE_MISSED_CALL = 19; // 0x13
field public static final int FEATURE_ONBOARDING = 8; // 0x8
field public static final int FEATURE_PACKAGE_TRACKING = 20; // 0x14
+ field public static final int FEATURE_PAIRED_DEVICE_STATE = 25; // 0x19
field public static final int FEATURE_REMINDER = 6; // 0x6
+ field public static final int FEATURE_SAFETY_CHECK = 35; // 0x23
+ field public static final int FEATURE_SEVERE_WEATHER_ALERT = 33; // 0x21
field public static final int FEATURE_SHOPPING_LIST = 13; // 0xd
+ field public static final int FEATURE_SLEEP_SUMMARY = 27; // 0x1b
field public static final int FEATURE_SPORTS = 9; // 0x9
+ field public static final int FEATURE_STEP_COUNTING = 37; // 0x25
+ field public static final int FEATURE_STEP_DATE = 39; // 0x27
field public static final int FEATURE_STOCK_PRICE_CHANGE = 12; // 0xc
field public static final int FEATURE_STOPWATCH = 22; // 0x16
field public static final int FEATURE_TIMER = 21; // 0x15
+ field public static final int FEATURE_TIME_TO_LEAVE = 29; // 0x1d
field public static final int FEATURE_TIPS = 5; // 0x5
field public static final int FEATURE_UNDEFINED = 0; // 0x0
field public static final int FEATURE_UPCOMING_ALARM = 23; // 0x17
@@ -2254,22 +2272,12 @@ 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 @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo getPrimaryItem();
+ method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo getSubtitleItem();
+ method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo getSubtitleSupplementalItem();
+ method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo getSupplementalAlarmItem();
+ method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo getSupplementalLineItem();
method public int getTemplateType();
- method @Nullable public android.app.smartspace.uitemplatedata.Icon getTitleIcon();
- method @Nullable public android.app.smartspace.uitemplatedata.Text getTitleText();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.BaseTemplateData> CREATOR;
}
@@ -2278,27 +2286,37 @@ package android.app.smartspace.uitemplatedata {
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);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setPrimaryItem(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleItem(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSubtitleSupplementalItem(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalAlarmItem(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.Builder setSupplementalLineItem(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo);
+ }
+
+ public static final class BaseTemplateData.SubItemInfo implements android.os.Parcelable {
+ method public int describeContents();
+ method @Nullable public android.app.smartspace.uitemplatedata.Icon getIcon();
+ method @Nullable public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo getLoggingInfo();
+ method @Nullable public android.app.smartspace.uitemplatedata.TapAction getTapAction();
+ method @Nullable public android.app.smartspace.uitemplatedata.Text getText();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo> CREATOR;
+ }
+
+ public static final class BaseTemplateData.SubItemInfo.Builder {
+ ctor public BaseTemplateData.SubItemInfo.Builder();
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo build();
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo.Builder setIcon(@NonNull android.app.smartspace.uitemplatedata.Icon);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo.Builder setLoggingInfo(@NonNull android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo.Builder setTapAction(@NonNull android.app.smartspace.uitemplatedata.TapAction);
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemInfo.Builder setText(@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 @Nullable public CharSequence getPackageName();
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;
}
@@ -2306,6 +2324,7 @@ package android.app.smartspace.uitemplatedata {
public static final class BaseTemplateData.SubItemLoggingInfo.Builder {
ctor public BaseTemplateData.SubItemLoggingInfo.Builder(int, int);
method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo build();
+ method @NonNull public android.app.smartspace.uitemplatedata.BaseTemplateData.SubItemLoggingInfo.Builder setPackageName(@NonNull CharSequence);
}
public final class CarouselTemplateData extends android.app.smartspace.uitemplatedata.BaseTemplateData {
diff --git a/core/java/android/app/smartspace/SmartspaceTarget.java b/core/java/android/app/smartspace/SmartspaceTarget.java
index fd7088f48aed..be077435b080 100644
--- a/core/java/android/app/smartspace/SmartspaceTarget.java
+++ b/core/java/android/app/smartspace/SmartspaceTarget.java
@@ -159,6 +159,24 @@ public final class SmartspaceTarget implements Parcelable {
public static final int FEATURE_TIMER = 21;
public static final int FEATURE_STOPWATCH = 22;
public static final int FEATURE_UPCOMING_ALARM = 23;
+ public static final int FEATURE_GAS_STATION_PAYMENT = 24;
+ public static final int FEATURE_PAIRED_DEVICE_STATE = 25;
+ public static final int FEATURE_DRIVING_MODE = 26;
+ public static final int FEATURE_SLEEP_SUMMARY = 27;
+ public static final int FEATURE_FLASHLIGHT = 28;
+ public static final int FEATURE_TIME_TO_LEAVE = 29;
+ public static final int FEATURE_DOORBELL = 30;
+ public static final int FEATURE_MEDIA_RESUME = 31;
+ public static final int FEATURE_CROSS_DEVICE_TIMER = 32;
+ public static final int FEATURE_SEVERE_WEATHER_ALERT = 33;
+ public static final int FEATURE_HOLIDAY_ALARM = 34;
+ public static final int FEATURE_SAFETY_CHECK = 35;
+ public static final int FEATURE_MEDIA_HEADS_UP = 36;
+ public static final int FEATURE_STEP_COUNTING = 37;
+ public static final int FEATURE_EARTHQUAKE_ALERT = 38;
+ public static final int FEATURE_STEP_DATE = 39;
+ public static final int FEATURE_BLAZE_BUILD_PROGRESS = 40;
+ public static final int FEATURE_EARTHQUAKE_OCCURRED = 41;
/**
* @hide
@@ -187,7 +205,25 @@ public final class SmartspaceTarget implements Parcelable {
FEATURE_PACKAGE_TRACKING,
FEATURE_TIMER,
FEATURE_STOPWATCH,
- FEATURE_UPCOMING_ALARM
+ FEATURE_UPCOMING_ALARM,
+ FEATURE_GAS_STATION_PAYMENT,
+ FEATURE_PAIRED_DEVICE_STATE,
+ FEATURE_DRIVING_MODE,
+ FEATURE_SLEEP_SUMMARY,
+ FEATURE_FLASHLIGHT,
+ FEATURE_TIME_TO_LEAVE,
+ FEATURE_DOORBELL,
+ FEATURE_MEDIA_RESUME,
+ FEATURE_CROSS_DEVICE_TIMER,
+ FEATURE_SEVERE_WEATHER_ALERT,
+ FEATURE_HOLIDAY_ALARM,
+ FEATURE_SAFETY_CHECK,
+ FEATURE_MEDIA_HEADS_UP,
+ FEATURE_STEP_COUNTING,
+ FEATURE_EARTHQUAKE_ALERT,
+ FEATURE_STEP_DATE,
+ FEATURE_BLAZE_BUILD_PROGRESS,
+ FEATURE_EARTHQUAKE_OCCURRED
})
@Retention(RetentionPolicy.SOURCE)
public @interface FeatureType {
diff --git a/core/java/android/app/smartspace/uitemplatedata/BaseTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/BaseTemplateData.java
index 584b17605a87..e3cb67a8284c 100644
--- a/core/java/android/app/smartspace/uitemplatedata/BaseTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/BaseTemplateData.java
@@ -20,10 +20,12 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
+import android.app.smartspace.SmartspaceTarget.FeatureType;
import android.app.smartspace.SmartspaceTarget.UiTemplateType;
import android.app.smartspace.SmartspaceUtils;
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.TextUtils;
import java.util.Objects;
@@ -57,81 +59,39 @@ public class BaseTemplateData implements Parcelable {
/**
* Title text and title icon are shown at the first row. When both are absent, the date view
* will be used, which has its own tap action applied to the title area.
+ *
+ * Primary tap action for the entire card, including the blank spaces, except: 1. When title is
+ * absent, the date view's default tap action is used; 2. Subtitle/Supplemental subtitle uses
+ * its own tap action if being set; 3. Secondary card uses its own tap action if being set.
*/
@Nullable
- private final Text mTitleText;
+ private final SubItemInfo mPrimaryItem;
- @Nullable
- private final Icon mTitleIcon;
/** Subtitle text and icon are shown at the second row. */
@Nullable
- private final Text mSubtitleText;
-
- @Nullable
- private final Icon mSubtitleIcon;
-
- /**
- * Primary tap action for the entire card, including the blank spaces, except: 1. When title is
- * absent, the date view's default tap action is used; 2. Supplemental subtitle uses its own tap
- * action if being set; 3. Secondary card uses its own tap action if being set.
- */
- @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;
+ private final SubItemInfo mSubtitleItem;
/**
* Supplemental subtitle text and icon are shown at the second row following the subtitle text.
* Mainly used for weather info on non-weather card.
*/
@Nullable
- private final Text mSupplementalSubtitleText;
-
- @Nullable
- private final Icon mSupplementalSubtitleIcon;
+ private final SubItemInfo mSubtitleSupplementalItem;
/**
- * Tap action for the supplemental subtitle's text and icon. Uses the primary tap action if
- * not being set.
+ * Supplemental line is shown at the third row.
*/
@Nullable
- private final TapAction mSupplementalSubtitleTapAction;
+ private final SubItemInfo mSupplementalLineItem;
/**
- * Logging info for the supplemental subtitle's are. Uses the primary logging info if not being
- * set.
+ * Supplemental alarm item is specifically used for holiday alarm, which is appended to "next
+ * alarm". This is also shown at the third row, but won't be shown the same time with
+ * mSupplementalLineItem.
*/
@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".
- */
- @Nullable
- private final Text mSupplementalAlarmText;
+ private final SubItemInfo mSupplementalAlarmItem;
/**
* The layout weight info for the card, which indicates how much space it should occupy on the
@@ -141,21 +101,11 @@ public class BaseTemplateData implements Parcelable {
BaseTemplateData(@NonNull Parcel in) {
mTemplateType = in.readInt();
- mTitleText = in.readTypedObject(Text.CREATOR);
- mTitleIcon = in.readTypedObject(Icon.CREATOR);
- 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);
+ mPrimaryItem = in.readTypedObject(SubItemInfo.CREATOR);
+ mSubtitleItem = in.readTypedObject(SubItemInfo.CREATOR);
+ mSubtitleSupplementalItem = in.readTypedObject(SubItemInfo.CREATOR);
+ mSupplementalLineItem = in.readTypedObject(SubItemInfo.CREATOR);
+ mSupplementalAlarmItem = in.readTypedObject(SubItemInfo.CREATOR);
mLayoutWeight = in.readInt();
}
@@ -164,38 +114,18 @@ public class BaseTemplateData implements Parcelable {
* SmartspaceDefaultUiTemplateData.Builder.
*/
BaseTemplateData(@UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
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;
+ mPrimaryItem = primaryItem;
+ mSubtitleItem = subtitleItem;
+ mSubtitleSupplementalItem = subtitleSupplementalItem;
+ mSupplementalLineItem = supplementalLineItem;
+ mSupplementalAlarmItem = supplementalAlarmItem;
mLayoutWeight = layoutWeight;
}
@@ -205,94 +135,34 @@ public class BaseTemplateData implements Parcelable {
return mTemplateType;
}
- /** Returns the title's text. */
+ /** Returns the primary item (the first line). */
@Nullable
- public Text getTitleText() {
- return mTitleText;
+ public SubItemInfo getPrimaryItem() {
+ return mPrimaryItem;
}
- /** Returns the title's icon. */
+ /** Returns the subtitle item (the second line). */
@Nullable
- public Icon getTitleIcon() {
- return mTitleIcon;
+ public SubItemInfo getSubtitleItem() {
+ return mSubtitleItem;
}
- /** Returns the subtitle's text. */
+ /** Returns the subtitle's supplemental item (the second line following the subtitle). */
@Nullable
- public Text getSubtitleText() {
- return mSubtitleText;
+ public SubItemInfo getSubtitleSupplementalItem() {
+ return mSubtitleSupplementalItem;
}
- /** Returns the subtitle's icon. */
+ /** Returns the supplemental line item (the 3rd line). */
@Nullable
- public Icon getSubtitleIcon() {
- return mSubtitleIcon;
+ public SubItemInfo getSupplementalLineItem() {
+ return mSupplementalLineItem;
}
- /** Returns the card's primary tap action. */
+ /** Returns the supplemental alarm item (the 3rd line). */
@Nullable
- public TapAction getPrimaryTapAction() {
- 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() {
- return mSupplementalSubtitleText;
- }
-
- /** Returns the supplemental subtitle's icon. */
- @Nullable
- public Icon getSupplementalSubtitleIcon() {
- return mSupplementalSubtitleIcon;
- }
-
- /** Returns the supplemental subtitle's tap action. Can be null if not being set. */
- @Nullable
- public TapAction getSupplementalSubtitleTapAction() {
- 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;
+ public SubItemInfo getSupplementalAlarmItem() {
+ return mSupplementalAlarmItem;
}
/** Returns the card layout weight info. Default weight is 0. */
@@ -325,21 +195,11 @@ public class BaseTemplateData implements Parcelable {
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
out.writeInt(mTemplateType);
- out.writeTypedObject(mTitleText, flags);
- out.writeTypedObject(mTitleIcon, flags);
- 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.writeTypedObject(mPrimaryItem, flags);
+ out.writeTypedObject(mSubtitleItem, flags);
+ out.writeTypedObject(mSubtitleSupplementalItem, flags);
+ out.writeTypedObject(mSupplementalLineItem, flags);
+ out.writeTypedObject(mSupplementalAlarmItem, flags);
out.writeInt(mLayoutWeight);
}
@@ -348,58 +208,29 @@ public class BaseTemplateData implements Parcelable {
if (this == o) return true;
if (!(o instanceof BaseTemplateData)) return false;
BaseTemplateData that = (BaseTemplateData) o;
- return mTemplateType == that.mTemplateType && SmartspaceUtils.isEqual(mTitleText,
- that.mTitleText)
- && Objects.equals(mTitleIcon, that.mTitleIcon)
- && 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)
- && 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;
+ return mTemplateType == that.mTemplateType && mLayoutWeight == that.mLayoutWeight
+ && Objects.equals(mPrimaryItem, that.mPrimaryItem)
+ && Objects.equals(mSubtitleItem, that.mSubtitleItem)
+ && Objects.equals(mSubtitleSupplementalItem, that.mSubtitleSupplementalItem)
+ && Objects.equals(mSupplementalLineItem, that.mSupplementalLineItem)
+ && Objects.equals(mSupplementalAlarmItem, that.mSupplementalAlarmItem);
}
@Override
public int hashCode() {
- return Objects.hash(mTemplateType, mTitleText, mTitleIcon, mSubtitleText, mSubtitleIcon,
- mPrimaryTapAction, mPrimaryLoggingInfo, mSupplementalSubtitleText,
- mSupplementalSubtitleIcon, mSupplementalSubtitleTapAction,
- mSupplementalSubtitleLoggingInfo,
- mSupplementalText, mSupplementalIcon, mSupplementalTapAction,
- mSupplementalLoggingInfo, mSupplementalAlarmText, mLayoutWeight);
+ return Objects.hash(mTemplateType, mPrimaryItem, mSubtitleItem, mSubtitleSupplementalItem,
+ mSupplementalLineItem, mSupplementalAlarmItem, mLayoutWeight);
}
@Override
public String toString() {
- return "SmartspaceDefaultUiTemplateData{"
+ return "BaseTemplateData{"
+ "mTemplateType=" + mTemplateType
- + ", mTitleText=" + mTitleText
- + ", mTitleIcon=" + mTitleIcon
- + ", 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
+ + ", mPrimaryItem=" + mPrimaryItem
+ + ", mSubtitleItem=" + mSubtitleItem
+ + ", mSubtitleSupplementalItem=" + mSubtitleSupplementalItem
+ + ", mSupplementalLineItem=" + mSupplementalLineItem
+ + ", mSupplementalAlarmItem=" + mSupplementalAlarmItem
+ ", mLayoutWeight=" + mLayoutWeight
+ '}';
}
@@ -414,21 +245,12 @@ public class BaseTemplateData implements Parcelable {
public static class Builder {
@UiTemplateType
private final int mTemplateType;
- private Text mTitleText;
- private Icon mTitleIcon;
- 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 SubItemInfo mPrimaryItem;
+ private SubItemInfo mSubtitleItem;
+ private SubItemInfo mSubtitleSupplementalItem;
+ private SubItemInfo mSupplementalLineItem;
+ private SubItemInfo mSupplementalAlarmItem;
private int mLayoutWeight;
/**
@@ -451,106 +273,36 @@ public class BaseTemplateData implements Parcelable {
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
- Text getTitleText() {
- return mTitleText;
+ SubItemInfo getPrimaryItem() {
+ return mPrimaryItem;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
- Icon getTitleIcon() {
- return mTitleIcon;
+ SubItemInfo getSubtitleItem() {
+ return mSubtitleItem;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
- Text getSubtitleText() {
- return mSubtitleText;
+ SubItemInfo getSubtitleSupplemtnalItem() {
+ return mSubtitleSupplementalItem;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
- Icon getSubtitleIcon() {
- return mSubtitleIcon;
+ SubItemInfo getSupplementalLineItem() {
+ return mSupplementalLineItem;
}
/** Should ONLY be used by the subclasses */
@Nullable
@SuppressLint("GetterOnBuilder")
- TapAction getPrimaryTapAction() {
- 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")
- Text getSupplementalSubtitleText() {
- return mSupplementalSubtitleText;
- }
-
- /** Should ONLY be used by the subclasses */
- @Nullable
- @SuppressLint("GetterOnBuilder")
- Icon getSupplementalSubtitleIcon() {
- return mSupplementalSubtitleIcon;
- }
-
- /** Should ONLY be used by the subclasses */
- @Nullable
- @SuppressLint("GetterOnBuilder")
- TapAction getSupplementalSubtitleTapAction() {
- 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")
- Text getSupplementalAlarmText() {
- return mSupplementalAlarmText;
+ SubItemInfo getSupplementalAlarmItem() {
+ return mSupplementalAlarmItem;
}
/** Should ONLY be used by the subclasses */
@@ -560,169 +312,255 @@ public class BaseTemplateData implements Parcelable {
}
/**
- * Sets the card title.
+ * Sets the card primary item.
*/
@NonNull
- public Builder setTitleText(@NonNull Text titleText) {
- mTitleText = titleText;
+ public Builder setPrimaryItem(@NonNull SubItemInfo primaryItem) {
+ mPrimaryItem = primaryItem;
return this;
}
/**
- * Sets the card title icon.
+ * Sets the card subtitle item.
*/
@NonNull
- public Builder setTitleIcon(@NonNull Icon titleIcon) {
- mTitleIcon = titleIcon;
+ public Builder setSubtitleItem(@NonNull SubItemInfo subtitleItem) {
+ mSubtitleItem = subtitleItem;
return this;
}
/**
- * Sets the card subtitle.
+ * Sets the card subtitle's supplemental item.
*/
@NonNull
- public Builder setSubtitleText(@NonNull Text subtitleText) {
- mSubtitleText = subtitleText;
+ public Builder setSubtitleSupplementalItem(@NonNull SubItemInfo subtitleSupplementalItem) {
+ mSubtitleSupplementalItem = subtitleSupplementalItem;
return this;
}
/**
- * Sets the card subtitle icon.
+ * Sets the card supplemental line item.
*/
@NonNull
- public Builder setSubtitleIcon(@NonNull Icon subtitleIcon) {
- mSubtitleIcon = subtitleIcon;
+ public Builder setSupplementalLineItem(@NonNull SubItemInfo supplementalLineItem) {
+ mSupplementalLineItem = supplementalLineItem;
return this;
}
/**
- * Sets the card primary tap action.
+ * Sets the card supplemental alarm item.
*/
@NonNull
- public Builder setPrimaryTapAction(@NonNull TapAction primaryTapAction) {
- mPrimaryTapAction = primaryTapAction;
+ public Builder setSupplementalAlarmItem(@NonNull SubItemInfo supplementalAlarmItem) {
+ mSupplementalAlarmItem = supplementalAlarmItem;
return this;
}
/**
- * Sets the card primary logging info.
+ * Sets the layout weight.
*/
@NonNull
- public Builder setPrimaryLoggingInfo(@NonNull SubItemLoggingInfo primaryLoggingInfo) {
- mPrimaryLoggingInfo = primaryLoggingInfo;
+ public Builder setLayoutWeight(int layoutWeight) {
+ mLayoutWeight = layoutWeight;
return this;
}
/**
- * Sets the supplemental subtitle text.
+ * Builds a new SmartspaceDefaultUiTemplateData instance.
*/
@NonNull
- public Builder setSupplementalSubtitleText(
- @NonNull Text supplementalSubtitleText) {
- mSupplementalSubtitleText = supplementalSubtitleText;
- return this;
+ public BaseTemplateData build() {
+ return new BaseTemplateData(
+ mTemplateType,
+ mPrimaryItem,
+ mSubtitleItem,
+ mSubtitleSupplementalItem,
+ mSupplementalLineItem,
+ mSupplementalAlarmItem,
+ mLayoutWeight);
}
+ }
- /**
- * Sets the supplemental subtitle icon.
- */
- @NonNull
- public Builder setSupplementalSubtitleIcon(
- @NonNull Icon supplementalSubtitleIcon) {
- mSupplementalSubtitleIcon = supplementalSubtitleIcon;
- return this;
+ /**
+ * Holds all the rendering and logging info needed for a sub item within the base card.
+ */
+ public static final class SubItemInfo implements Parcelable {
+
+ /** The text information for the subitem, which will be rendered as it's text content. */
+ @Nullable
+ private final Text mText;
+
+ /** The icon for the subitem, which will be rendered as a drawable in front of the text. */
+ @Nullable
+ private final Icon mIcon;
+
+ /** The tap action for the subitem. */
+ @Nullable
+ private final TapAction mTapAction;
+
+ /** The logging info for the subitem. */
+ @Nullable
+ private final SubItemLoggingInfo mLoggingInfo;
+
+ SubItemInfo(@NonNull Parcel in) {
+ mText = in.readTypedObject(Text.CREATOR);
+ mIcon = in.readTypedObject(Icon.CREATOR);
+ mTapAction = in.readTypedObject(TapAction.CREATOR);
+ mLoggingInfo = in.readTypedObject(SubItemLoggingInfo.CREATOR);
}
- /**
- * Sets the supplemental subtitle tap action. {@code mPrimaryTapAction} will be used if not
- * being set.
- */
- @NonNull
- public Builder setSupplementalSubtitleTapAction(
- @NonNull TapAction supplementalSubtitleTapAction) {
- mSupplementalSubtitleTapAction = supplementalSubtitleTapAction;
- return this;
+ private SubItemInfo(@Nullable Text text,
+ @Nullable Icon icon,
+ @Nullable TapAction tapAction,
+ @Nullable SubItemLoggingInfo loggingInfo) {
+ mText = text;
+ mIcon = icon;
+ mTapAction = tapAction;
+ mLoggingInfo = loggingInfo;
}
- /**
- * Sets the card supplemental title's logging info.
- */
- @NonNull
- public Builder setSupplementalSubtitleLoggingInfo(
- @NonNull SubItemLoggingInfo supplementalSubtitleLoggingInfo) {
- mSupplementalSubtitleLoggingInfo = supplementalSubtitleLoggingInfo;
- return this;
+ /** Returns the subitem's text. */
+ @Nullable
+ public Text getText() {
+ return mText;
}
- /**
- * Sets the supplemental text.
- */
- @NonNull
- public Builder setSupplementalText(@NonNull Text supplementalText) {
- mSupplementalText = supplementalText;
- return this;
+ /** Returns the subitem's icon. */
+ @Nullable
+ public Icon getIcon() {
+ return mIcon;
}
- /**
- * Sets the supplemental icon.
- */
- @NonNull
- public Builder setSupplementalIcon(@NonNull Icon supplementalIcon) {
- mSupplementalIcon = supplementalIcon;
- return this;
+ /** Returns the subitem's tap action. */
+ @Nullable
+ public TapAction getTapAction() {
+ return mTapAction;
}
- /**
- * 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;
+ /** Returns the subitem's logging info. */
+ @Nullable
+ public SubItemLoggingInfo getLoggingInfo() {
+ return mLoggingInfo;
}
/**
- * Sets the card supplemental line's logging info.
+ * @see Parcelable.Creator
*/
@NonNull
- public Builder setSupplementalLoggingInfo(
- @NonNull SubItemLoggingInfo supplementalLoggingInfo) {
- mSupplementalLoggingInfo = supplementalLoggingInfo;
- return this;
+ public static final Creator<SubItemInfo> CREATOR =
+ new Creator<SubItemInfo>() {
+ @Override
+ public SubItemInfo createFromParcel(Parcel in) {
+ return new SubItemInfo(in);
+ }
+
+ @Override
+ public SubItemInfo[] newArray(int size) {
+ return new SubItemInfo[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
}
- /**
- * Sets the supplemental alarm text.
- */
- @NonNull
- public Builder setSupplementalAlarmText(@NonNull Text supplementalAlarmText) {
- mSupplementalAlarmText = supplementalAlarmText;
- return this;
+ @Override
+ public void writeToParcel(@NonNull Parcel out, int flags) {
+ out.writeTypedObject(mText, flags);
+ out.writeTypedObject(mIcon, flags);
+ out.writeTypedObject(mTapAction, flags);
+ out.writeTypedObject(mLoggingInfo, flags);
}
- /**
- * Sets the layout weight.
- */
- @NonNull
- public Builder setLayoutWeight(int layoutWeight) {
- mLayoutWeight = layoutWeight;
- return this;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SubItemInfo)) return false;
+ SubItemInfo that = (SubItemInfo) o;
+ return SmartspaceUtils.isEqual(mText, that.mText) && Objects.equals(mIcon,
+ that.mIcon) && Objects.equals(mTapAction, that.mTapAction)
+ && Objects.equals(mLoggingInfo, that.mLoggingInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mText, mIcon, mTapAction, mLoggingInfo);
+ }
+
+ @Override
+ public String toString() {
+ return "SubItemInfo{"
+ + "mText=" + mText
+ + ", mIcon=" + mIcon
+ + ", mTapAction=" + mTapAction
+ + ", mLoggingInfo=" + mLoggingInfo
+ + '}';
}
/**
- * Builds a new SmartspaceDefaultUiTemplateData instance.
+ * A builder for {@link SubItemInfo} object.
+ *
+ * @hide
*/
- @NonNull
- public BaseTemplateData build() {
- return new BaseTemplateData(mTemplateType, mTitleText, mTitleIcon,
- mSubtitleText, mSubtitleIcon, mPrimaryTapAction,
- mPrimaryLoggingInfo,
- mSupplementalSubtitleText, mSupplementalSubtitleIcon,
- mSupplementalSubtitleTapAction, mSupplementalSubtitleLoggingInfo,
- mSupplementalText, mSupplementalIcon,
- mSupplementalTapAction, mSupplementalLoggingInfo,
- mSupplementalAlarmText, mLayoutWeight);
+ @SystemApi
+ public static final class Builder {
+
+ private Text mText;
+ private Icon mIcon;
+ private TapAction mTapAction;
+ private SubItemLoggingInfo mLoggingInfo;
+
+ /**
+ * Sets the sub item's text.
+ */
+ @NonNull
+ public Builder setText(@NonNull Text text) {
+ mText = text;
+ return this;
+ }
+
+ /**
+ * Sets the sub item's icon.
+ */
+ @NonNull
+ public Builder setIcon(@NonNull Icon icon) {
+ mIcon = icon;
+ return this;
+ }
+
+ /**
+ * Sets the sub item's tap action.
+ */
+ @NonNull
+ public Builder setTapAction(@NonNull TapAction tapAction) {
+ mTapAction = tapAction;
+ return this;
+ }
+
+ /**
+ * Sets the sub item's logging info.
+ */
+ @NonNull
+ public Builder setLoggingInfo(@NonNull SubItemLoggingInfo loggingInfo) {
+ mLoggingInfo = loggingInfo;
+ return this;
+ }
+
+ /**
+ * Builds a new {@link SubItemInfo} instance.
+ *
+ * @throws IllegalStateException if all the data field is empty.
+ */
+ @NonNull
+ public SubItemInfo build() {
+ if (SmartspaceUtils.isEmpty(mText) && mIcon == null && mTapAction == null
+ && mLoggingInfo == null) {
+ throw new IllegalStateException("SubItem data is empty");
+ }
+
+ return new SubItemInfo(mText, mIcon, mTapAction, mLoggingInfo);
+ }
}
}
@@ -735,27 +573,45 @@ public class BaseTemplateData implements Parcelable {
/** A unique instance id for the sub item. */
private final int mInstanceId;
- /** The feature type for this sub item. */
+ /**
+ * {@link FeatureType} indicating the feature type of this subitem.
+ *
+ * @see FeatureType
+ */
+ @FeatureType
private final int mFeatureType;
+ /** The data source's package name for this sub item. */
+ @Nullable
+ private final CharSequence mPackageName;
+
SubItemLoggingInfo(@NonNull Parcel in) {
mInstanceId = in.readInt();
mFeatureType = in.readInt();
+ mPackageName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
}
- private SubItemLoggingInfo(int instanceId, int featureType) {
+ private SubItemLoggingInfo(int instanceId, @FeatureType int featureType,
+ @Nullable CharSequence packageName) {
mInstanceId = instanceId;
mFeatureType = featureType;
+ mPackageName = packageName;
}
public int getInstanceId() {
return mInstanceId;
}
+ @FeatureType
public int getFeatureType() {
return mFeatureType;
}
+ @Nullable
+ public CharSequence getPackageName() {
+ return mPackageName;
+ }
+
/**
* @see Parcelable.Creator
*/
@@ -782,6 +638,7 @@ public class BaseTemplateData implements Parcelable {
public void writeToParcel(@NonNull Parcel out, int flags) {
out.writeInt(mInstanceId);
out.writeInt(mFeatureType);
+ TextUtils.writeToParcel(mPackageName, out, flags);
}
@Override
@@ -789,12 +646,13 @@ public class BaseTemplateData implements Parcelable {
if (this == o) return true;
if (!(o instanceof SubItemLoggingInfo)) return false;
SubItemLoggingInfo that = (SubItemLoggingInfo) o;
- return mInstanceId == that.mInstanceId && mFeatureType == that.mFeatureType;
+ return mInstanceId == that.mInstanceId && mFeatureType == that.mFeatureType
+ && SmartspaceUtils.isEqual(mPackageName, that.mPackageName);
}
@Override
public int hashCode() {
- return Objects.hash(mInstanceId, mFeatureType);
+ return Objects.hash(mInstanceId, mFeatureType, mPackageName);
}
@Override
@@ -802,6 +660,7 @@ public class BaseTemplateData implements Parcelable {
return "SubItemLoggingInfo{"
+ "mInstanceId=" + mInstanceId
+ ", mFeatureType=" + mFeatureType
+ + ", mPackageName=" + mPackageName
+ '}';
}
@@ -815,22 +674,32 @@ public class BaseTemplateData implements Parcelable {
private final int mInstanceId;
private final int mFeatureType;
+ private CharSequence mPackageName;
/**
* A builder for {@link SubItemLoggingInfo}.
*
* @param instanceId A unique instance id for the sub item
- * @param featureType The feature type for this sub item
+ * @param featureType The feature type id for this sub item
*/
- public Builder(int instanceId, int featureType) {
+ public Builder(int instanceId, @FeatureType int featureType) {
mInstanceId = instanceId;
mFeatureType = featureType;
}
+ /**
+ * Sets the sub item's data source package name.
+ */
+ @NonNull
+ public Builder setPackageName(@NonNull CharSequence packageName) {
+ mPackageName = packageName;
+ return this;
+ }
+
/** Builds a new {@link SubItemLoggingInfo} instance. */
@NonNull
public SubItemLoggingInfo build() {
- return new SubItemLoggingInfo(mInstanceId, mFeatureType);
+ return new SubItemLoggingInfo(mInstanceId, mFeatureType, mPackageName);
}
}
}
diff --git a/core/java/android/app/smartspace/uitemplatedata/CarouselTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/CarouselTemplateData.java
index fbdb7be3de7d..c1378f13543a 100644
--- a/core/java/android/app/smartspace/uitemplatedata/CarouselTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/CarouselTemplateData.java
@@ -56,31 +56,16 @@ public final class CarouselTemplateData extends BaseTemplateData {
}
private CarouselTemplateData(@SmartspaceTarget.UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@NonNull List<CarouselItem> carouselItems,
@Nullable TapAction carouselAction) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
mCarouselItems = carouselItems;
mCarouselAction = carouselAction;
@@ -190,14 +175,9 @@ public final class CarouselTemplateData extends BaseTemplateData {
throw new IllegalStateException("Carousel data is empty");
}
- return new CarouselTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new CarouselTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mCarouselItems, mCarouselAction);
}
}
diff --git a/core/java/android/app/smartspace/uitemplatedata/CombinedCardsTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/CombinedCardsTemplateData.java
index 1d1306619d11..836f41412c01 100644
--- a/core/java/android/app/smartspace/uitemplatedata/CombinedCardsTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/CombinedCardsTemplateData.java
@@ -51,30 +51,16 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
}
private CombinedCardsTemplateData(@SmartspaceTarget.UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@NonNull List<BaseTemplateData> combinedCardDataList) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
+
mCombinedCardDataList = combinedCardDataList;
}
@@ -161,14 +147,9 @@ public final class CombinedCardsTemplateData extends BaseTemplateData {
if (mCombinedCardDataList == null) {
throw new IllegalStateException("Please assign a value to all @NonNull args.");
}
- return new CombinedCardsTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new CombinedCardsTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mCombinedCardDataList);
}
}
diff --git a/core/java/android/app/smartspace/uitemplatedata/HeadToHeadTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/HeadToHeadTemplateData.java
index 19177dfc7649..29df0186b192 100644
--- a/core/java/android/app/smartspace/uitemplatedata/HeadToHeadTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/HeadToHeadTemplateData.java
@@ -66,21 +66,11 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
}
private HeadToHeadTemplateData(@SmartspaceTarget.UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@Nullable Text headToHeadTitle,
@Nullable Icon headToHeadFirstCompetitorIcon,
@@ -88,13 +78,8 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
@Nullable Text headToHeadFirstCompetitorText,
@Nullable Text headToHeadSecondCompetitorText,
@Nullable TapAction headToHeadAction) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
mHeadToHeadTitle = headToHeadTitle;
mHeadToHeadFirstCompetitorIcon = headToHeadFirstCompetitorIcon;
@@ -296,14 +281,9 @@ public final class HeadToHeadTemplateData extends BaseTemplateData {
*/
@NonNull
public HeadToHeadTemplateData build() {
- return new HeadToHeadTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new HeadToHeadTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mHeadToHeadTitle,
mHeadToHeadFirstCompetitorIcon,
mHeadToHeadSecondCompetitorIcon, mHeadToHeadFirstCompetitorText,
diff --git a/core/java/android/app/smartspace/uitemplatedata/SubCardTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/SubCardTemplateData.java
index 48af9c173f1d..b87e5b32fcc5 100644
--- a/core/java/android/app/smartspace/uitemplatedata/SubCardTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/SubCardTemplateData.java
@@ -59,32 +59,17 @@ public final class SubCardTemplateData extends BaseTemplateData {
}
private SubCardTemplateData(int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@NonNull Icon subCardIcon,
@Nullable Text subCardText,
@Nullable TapAction subCardAction) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
mSubCardIcon = subCardIcon;
mSubCardText = subCardText;
@@ -207,14 +192,9 @@ public final class SubCardTemplateData extends BaseTemplateData {
*/
@NonNull
public SubCardTemplateData build() {
- return new SubCardTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new SubCardTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mSubCardIcon,
mSubCardText,
mSubCardAction);
diff --git a/core/java/android/app/smartspace/uitemplatedata/SubImageTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/SubImageTemplateData.java
index 38692cd19df4..430d79c481ed 100644
--- a/core/java/android/app/smartspace/uitemplatedata/SubImageTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/SubImageTemplateData.java
@@ -60,32 +60,17 @@ public final class SubImageTemplateData extends BaseTemplateData {
}
private SubImageTemplateData(@SmartspaceTarget.UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@NonNull List<Text> subImageTexts,
@NonNull List<Icon> subImages,
@Nullable TapAction subImageAction) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
mSubImageTexts = subImageTexts;
mSubImages = subImages;
@@ -204,14 +189,9 @@ public final class SubImageTemplateData extends BaseTemplateData {
*/
@NonNull
public SubImageTemplateData build() {
- return new SubImageTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new SubImageTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mSubImageTexts,
mSubImages,
mSubImageAction);
diff --git a/core/java/android/app/smartspace/uitemplatedata/SubListTemplateData.java b/core/java/android/app/smartspace/uitemplatedata/SubListTemplateData.java
index b1535f1e3924..ae43fc48c907 100644
--- a/core/java/android/app/smartspace/uitemplatedata/SubListTemplateData.java
+++ b/core/java/android/app/smartspace/uitemplatedata/SubListTemplateData.java
@@ -59,32 +59,17 @@ public final class SubListTemplateData extends BaseTemplateData {
}
private SubListTemplateData(@SmartspaceTarget.UiTemplateType int templateType,
- @Nullable Text titleText,
- @Nullable Icon titleIcon,
- @Nullable Text subtitleText,
- @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,
+ @Nullable SubItemInfo primaryItem,
+ @Nullable SubItemInfo subtitleItem,
+ @Nullable SubItemInfo subtitleSupplementalItem,
+ @Nullable SubItemInfo supplementalLineItem,
+ @Nullable SubItemInfo supplementalAlarmItem,
int layoutWeight,
@Nullable Icon subListIcon,
@NonNull List<Text> subListTexts,
@Nullable TapAction subListAction) {
- super(templateType, titleText, titleIcon, subtitleText, subtitleIcon,
- primaryTapAction, primaryLoggingInfo,
- supplementalSubtitleText, supplementalSubtitleIcon,
- supplementalSubtitleTapAction, supplementalSubtitleLoggingInfo,
- supplementalText, supplementalIcon,
- supplementalTapAction, supplementalLoggingInfo,
- supplementalAlarmText, layoutWeight);
+ super(templateType, primaryItem, subtitleItem, subtitleSupplementalItem,
+ supplementalLineItem, supplementalAlarmItem, layoutWeight);
mSubListIcon = subListIcon;
mSubListTexts = subListTexts;
@@ -207,14 +192,9 @@ public final class SubListTemplateData extends BaseTemplateData {
*/
@NonNull
public SubListTemplateData build() {
- return new SubListTemplateData(getTemplateType(), getTitleText(),
- getTitleIcon(), getSubtitleText(), getSubtitleIcon(),
- getPrimaryTapAction(), getPrimaryLoggingInfo(),
- getSupplementalSubtitleText(), getSupplementalSubtitleIcon(),
- getSupplementalSubtitleTapAction(), getSupplementalSubtitleLoggingInfo(),
- getSupplementalText(), getSupplementalIcon(),
- getSupplementalTapAction(), getSupplementalLoggingInfo(),
- getSupplementalAlarmText(), getLayoutWeight(),
+ return new SubListTemplateData(getTemplateType(), getPrimaryItem(),
+ getSubtitleItem(), getSubtitleSupplemtnalItem(),
+ getSupplementalLineItem(), getSupplementalAlarmItem(), getLayoutWeight(),
mSubListIcon,
mSubListTexts,
mSubListAction);
diff --git a/core/java/android/app/smartspace/uitemplatedata/Text.java b/core/java/android/app/smartspace/uitemplatedata/Text.java
index e1afce7148ae..cb2f43202e90 100644
--- a/core/java/android/app/smartspace/uitemplatedata/Text.java
+++ b/core/java/android/app/smartspace/uitemplatedata/Text.java
@@ -109,6 +109,15 @@ public final class Text implements Parcelable {
out.writeInt(mMaxLines);
}
+ @Override
+ public String toString() {
+ return "Text{"
+ + "mText=" + mText
+ + ", mTruncateAtType=" + mTruncateAtType
+ + ", mMaxLines=" + mMaxLines
+ + '}';
+ }
+
/**
* A builder for {@link Text} object.
*