From 4058ba052682129f2d1055116aaffb2e91c2013d Mon Sep 17 00:00:00 2001 From: Joe Onorato <joeo@google.com> Date: Sun, 31 Oct 2010 11:38:04 -0700 Subject: Allow both contentIntent and setOnClickPendingIntent in notifications From the app developer's request: Intents assigned to specific views should take precedence over the content intent, but it should not be required to set the content intent to null in order for the view-intents to work Bug: 3107945 Change-Id: Ic5282d441277a9a8c8c700ef3f43872f3405b58a --- tests/StatusBar/res/layout/button_notification.xml | 21 +++++++++++++++++++++ .../android/statusbartest/NotificationTestList.java | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/StatusBar/res/layout/button_notification.xml (limited to 'tests') diff --git a/tests/StatusBar/res/layout/button_notification.xml b/tests/StatusBar/res/layout/button_notification.xml new file mode 100644 index 0000000..822e8cd --- /dev/null +++ b/tests/StatusBar/res/layout/button_notification.xml @@ -0,0 +1,21 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="80sp" + android:orientation="horizontal" + > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1" + android:src="@drawable/icon1" + /> + + <Button android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="button" + /> + +</LinearLayout> + diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index 38ee1b8..2df97dc 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -100,6 +100,19 @@ public class NotificationTestList extends TestActivity } }, + new Test("Button") { + public void run() { + Notification n = new Notification(R.drawable.icon1, null, + mActivityCreateTime); + n.contentView = new RemoteViews(getPackageName(), R.layout.button_notification); + n.flags |= Notification.FLAG_ONGOING_EVENT; + n.contentIntent = makeIntent(); + n.contentView.setOnClickPendingIntent(R.id.button, makeIntent2()); + + mNM.notify(1, n); + } + }, + new Test("custom intent on text view") { public void run() { Notification n = new Notification(R.drawable.icon1, null, -- cgit v1.1