Merge changes If0b865ac,Ie0c61300 into jb-dev
* changes:
Move BigPicture's header to the top of its large view.
Action button improvements:
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 0c47069..6d3aa98 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -907,6 +907,8 @@
* </pre>
*/
public static class Builder {
+ private static final int MAX_ACTION_BUTTONS = 2;
+
private Context mContext;
private long mWhen;
@@ -938,7 +940,7 @@
private ArrayList<String> mKindList = new ArrayList<String>(1);
private Bundle mExtras;
private int mPriority;
- private ArrayList<Action> mActions = new ArrayList<Action>(3);
+ private ArrayList<Action> mActions = new ArrayList<Action>(MAX_ACTION_BUTTONS);
private boolean mUseChronometer;
private Style mStyle;
@@ -1460,7 +1462,7 @@
if (N > 0) {
// Log.d("Notification", "has actions: " + mContentText);
big.setViewVisibility(R.id.actions, View.VISIBLE);
- if (N>3) N=3;
+ if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS;
big.removeAllViews(R.id.actions);
for (int i=0; i<N; i++) {
final RemoteViews button = generateActionButton(mActions.get(i));
@@ -1500,18 +1502,14 @@
}
private RemoteViews generateActionButton(Action action) {
- RemoteViews button = new RemoteViews(mContext.getPackageName(), R.layout.notification_action);
+ final boolean tombstone = (action.actionIntent == null);
+ RemoteViews button = new RemoteViews(mContext.getPackageName(),
+ tombstone ? R.layout.notification_action_tombstone
+ : R.layout.notification_action);
button.setTextViewCompoundDrawables(R.id.action0, action.icon, 0, 0, 0);
button.setTextViewText(R.id.action0, action.title);
- if (action.actionIntent != null) {
+ if (!tombstone) {
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
- //button.setBoolean(R.id.action0, "setEnabled", true);
- button.setFloat(R.id.button0, "setAlpha", 1.0f);
- button.setBoolean(R.id.button0, "setClickable", true);
- } else {
- //button.setBoolean(R.id.action0, "setEnabled", false);
- button.setFloat(R.id.button0, "setAlpha", 0.5f);
- button.setBoolean(R.id.button0, "setClickable", false);
}
button.setContentDescription(R.id.action0, action.title);
return button;
diff --git a/core/res/res/layout/notification_action.xml b/core/res/res/layout/notification_action.xml
index 28812a9..21f2474 100644
--- a/core/res/res/layout/notification_action.xml
+++ b/core/res/res/layout/notification_action.xml
@@ -17,8 +17,9 @@
<Button xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/borderlessButtonStyle"
android:id="@+id/action0"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="48dp"
+ android:layout_weight="1"
android:gravity="left|center_vertical"
android:drawablePadding="8dp"
android:paddingLeft="8dp"
diff --git a/core/res/res/layout/notification_action_list.xml b/core/res/res/layout/notification_action_list.xml
new file mode 100644
index 0000000..fa0a8c8
--- /dev/null
+++ b/core/res/res/layout/notification_action_list.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/actions"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:visibility="gone"
+ android:showDividers="middle"
+ android:divider="?android:attr/listDivider"
+ >
+ <!-- actions will be added here -->
+</LinearLayout>
diff --git a/core/res/res/layout/notification_action_tombstone.xml b/core/res/res/layout/notification_action_tombstone.xml
index e61e15f..6c59ded 100644
--- a/core/res/res/layout/notification_action_tombstone.xml
+++ b/core/res/res/layout/notification_action_tombstone.xml
@@ -15,12 +15,16 @@
-->
<Button xmlns:android="http://schemas.android.com/apk/res/android"
+ style="?android:attr/borderlessButtonStyle"
android:id="@+id/action0"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="48dp"
+ android:layout_weight="1"
android:gravity="left|center_vertical"
android:drawablePadding="8dp"
android:paddingLeft="8dp"
- android:textColor="#666"
+ android:textColor="#ccc"
android:textSize="14dp"
+ android:alpha="0.5"
+ android:enabled="false"
/>
diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml
index 378161c..d50b792 100644
--- a/core/res/res/layout/notification_template_big_base.xml
+++ b/core/res/res/layout/notification_template_big_base.xml
@@ -143,14 +143,11 @@
style="?android:attr/progressBarStyleHorizontal"
/>
</LinearLayout>
- <LinearLayout
+ <include
+ layout="@layout/notification_action_list"
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:visibility="gone"
- >
- <!-- actions will be added here -->
- </LinearLayout>
+ />
</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 51e46b2..f98970a 100644
--- a/core/res/res/layout/notification_template_big_picture.xml
+++ b/core/res/res/layout/notification_template_big_picture.xml
@@ -27,11 +27,12 @@
android:id="@+id/big_picture"
android:layout_width="match_parent"
android:layout_height="192dp"
+ android:layout_marginTop="64dp"
+ android:layout_gravity="bottom"
android:scaleType="centerCrop"
/>
<include layout="@layout/notification_template_base"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="192dp"
/>
</FrameLayout>
diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml
index 77a5f11..210bc13 100644
--- a/core/res/res/layout/notification_template_big_text.xml
+++ b/core/res/res/layout/notification_template_big_text.xml
@@ -105,16 +105,13 @@
android:layout_weight="1"
/>
</LinearLayout>
- <LinearLayout
- android:id="@+id/actions"
+ <include
+ layout="@layout/notification_action_list"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:orientation="vertical"
android:visibility="gone"
android:layout_weight="1"
- >
- <!-- actions will be added here -->
- </LinearLayout>
+ />
<TextView android:id="@+id/overflow_title"
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
android:layout_width="match_parent"
diff --git a/core/res/res/layout/notification_template_inbox.xml b/core/res/res/layout/notification_template_inbox.xml
index 05ec1d8..bfa2e02 100644
--- a/core/res/res/layout/notification_template_inbox.xml
+++ b/core/res/res/layout/notification_template_inbox.xml
@@ -142,16 +142,13 @@
android:visibility="gone"
android:layout_weight="1"
/>
- <LinearLayout
+ <include
+ layout="@layout/notification_action_list"
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
android:layout_weight="0"
- android:visibility="gone"
- >
- <!-- actions will be added here -->
- </LinearLayout>
+ />
<TextView android:id="@+id/overflow_title"
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 4b223dd..ac92e1a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -531,30 +531,27 @@
}
}
catch (RuntimeException e) {
- exception = e;
- }
- if (expandedOneU == null && expandedLarge == null) {
final String ident = sbn.pkg + "/0x" + Integer.toHexString(sbn.id);
- Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
+ Slog.e(TAG, "couldn't inflate view for notification " + ident, e);
return false;
- } else {
- if (expandedOneU != null) {
- SizeAdaptiveLayout.LayoutParams params =
- new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
- params.minHeight = minHeight;
- params.maxHeight = minHeight;
- adaptive.addView(expandedOneU, params);
- }
- if (expandedLarge != null) {
- SizeAdaptiveLayout.LayoutParams params =
- new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
- params.minHeight = minHeight+1;
- params.maxHeight = maxHeight;
- adaptive.addView(expandedLarge, params);
- }
- row.setDrawingCacheEnabled(true);
}
+ if (expandedOneU != null) {
+ SizeAdaptiveLayout.LayoutParams params =
+ new SizeAdaptiveLayout.LayoutParams(expandedOneU.getLayoutParams());
+ params.minHeight = minHeight;
+ params.maxHeight = minHeight;
+ adaptive.addView(expandedOneU, params);
+ }
+ if (expandedLarge != null) {
+ SizeAdaptiveLayout.LayoutParams params =
+ new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
+ params.minHeight = minHeight+1;
+ params.maxHeight = maxHeight;
+ adaptive.addView(expandedLarge, params);
+ }
+ row.setDrawingCacheEnabled(true);
+
applyLegacyRowBackground(sbn, content);
row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null));