Allow change of maxLines per notification template
Bug: 166676684
Test: manual, robo tests
Change-Id: Ia5e90c5b407fbec314e355ea19b1075b5f1ffade
diff --git a/res/layout/basic_headsup_notification_template.xml b/res/layout/basic_headsup_notification_template.xml
index 7c8594d..4d7f847 100644
--- a/res/layout/basic_headsup_notification_template.xml
+++ b/res/layout/basic_headsup_notification_template.xml
@@ -53,6 +53,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/basic_notification_template.xml b/res/layout/basic_notification_template.xml
index 766f075..5dfcef6 100644
--- a/res/layout/basic_notification_template.xml
+++ b/res/layout/basic_notification_template.xml
@@ -55,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/basic_notification_template_inner.xml b/res/layout/basic_notification_template_inner.xml
index 6e958b3..0147755 100644
--- a/res/layout/basic_notification_template_inner.xml
+++ b/res/layout/basic_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -36,7 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<com.android.car.notification.template.CarNotificationActionsView
android:id="@+id/notification_actions"
diff --git a/res/layout/call_headsup_notification_template.xml b/res/layout/call_headsup_notification_template.xml
index b7a3d3e..e8173a2 100644
--- a/res/layout/call_headsup_notification_template.xml
+++ b/res/layout/call_headsup_notification_template.xml
@@ -55,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_below="@id/notification_header"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/call_notification_template.xml b/res/layout/call_notification_template.xml
index bc5e2e5..dcb3a68 100644
--- a/res/layout/call_notification_template.xml
+++ b/res/layout/call_notification_template.xml
@@ -56,6 +56,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_below="@id/notification_header"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_emergency_headsup_notification_template.xml b/res/layout/car_emergency_headsup_notification_template.xml
index f09ef5f..b2bca53 100644
--- a/res/layout/car_emergency_headsup_notification_template.xml
+++ b/res/layout/car_emergency_headsup_notification_template.xml
@@ -63,6 +63,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_emergency_notification_template.xml b/res/layout/car_emergency_notification_template.xml
index 0ef4294..2f89f4e 100644
--- a/res/layout/car_emergency_notification_template.xml
+++ b/res/layout/car_emergency_notification_template.xml
@@ -58,6 +58,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_emergency_notification_template_inner.xml b/res/layout/car_emergency_notification_template_inner.xml
index c73706c..dc3b1c5 100644
--- a/res/layout/car_emergency_notification_template_inner.xml
+++ b/res/layout/car_emergency_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -45,7 +46,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<com.android.car.notification.template.CarNotificationActionsView
android:id="@+id/notification_actions"
diff --git a/res/layout/car_information_headsup_notification_template.xml b/res/layout/car_information_headsup_notification_template.xml
index 698b93b..8098bb4 100644
--- a/res/layout/car_information_headsup_notification_template.xml
+++ b/res/layout/car_information_headsup_notification_template.xml
@@ -65,6 +65,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_information_notification_template.xml b/res/layout/car_information_notification_template.xml
index be7676c..b842af3 100644
--- a/res/layout/car_information_notification_template.xml
+++ b/res/layout/car_information_notification_template.xml
@@ -64,6 +64,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_information_notification_template_inner.xml b/res/layout/car_information_notification_template_inner.xml
index 1755ff8..f8eacc2 100644
--- a/res/layout/car_information_notification_template_inner.xml
+++ b/res/layout/car_information_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -45,7 +46,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<com.android.car.notification.template.CarNotificationActionsView
android:id="@+id/notification_actions"
diff --git a/res/layout/car_warning_headsup_notification_template.xml b/res/layout/car_warning_headsup_notification_template.xml
index 698b93b..8098bb4 100644
--- a/res/layout/car_warning_headsup_notification_template.xml
+++ b/res/layout/car_warning_headsup_notification_template.xml
@@ -65,6 +65,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_warning_notification_template.xml b/res/layout/car_warning_notification_template.xml
index c3197aa..f74b129 100644
--- a/res/layout/car_warning_notification_template.xml
+++ b/res/layout/car_warning_notification_template.xml
@@ -59,6 +59,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/car_warning_notification_template_inner.xml b/res/layout/car_warning_notification_template_inner.xml
index c73706c..dc3b1c5 100644
--- a/res/layout/car_warning_notification_template_inner.xml
+++ b/res/layout/car_warning_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -45,7 +46,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<com.android.car.notification.template.CarNotificationActionsView
android:id="@+id/notification_actions"
diff --git a/res/layout/inbox_headsup_notification_template.xml b/res/layout/inbox_headsup_notification_template.xml
index 35661e2..6c5ed7f 100644
--- a/res/layout/inbox_headsup_notification_template.xml
+++ b/res/layout/inbox_headsup_notification_template.xml
@@ -56,6 +56,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/inbox_notification_template.xml b/res/layout/inbox_notification_template.xml
index 5875f6e..8ce834a 100644
--- a/res/layout/inbox_notification_template.xml
+++ b/res/layout/inbox_notification_template.xml
@@ -55,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/inbox_notification_template_inner.xml b/res/layout/inbox_notification_template_inner.xml
index f1f2b88..105a199 100644
--- a/res/layout/inbox_notification_template_inner.xml
+++ b/res/layout/inbox_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -36,7 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<com.android.car.notification.template.CarNotificationActionsView
android:id="@+id/notification_actions"
diff --git a/res/layout/media_notification_template_inner.xml b/res/layout/media_notification_template_inner.xml
index b85a7df..d7bd516 100644
--- a/res/layout/media_notification_template_inner.xml
+++ b/res/layout/media_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -36,7 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/card_body_margin_bottom"/>
+ android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<LinearLayout
android:id="@+id/action_bar"
diff --git a/res/layout/message_headsup_notification_template.xml b/res/layout/message_headsup_notification_template.xml
index 7745977..3f3c541 100644
--- a/res/layout/message_headsup_notification_template.xml
+++ b/res/layout/message_headsup_notification_template.xml
@@ -55,6 +55,7 @@
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_toStartOf="@id/message_count"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
<TextView
diff --git a/res/layout/message_notification_template.xml b/res/layout/message_notification_template.xml
index ca200c3..567dc6d 100644
--- a/res/layout/message_notification_template.xml
+++ b/res/layout/message_notification_template.xml
@@ -75,6 +75,7 @@
android:layout_alignParentStart="true"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_toStartOf="@id/message_count"
+ android:maxLines="@integer/config_notificationPanelMaxBodyLines"
style="@style/NotificationBodyContentText"/>
<TextView
diff --git a/res/layout/message_notification_template_inner.xml b/res/layout/message_notification_template_inner.xml
index 36e932f..d648524 100644
--- a/res/layout/message_notification_template_inner.xml
+++ b/res/layout/message_notification_template_inner.xml
@@ -74,6 +74,7 @@
android:layout_alignParentStart="true"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_toStartOf="@id/message_count"
+ android:maxLines="@integer/config_notificationPanelMaxBodyLines"
style="@style/NotificationBodyContentText"/>
<TextView
diff --git a/res/layout/navigation_headsup_notification_template.xml b/res/layout/navigation_headsup_notification_template.xml
index e918bed..4a06c68 100644
--- a/res/layout/navigation_headsup_notification_template.xml
+++ b/res/layout/navigation_headsup_notification_template.xml
@@ -53,6 +53,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
+ app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="true"/>
<com.android.car.notification.template.CarNotificationActionsView
diff --git a/res/layout/progress_notification_template.xml b/res/layout/progress_notification_template.xml
index 13f2c40..091ad42 100644
--- a/res/layout/progress_notification_template.xml
+++ b/res/layout/progress_notification_template.xml
@@ -55,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
android:layout_marginBottom="@dimen/item_spacing"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
<ProgressBar
diff --git a/res/layout/progress_notification_template_inner.xml b/res/layout/progress_notification_template_inner.xml
index ab3b902..4e94518 100644
--- a/res/layout/progress_notification_template_inner.xml
+++ b/res/layout/progress_notification_template_inner.xml
@@ -16,6 +16,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/inner_template_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -36,7 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/notification_header"
- android:layout_marginBottom="@dimen/item_spacing"/>
+ android:layout_marginBottom="@dimen/item_spacing"
+ app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
<ProgressBar
android:id="@+id/progress_bar"
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 507b821..eda49ef 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -20,6 +20,7 @@
</declare-styleable>
<declare-styleable name="CarNotificationBodyView">
<attr name="showBigIcon" format="boolean"/>
+ <attr name="maxLines" format="integer"/>
</declare-styleable>
<declare-styleable name="CarNotificationActionsView">
<attr name="categoryCall" format="boolean"/>
diff --git a/src/com/android/car/notification/NotificationUtils.java b/src/com/android/car/notification/NotificationUtils.java
index 503593b..8c3c8b0 100644
--- a/src/com/android/car/notification/NotificationUtils.java
+++ b/src/com/android/car/notification/NotificationUtils.java
@@ -156,14 +156,6 @@
return Color.luminance(backgroundColor) > LIGHT_COLOR_LUMINANCE_THRESHOLD;
}
- public static int getMaxNotificationBodyLines(Context context, boolean isHeadsUp) {
- if (isHeadsUp) {
- return context.getResources().getInteger(
- R.integer.config_headsUpNotificationMaxBodyLines);
- }
- return context.getResources().getInteger(R.integer.config_notificationPanelMaxBodyLines);
- }
-
private static boolean isSystemPrivilegedOrPlatformKeyInner(Context context,
AlertEntry alertEntry, boolean checkForPrivilegedApp) {
PackageInfo packageInfo = getPackageInfo(context, alertEntry.getStatusBarNotification());
diff --git a/src/com/android/car/notification/template/BasicNotificationViewHolder.java b/src/com/android/car/notification/template/BasicNotificationViewHolder.java
index 6566a60..150d6e7 100644
--- a/src/com/android/car/notification/template/BasicNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/BasicNotificationViewHolder.java
@@ -50,7 +50,7 @@
public void bind(AlertEntry alertEntry, boolean isInGroup,
boolean isHeadsUp) {
super.bind(alertEntry, isInGroup, isHeadsUp);
- bindBody(alertEntry, isHeadsUp);
+ bindBody(alertEntry);
mHeaderView.bind(alertEntry, isInGroup);
mActionsView.bind(mClickHandlerFactory, alertEntry);
}
@@ -58,12 +58,12 @@
/**
* Private method that binds the data to the view.
*/
- private void bindBody(AlertEntry alertEntry, boolean isHeadsUp) {
+ private void bindBody(AlertEntry alertEntry) {
Notification notification = alertEntry.getNotification();
Bundle extraData = notification.extras;
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_TEXT);
Icon icon = notification.getLargeIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
}
}
diff --git a/src/com/android/car/notification/template/CallNotificationViewHolder.java b/src/com/android/car/notification/template/CallNotificationViewHolder.java
index a7c5909..6c2156c 100644
--- a/src/com/android/car/notification/template/CallNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/CallNotificationViewHolder.java
@@ -50,7 +50,7 @@
public void bind(AlertEntry alertEntry, boolean isInGroup,
boolean isHeadsUp) {
super.bind(alertEntry, isInGroup, isHeadsUp);
- bindBody(alertEntry, isHeadsUp);
+ bindBody(alertEntry);
mHeaderView.bind(alertEntry, isInGroup);
mActionsView.bind(mClickHandlerFactory, alertEntry);
}
@@ -58,12 +58,12 @@
/**
* Private method that binds the data to the view.
*/
- private void bindBody(AlertEntry alertEntry, boolean isHeadsUp) {
+ private void bindBody(AlertEntry alertEntry) {
Notification notification = alertEntry.getNotification();
Bundle extraData = notification.extras;
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_TEXT);
Icon icon = notification.getSmallIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
}
}
diff --git a/src/com/android/car/notification/template/CarNotificationBodyView.java b/src/com/android/car/notification/template/CarNotificationBodyView.java
index e2b7001..827ce48 100644
--- a/src/com/android/car/notification/template/CarNotificationBodyView.java
+++ b/src/com/android/car/notification/template/CarNotificationBodyView.java
@@ -16,8 +16,6 @@
package com.android.car.notification.template;
-import static com.android.car.notification.NotificationUtils.getMaxNotificationBodyLines;
-
import android.annotation.ColorInt;
import android.annotation.Nullable;
import android.content.Context;
@@ -43,11 +41,13 @@
* the content is the message, and the image icon is the sender's avatar.
*/
public class CarNotificationBodyView extends RelativeLayout {
+ private static final int DEFAULT_MAX_LINES = 1;
@ColorInt
private final int mDefaultPrimaryTextColor;
@ColorInt
private final int mDefaultSecondaryTextColor;
private boolean mShowBigIcon;
+ private int mMaxLines;
private TextView mTitleView;
private TextView mContentView;
private ImageView mIconView;
@@ -86,6 +86,8 @@
mShowBigIcon =
attributes.getBoolean(R.styleable.CarNotificationBodyView_showBigIcon,
/* defValue= */ false);
+ mMaxLines = attributes.getInteger(R.styleable.CarNotificationBodyView_maxLines,
+ /* defValue= */ DEFAULT_MAX_LINES);
attributes.recycle();
}
@@ -103,10 +105,8 @@
* @param title the primary text.
* @param content the secondary text.
* @param icon the large icon, usually used for avatars.
- * @param isHeadsUp true if the notification is a HUN
*/
- public void bind(CharSequence title, @Nullable CharSequence content, @Nullable Icon icon,
- boolean isHeadsUp) {
+ public void bind(CharSequence title, @Nullable CharSequence content, @Nullable Icon icon) {
setVisibility(View.VISIBLE);
mTitleView.setVisibility(View.VISIBLE);
@@ -114,7 +114,7 @@
if (!TextUtils.isEmpty(content)) {
mContentView.setVisibility(View.VISIBLE);
- mContentView.setMaxLines(getMaxNotificationBodyLines(getContext(), isHeadsUp));
+ mContentView.setMaxLines(mMaxLines);
mContentView.setText(content);
}
@@ -124,15 +124,14 @@
}
}
- public void bindHUNTitleAndMessage(CharSequence title, CharSequence content) {
+ public void bindTitleAndMessage(CharSequence title, CharSequence content) {
setVisibility(View.VISIBLE);
mTitleView.setVisibility(View.VISIBLE);
mTitleView.setText(title);
if (!TextUtils.isEmpty(content)) {
mContentView.setVisibility(View.VISIBLE);
- mContentView.setMaxLines(
- getMaxNotificationBodyLines(getContext(), /* isHeadsUp= */ true));
+ mContentView.setMaxLines(mMaxLines);
mContentView.setText(content);
mIconView.setVisibility(View.GONE);
}
diff --git a/src/com/android/car/notification/template/EmergencyNotificationViewHolder.java b/src/com/android/car/notification/template/EmergencyNotificationViewHolder.java
index d28d5e0..4af8b02 100644
--- a/src/com/android/car/notification/template/EmergencyNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/EmergencyNotificationViewHolder.java
@@ -73,6 +73,6 @@
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_TEXT);
Icon icon = notification.getLargeIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
}
}
diff --git a/src/com/android/car/notification/template/InboxNotificationViewHolder.java b/src/com/android/car/notification/template/InboxNotificationViewHolder.java
index 6730c1b..24ec793 100644
--- a/src/com/android/car/notification/template/InboxNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/InboxNotificationViewHolder.java
@@ -50,7 +50,7 @@
public void bind(AlertEntry alertEntry, boolean isInGroup,
boolean isHeadsUp) {
super.bind(alertEntry, isInGroup, isHeadsUp);
- bindBody(alertEntry, isHeadsUp);
+ bindBody(alertEntry);
mHeaderView.bind(alertEntry, isInGroup);
mActionsView.bind(mClickHandlerFactory, alertEntry);
}
@@ -58,12 +58,12 @@
/**
* Private method that binds the data to the view.
*/
- private void bindBody(AlertEntry alertEntry, boolean isHeadsUp) {
+ private void bindBody(AlertEntry alertEntry) {
Notification notification = alertEntry.getNotification();
Bundle extraData = notification.extras;
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE_BIG);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_SUMMARY_TEXT);
Icon icon = notification.getLargeIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
}
}
diff --git a/src/com/android/car/notification/template/MessageNotificationViewHolder.java b/src/com/android/car/notification/template/MessageNotificationViewHolder.java
index 22786d2..c06d062 100644
--- a/src/com/android/car/notification/template/MessageNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/MessageNotificationViewHolder.java
@@ -15,8 +15,6 @@
*/
package com.android.car.notification.template;
-import static com.android.car.notification.NotificationUtils.getMaxNotificationBodyLines;
-
import android.annotation.ColorInt;
import android.app.Notification;
import android.app.Person;
@@ -171,7 +169,6 @@
if (!TextUtils.isEmpty(messageText)) {
messageText = PreprocessingManager.getInstance(mContext).trimText(messageText);
mMessageView.setVisibility(View.VISIBLE);
- mMessageView.setMaxLines(getMaxNotificationBodyLines(mContext, isHeadsUp));
mMessageView.setText(messageText);
}
@@ -190,7 +187,7 @@
}
if (isHeadsUp) {
- mBodyView.bindHUNTitleAndMessage(conversationTitle, messageText);
+ mBodyView.bindTitleAndMessage(conversationTitle, messageText);
}
}
diff --git a/src/com/android/car/notification/template/NavigationNotificationViewHolder.java b/src/com/android/car/notification/template/NavigationNotificationViewHolder.java
index 9afd369..936daf5 100644
--- a/src/com/android/car/notification/template/NavigationNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/NavigationNotificationViewHolder.java
@@ -50,7 +50,7 @@
public void bind(AlertEntry alertEntry, boolean isInGroup,
boolean isHeadsUp) {
super.bind(alertEntry, isInGroup, isHeadsUp);
- bindBody(alertEntry, isHeadsUp);
+ bindBody(alertEntry);
mHeaderView.bind(alertEntry, isInGroup);
mActionsView.bind(mClickHandlerFactory, alertEntry);
}
@@ -58,12 +58,12 @@
/**
* Private method that binds the data to the view.
*/
- private void bindBody(AlertEntry alertEntry, boolean isHeadsUp) {
+ private void bindBody(AlertEntry alertEntry) {
Notification notification = alertEntry.getNotification();
Bundle extraData = notification.extras;
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_TEXT);
Icon icon = notification.getLargeIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
}
}
diff --git a/src/com/android/car/notification/template/ProgressNotificationViewHolder.java b/src/com/android/car/notification/template/ProgressNotificationViewHolder.java
index 1941f83..32f7bfd 100644
--- a/src/com/android/car/notification/template/ProgressNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/ProgressNotificationViewHolder.java
@@ -60,7 +60,7 @@
public void bind(AlertEntry alertEntry, boolean isInGroup,
boolean isHeadsUp) {
super.bind(alertEntry, isInGroup, isHeadsUp);
- bindBody(alertEntry, isHeadsUp);
+ bindBody(alertEntry);
mHeaderView.bind(alertEntry, isInGroup);
mActionsView.bind(mClickHandlerFactory, alertEntry);
}
@@ -68,14 +68,14 @@
/**
* Private method that binds the data to the view.
*/
- private void bindBody(AlertEntry alertEntry, boolean isHeadsUp) {
+ private void bindBody(AlertEntry alertEntry) {
Notification notification = alertEntry.getNotification();
Bundle extraData = notification.extras;
CharSequence title = extraData.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = extraData.getCharSequence(Notification.EXTRA_TEXT);
Icon icon = notification.getLargeIcon();
- mBodyView.bind(title, text, icon, isHeadsUp);
+ mBodyView.bind(title, text, icon);
mProgressBarView.setVisibility(View.VISIBLE);
boolean isIndeterminate = extraData.getBoolean(Notification.EXTRA_PROGRESS_INDETERMINATE);
diff --git a/tests/robotests/src/com/android/car/notification/NotificationUtilsTest.java b/tests/robotests/src/com/android/car/notification/NotificationUtilsTest.java
index c9bfe96..9c70aee 100644
--- a/tests/robotests/src/com/android/car/notification/NotificationUtilsTest.java
+++ b/tests/robotests/src/com/android/car/notification/NotificationUtilsTest.java
@@ -213,22 +213,6 @@
CarNotificationTypeItem.BASIC);
}
- @Test
- public void getMaxNotificationBodyLines_HUN_returnsCorrectValue() {
- int maxLines = mContext.getResources().getInteger(
- R.integer.config_headsUpNotificationMaxBodyLines);
- assertThat(NotificationUtils.getMaxNotificationBodyLines(mContext, /* isHeadsUp= */ true))
- .isEqualTo(maxLines);
- }
-
- @Test
- public void getMaxNotificationBodyLines_panel_returnsCorrectValue() {
- int maxLines = mContext.getResources().getInteger(
- R.integer.config_notificationPanelMaxBodyLines);
- assertThat(NotificationUtils.getMaxNotificationBodyLines(mContext, /* isHeadsUp= */ false))
- .isEqualTo(maxLines);
- }
-
private void setApplicationInfo(boolean signedWithPlatformKey, boolean isSystemApp,
boolean isPrivilegedApp) {
ApplicationInfo applicationInfo = new ApplicationInfo();
diff --git a/tests/robotests/src/com/android/car/notification/template/CarNotificationBodyViewTest.java b/tests/robotests/src/com/android/car/notification/template/CarNotificationBodyViewTest.java
index 4e46ddd..acc5cde 100644
--- a/tests/robotests/src/com/android/car/notification/template/CarNotificationBodyViewTest.java
+++ b/tests/robotests/src/com/android/car/notification/template/CarNotificationBodyViewTest.java
@@ -52,53 +52,25 @@
@Test
public void onBind_titleTextSet() {
- mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null,
- /* isHeadsUp= */ false);
+ mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null);
assertThat(mCarNotificationBodyView.getTitleView().getText()).isEqualTo(TEST_TITLE);
}
@Test
public void onBind_contentTextSet() {
- mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null,
- /* isHeadsUp= */ false);
+ mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null);
assertThat(mCarNotificationBodyView.getContentView().getText()).isEqualTo(TEST_BODY);
}
@Test
- public void onBind_isHUN_showsCorrectNumberOfLines() {
- mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null,
- /* isHeadsUp= */ true);
- assertThat(mCarNotificationBodyView.getContentView().getMaxLines()).isEqualTo(
- mContext.getResources().getInteger(
- R.integer.config_headsUpNotificationMaxBodyLines));
- }
-
- @Test
- public void onBind_isPanel_showsCorrectNumberOfLines() {
- mCarNotificationBodyView.bind(TEST_TITLE, TEST_BODY, /* icon= */ null,
- /* isHeadsUp= */ false);
- assertThat(mCarNotificationBodyView.getContentView().getMaxLines()).isEqualTo(
- mContext.getResources().getInteger(
- R.integer.config_notificationPanelMaxBodyLines));
- }
-
- @Test
public void onBindTitleAndMessage_titleTextSet() {
- mCarNotificationBodyView.bindHUNTitleAndMessage(TEST_TITLE, TEST_BODY);
+ mCarNotificationBodyView.bindTitleAndMessage(TEST_TITLE, TEST_BODY);
assertThat(mCarNotificationBodyView.getTitleView().getText()).isEqualTo(TEST_TITLE);
}
@Test
public void onBindTitleAndMessage_contentTextSet() {
- mCarNotificationBodyView.bindHUNTitleAndMessage(TEST_TITLE, TEST_BODY);
+ mCarNotificationBodyView.bindTitleAndMessage(TEST_TITLE, TEST_BODY);
assertThat(mCarNotificationBodyView.getContentView().getText()).isEqualTo(TEST_BODY);
}
-
- @Test
- public void onBindTitleAndMessage_showsCorrectNumberOfLines() {
- mCarNotificationBodyView.bindHUNTitleAndMessage(TEST_TITLE, TEST_BODY);
- assertThat(mCarNotificationBodyView.getContentView().getMaxLines()).isEqualTo(
- mContext.getResources().getInteger(
- R.integer.config_headsUpNotificationMaxBodyLines));
- }
}