diff options
-rw-r--r-- | core/java/android/app/Notification.java | 31 | ||||
-rw-r--r-- | core/res/res/layout/notification_action_list.xml | 1 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_base.xml | 26 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_big_base.xml | 35 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_big_picture.xml | 1 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_big_text.xml | 44 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_inbox.xml | 56 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 9 |
9 files changed, 130 insertions, 76 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 3ced82b..036008b 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1379,7 +1379,7 @@ public class Notification implements Parcelable } } - private RemoteViews applyStandardTemplate(int resId) { + private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) { RemoteViews contentView = new RemoteViews(mContext.getPackageName(), resId); boolean showLine3 = false; boolean showLine2 = false; @@ -1432,7 +1432,6 @@ public class Notification implements Parcelable contentView.setTextViewText(R.id.text, mSubText); if (mContentText != null) { contentView.setTextViewText(R.id.text2, mContentText); - // need to shrink all the type to make sure everything fits contentView.setViewVisibility(R.id.text2, View.VISIBLE); showLine2 = true; } else { @@ -1450,10 +1449,13 @@ public class Notification implements Parcelable } } if (showLine2) { - final Resources res = mContext.getResources(); - final float subTextSize = res.getDimensionPixelSize( - R.dimen.notification_subtext_size); - contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize); + if (fitIn1U) { + // need to shrink all the type to make sure everything fits + final Resources res = mContext.getResources(); + final float subTextSize = res.getDimensionPixelSize( + R.dimen.notification_subtext_size); + contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize); + } // vertical centering contentView.setViewPadding(R.id.line1, 0, 0, 0, 0); } @@ -1470,16 +1472,18 @@ public class Notification implements Parcelable } } contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE); + contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE); return contentView; } private RemoteViews applyStandardTemplateWithActions(int layoutId) { - RemoteViews big = applyStandardTemplate(layoutId); + RemoteViews big = applyStandardTemplate(layoutId, false); int N = mActions.size(); if (N > 0) { // Log.d("Notification", "has actions: " + mContentText); big.setViewVisibility(R.id.actions, View.VISIBLE); + big.setViewVisibility(R.id.action_divider, View.VISIBLE); if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS; big.removeAllViews(R.id.actions); for (int i=0; i<N; i++) { @@ -1495,7 +1499,7 @@ public class Notification implements Parcelable if (mContentView != null) { return mContentView; } else { - return applyStandardTemplate(R.layout.notification_template_base); // no more special large_icon flavor + return applyStandardTemplate(R.layout.notification_template_base, true); // no more special large_icon flavor } } @@ -1506,7 +1510,7 @@ public class Notification implements Parcelable if (mContentView == null) { return applyStandardTemplate(mLargeIcon == null ? R.layout.status_bar_latest_event_ticker - : R.layout.status_bar_latest_event_ticker_large_icon); + : R.layout.status_bar_latest_event_ticker_large_icon, true); } else { return null; } @@ -1655,12 +1659,9 @@ public class Notification implements Parcelable contentView.setViewVisibility(R.id.line1, View.VISIBLE); } + // The last line defaults to the content text or subtext, but can be replaced by mSummaryText if (mSummaryText != null && !mSummaryText.equals("")) { - contentView.setViewVisibility(R.id.overflow_title, View.VISIBLE); - contentView.setTextViewText(R.id.overflow_title, mSummaryText); - contentView.setViewVisibility(R.id.line3, View.GONE); - } else { - contentView.setViewVisibility(R.id.overflow_title, View.GONE); + contentView.setTextViewText(R.id.text, mSummaryText); contentView.setViewVisibility(R.id.line3, View.VISIBLE); } @@ -1801,6 +1802,8 @@ public class Notification implements Parcelable } private RemoteViews makeBigContentView() { + // Remove the content text so line3 disappears entirely + mBuilder.mContentText = null; RemoteViews contentView = getStandardView(R.layout.notification_template_big_text); contentView.setTextViewText(R.id.big_text, mBigText); contentView.setViewVisibility(R.id.big_text, View.VISIBLE); diff --git a/core/res/res/layout/notification_action_list.xml b/core/res/res/layout/notification_action_list.xml index fa0a8c8..591c9ea 100644 --- a/core/res/res/layout/notification_action_list.xml +++ b/core/res/res/layout/notification_action_list.xml @@ -23,6 +23,7 @@ android:visibility="gone" android:showDividers="middle" android:divider="?android:attr/listDivider" + android:dividerPadding="12dp" > <!-- actions will be added here --> </LinearLayout> diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml index ed680a9..47bbbde 100644 --- a/core/res/res/layout/notification_template_base.xml +++ b/core/res/res/layout/notification_template_base.xml @@ -36,8 +36,7 @@ android:layout_marginLeft="@dimen/notification_large_icon_width" android:minHeight="@dimen/notification_large_icon_height" android:orientation="vertical" - android:paddingLeft="12dp" - android:paddingRight="12dp" + android:paddingRight="8dp" android:paddingTop="2dp" android:paddingBottom="2dp" android:gravity="top" @@ -47,6 +46,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="6dp" + android:layout_marginLeft="8dp" android:orientation="horizontal" > <TextView android:id="@+id/title" @@ -81,6 +81,7 @@ android:layout_height="wrap_content" android:layout_marginTop="-2dp" android:layout_marginBottom="-2dp" + android:layout_marginLeft="8dp" android:singleLine="true" android:fadingEdge="horizontal" android:ellipsize="marquee" @@ -90,24 +91,17 @@ android:id="@android:id/progress" android:layout_width="match_parent" android:layout_height="12dp" + android:layout_marginLeft="8dp" android:visibility="gone" style="?android:attr/progressBarStyleHorizontal" /> - <TextView android:id="@+id/overflow_title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:visibility="gone" - android:layout_weight="1" - /> <LinearLayout android:id="@+id/line3" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginLeft="8dp" > <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" @@ -130,14 +124,14 @@ android:paddingLeft="8dp" /> <ImageView android:id="@+id/right_icon" - android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_width="16dp" + android:layout_height="16dp" android:layout_gravity="center" android:layout_weight="0" + android:layout_marginLeft="8dp" android:scaleType="centerInside" - android:paddingLeft="8dp" android:visibility="gone" - android:drawableAlpha="180" + android:drawableAlpha="153" /> </LinearLayout> </LinearLayout> diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml index f2c204f..69f0a24 100644 --- a/core/res/res/layout/notification_template_big_base.xml +++ b/core/res/res/layout/notification_template_big_base.xml @@ -33,19 +33,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" - android:layout_marginLeft="@dimen/notification_large_icon_width" android:minHeight="@dimen/notification_large_icon_height" android:orientation="vertical" - android:paddingLeft="12dp" - android:paddingRight="12dp" - android:paddingTop="2dp" - android:paddingBottom="2dp" android:gravity="top" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/notification_large_icon_width" android:minHeight="@dimen/notification_large_icon_height" + android:paddingTop="2dp" android:orientation="vertical" > <LinearLayout @@ -53,6 +50,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="6dp" + android:layout_marginRight="8dp" + android:layout_marginLeft="8dp" android:orientation="horizontal" > <TextView android:id="@+id/title" @@ -87,6 +86,8 @@ android:layout_height="wrap_content" android:layout_marginTop="-2dp" android:layout_marginBottom="-2dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:fadingEdge="horizontal" android:ellipsize="marquee" @@ -96,6 +97,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="false" android:visibility="gone" /> @@ -103,7 +106,10 @@ android:id="@+id/line3" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:orientation="horizontal" + android:gravity="center_vertical" > <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" @@ -126,29 +132,38 @@ android:paddingLeft="8dp" /> <ImageView android:id="@+id/right_icon" - android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_width="16dp" + android:layout_height="16dp" android:layout_gravity="center" android:layout_weight="0" + android:layout_marginLeft="8dp" android:scaleType="centerInside" - android:paddingLeft="8dp" android:visibility="gone" - android:drawableAlpha="180" + android:drawableAlpha="153" /> </LinearLayout> <ProgressBar android:id="@android:id/progress" android:layout_width="match_parent" android:layout_height="12dp" + android:layout_marginBottom="8dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:visibility="gone" style="?android:attr/progressBarStyleHorizontal" /> </LinearLayout> + <ImageView + android:layout_width="match_parent" + android:layout_height="1px" + android:id="@+id/action_divider" + android:visibility="gone" + android:background="?android:attr/dividerHorizontal" /> <include layout="@layout/notification_action_list" - android:id="@+id/actions" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/notification_large_icon_width" /> </LinearLayout> </FrameLayout> diff --git a/core/res/res/layout/notification_template_big_picture.xml b/core/res/res/layout/notification_template_big_picture.xml index 077616e..ecb3616 100644 --- a/core/res/res/layout/notification_template_big_picture.xml +++ b/core/res/res/layout/notification_template_big_picture.xml @@ -53,7 +53,6 @@ <include layout="@layout/notification_action_list" android:id="@+id/actions" - android:layout_marginLeft="8dp" android:layout_gravity="bottom" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml index 304f2b5..b86177e 100644 --- a/core/res/res/layout/notification_template_big_text.xml +++ b/core/res/res/layout/notification_template_big_text.xml @@ -34,8 +34,6 @@ android:layout_gravity="fill_vertical" android:layout_marginLeft="@dimen/notification_large_icon_width" android:orientation="vertical" - android:paddingLeft="12dp" - android:paddingRight="12dp" android:paddingTop="2dp" android:paddingBottom="2dp" android:gravity="top" @@ -44,6 +42,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:layout_weight="1" > <LinearLayout @@ -87,6 +87,7 @@ android:layout_height="wrap_content" android:layout_marginTop="-2dp" android:layout_marginBottom="-2dp" + android:layout_marginRight="8dp" android:singleLine="true" android:fadingEdge="horizontal" android:ellipsize="marquee" @@ -97,6 +98,8 @@ android:id="@android:id/progress" android:layout_width="match_parent" android:layout_height="12dp" + android:layout_marginBottom="8dp" + android:layout_marginRight="8dp" android:visibility="gone" android:layout_weight="0" style="?android:attr/progressBarStyleHorizontal" @@ -105,7 +108,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_marginBottom="2dp" + android:layout_marginBottom="8dp" + android:layout_marginRight="8dp" android:singleLine="false" android:visibility="gone" android:maxLines="8" @@ -113,6 +117,13 @@ android:layout_weight="1" /> </LinearLayout> + <ImageView + android:layout_width="match_parent" + android:layout_height="1dip" + android:layout_marginTop="-1px" + android:id="@+id/action_divider" + android:visibility="gone" + android:background="?android:attr/dividerHorizontal" /> <include layout="@layout/notification_action_list" android:layout_width="match_parent" @@ -120,22 +131,23 @@ android:visibility="gone" android:layout_weight="1" /> - <TextView android:id="@+id/overflow_title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" + <ImageView android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" - android:visibility="gone" - android:layout_weight="0" - /> + android:layout_height="1px" + android:id="@+id/overflow_divider" + android:layout_marginBottom="8dp" + android:visibility="visible" + android:background="?android:attr/dividerHorizontal" /> <LinearLayout android:id="@+id/line3" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginBottom="8dp" + android:layout_marginRight="8dp" android:orientation="horizontal" android:layout_weight="0" + android:gravity="center_vertical" > <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" @@ -158,14 +170,14 @@ android:paddingLeft="8dp" /> <ImageView android:id="@+id/right_icon" - android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_width="16dp" + android:layout_height="16dp" android:layout_gravity="center" android:layout_weight="0" + android:layout_marginLeft="8dp" android:scaleType="centerInside" - android:paddingLeft="8dp" android:visibility="gone" - android:drawableAlpha="180" + android:drawableAlpha="153" /> </LinearLayout> </LinearLayout> diff --git a/core/res/res/layout/notification_template_inbox.xml b/core/res/res/layout/notification_template_inbox.xml index 121a81c..e9a3686 100644 --- a/core/res/res/layout/notification_template_inbox.xml +++ b/core/res/res/layout/notification_template_inbox.xml @@ -36,8 +36,6 @@ android:layout_marginLeft="@dimen/notification_large_icon_width" android:minHeight="@dimen/notification_large_icon_height" android:orientation="vertical" - android:paddingLeft="12dp" - android:paddingRight="12dp" android:paddingTop="2dp" android:paddingBottom="2dp" android:gravity="top" @@ -46,6 +44,8 @@ android:id="@+id/line1" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:paddingTop="6dp" android:orientation="horizontal" android:layout_weight="0" @@ -82,6 +82,8 @@ android:layout_height="wrap_content" android:layout_marginTop="-2dp" android:layout_marginBottom="-2dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:fadingEdge="horizontal" android:ellipsize="marquee" @@ -92,6 +94,8 @@ android:id="@android:id/progress" android:layout_width="match_parent" android:layout_height="12dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:visibility="gone" android:layout_weight="0" style="?android:attr/progressBarStyleHorizontal" @@ -100,6 +104,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -109,6 +115,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -118,6 +126,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -127,6 +137,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -136,6 +148,7 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -145,6 +158,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -154,6 +169,8 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" @@ -163,35 +180,44 @@ android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" android:singleLine="true" android:ellipsize="end" android:visibility="gone" android:layout_weight="1" android:text="@android:string/ellipsis" /> + <ImageView + android:layout_width="match_parent" + android:layout_height="1px" + android:id="@+id/overflow_divider" + android:layout_marginTop="8dp" + android:visibility="visible" + android:background="?android:attr/dividerHorizontal" /> <include layout="@layout/notification_action_list" - android:id="@+id/actions" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" /> - <TextView android:id="@+id/overflow_title" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent" + <ImageView android:layout_width="match_parent" - android:layout_height="wrap_content" - android:singleLine="true" - android:ellipsize="marquee" - android:fadingEdge="horizontal" + android:layout_height="1px" + android:id="@+id/action_divider" android:visibility="gone" - android:layout_weight="0" - /> + android:background="?android:attr/dividerHorizontal" /><!-- note: divider below actions --> <LinearLayout android:id="@+id/line3" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginLeft="8dp" + android:layout_marginBottom="8dp" + android:layout_marginRight="8dp" android:orientation="horizontal" android:layout_weight="0" + android:gravity="center_vertical" > <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" @@ -214,14 +240,14 @@ android:paddingLeft="8dp" /> <ImageView android:id="@+id/right_icon" - android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_width="16dp" + android:layout_height="16dp" android:layout_gravity="center" android:layout_weight="0" + android:layout_marginLeft="8dp" android:scaleType="centerInside" - android:paddingLeft="8dp" android:visibility="gone" - android:drawableAlpha="180" + android:drawableAlpha="153" /> </LinearLayout> </LinearLayout> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 4cfbff5..53031e7 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -122,7 +122,6 @@ <java-symbol type="id" name="old_app_action" /> <java-symbol type="id" name="old_app_description" /> <java-symbol type="id" name="old_app_icon" /> - <java-symbol type="id" name="overflow_title" /> <java-symbol type="id" name="package_label" /> <java-symbol type="id" name="packages_list" /> <java-symbol type="id" name="pause" /> @@ -212,6 +211,8 @@ <java-symbol type="id" name="inbox_text6" /> <java-symbol type="id" name="inbox_more" /> <java-symbol type="id" name="status_bar_latest_event_content" /> + <java-symbol type="id" name="action_divider" /> + <java-symbol type="id" name="overflow_divider" /> <java-symbol type="attr" name="actionModeShareDrawable" /> <java-symbol type="attr" name="alertDialogCenterButtons" /> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index a54cdf1..223d17a 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -239,7 +239,7 @@ please see styles_device_defaults.xml. </style> <!-- Notification content styles --> <style name="TextAppearance.StatusBar.EventContent"> - <item name="android:textColor">#808080</item> + <item name="android:textColor">#999999</item> <item name="android:textSize">@dimen/notification_text_size</item> </style> <style name="TextAppearance.StatusBar.EventContent.Title"> @@ -253,11 +253,14 @@ please see styles_device_defaults.xml. </style> <style name="TextAppearance.StatusBar.EventContent.Info"> <item name="android:textSize">@dimen/notification_subtext_size</item> - <item name="android:textColor">#666666</item> + <item name="android:textColor">#999999</item> </style> <style name="TextAppearance.StatusBar.EventContent.Time"> <item name="android:textSize">@dimen/notification_subtext_size</item> - <item name="android:textColor">#666666</item> + <item name="android:textColor">#999999</item> + </style> + <style name="TextAppearance.StatusBar.EventContent.Emphasis"> + <item name="android:textColor">#CCCCCC</item> </style> <style name="TextAppearance.Small.CalendarViewWeekDayView"> |