summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-11-27 18:13:11 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-27 18:13:29 -0800
commit54525d8e4b2bcffcf33b5df8292e9ec45b9aaa3d (patch)
tree29d9bada7593f36dfc5901cf83a7c879783672e4 /tests
parent5bff551710d2f2b9d7c6ea814b18b042ee0fe663 (diff)
parent205ec5a969963f563b30b37385362ccfebdd5e4c (diff)
downloadframeworks_base-54525d8e4b2bcffcf33b5df8292e9ec45b9aaa3d.zip
frameworks_base-54525d8e4b2bcffcf33b5df8292e9ec45b9aaa3d.tar.gz
frameworks_base-54525d8e4b2bcffcf33b5df8292e9ec45b9aaa3d.tar.bz2
Merge "Clean up the Builder test." into jb-mr1.1-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/StatusBar/res/layout/notification_builder_test.xml1047
-rw-r--r--tests/StatusBar/res/values/styles.xml17
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java85
3 files changed, 654 insertions, 495 deletions
diff --git a/tests/StatusBar/res/layout/notification_builder_test.xml b/tests/StatusBar/res/layout/notification_builder_test.xml
index 94fc089..5987c84 100644
--- a/tests/StatusBar/res/layout/notification_builder_test.xml
+++ b/tests/StatusBar/res/layout/notification_builder_test.xml
@@ -222,307 +222,320 @@
>
<!-- setWhen -->
- <RadioGroup
- android:id="@+id/group_when"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setWhen"
/>
- <RadioButton
- android:id="@+id/when_midnight"
- style="@style/FieldContents"
- android:text="midnight"
- />
- <RadioButton
- android:id="@+id/when_now"
- style="@style/FieldContents"
- android:text="now"
- />
- <RadioButton
- android:id="@+id/when_now_plus_1h"
- style="@style/FieldContents.Disabled"
- android:text="now + 1h"
- />
- <RadioButton
- android:id="@+id/when_tomorrow"
- style="@style/FieldContents.Disabled"
- android:text="tomorrow"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_when"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/when_midnight"
+ style="@style/FieldContents"
+ android:text="midnight"
+ />
+ <RadioButton
+ android:id="@+id/when_now"
+ style="@style/FieldContents"
+ android:text="now"
+ />
+ <RadioButton
+ android:id="@+id/when_now_plus_1h"
+ style="@style/FieldContents.Disabled"
+ android:text="now + 1h"
+ />
+ <RadioButton
+ android:id="@+id/when_tomorrow"
+ style="@style/FieldContents.Disabled"
+ android:text="tomorrow"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- icon -->
- <RadioGroup
- android:id="@+id/group_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setSmallIcon"
/>
- <RadioButton
- android:id="@+id/icon_im"
- style="@style/FieldContents"
- android:text="IM"
- />
- <RadioButton
- android:id="@+id/icon_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- <RadioButton
- android:id="@+id/icon_surprise"
- style="@style/FieldContents"
- android:text="surprise"
- />
- <RadioButton
- android:id="@+id/icon_level0"
- style="@style/FieldContents.Disabled"
- android:text="level 0"
- />
- <RadioButton
- android:id="@+id/icon_level50"
- style="@style/FieldContents.Disabled"
- android:text="level 50"
- />
- <RadioButton
- android:id="@+id/icon_level100"
- style="@style/FieldContents.Disabled"
- android:text="level 100"
- />
- <!-- todo setSmallIcon(int icon, int level) -->
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_icon"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/icon_im"
+ style="@style/FieldContents"
+ android:text="IM"
+ />
+ <RadioButton
+ android:id="@+id/icon_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ <RadioButton
+ android:id="@+id/icon_surprise"
+ style="@style/FieldContents"
+ android:text="surprise"
+ />
+ <RadioButton
+ android:id="@+id/icon_level0"
+ style="@style/FieldContents.Disabled"
+ android:text="level 0"
+ />
+ <RadioButton
+ android:id="@+id/icon_level50"
+ style="@style/FieldContents.Disabled"
+ android:text="level 50"
+ />
+ <RadioButton
+ android:id="@+id/icon_level100"
+ style="@style/FieldContents.Disabled"
+ android:text="level 100"
+ />
+ <!-- todo setSmallIcon(int icon, int level) -->
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentTitle -->
- <RadioGroup
- android:id="@+id/group_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentTitle"
/>
- <RadioButton
- android:id="@+id/title_short"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/title_short"
- style="@style/FieldContents"
- android:text="short"
- android:tag="Title"
- />
- <RadioButton
- android:id="@+id/title_medium"
- style="@style/FieldContents"
- android:text="medium"
- android:tag="Notification Test"
- />
- <RadioButton
- android:id="@+id/title_long"
- style="@style/FieldContents"
- android:text="long"
- android:tag="This is one heckuva long title for a notification"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_title"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/title_short"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/title_short"
+ style="@style/FieldContents"
+ android:text="short"
+ android:tag="Title"
+ />
+ <RadioButton
+ android:id="@+id/title_medium"
+ style="@style/FieldContents"
+ android:text="medium"
+ android:tag="Notification Test"
+ />
+ <RadioButton
+ android:id="@+id/title_long"
+ style="@style/FieldContents"
+ android:text="long"
+ android:tag="This is one heckuva long title for a notification"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentText -->
- <RadioGroup
- android:id="@+id/group_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentText"
/>
- <RadioButton
- android:id="@+id/text_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/text_short"
- style="@style/FieldContents"
- android:tag="short"
- android:text="text"
- />
- <RadioButton
- android:id="@+id/text_medium"
- style="@style/FieldContents"
- android:text="medium"
- android:tag="Something happened"
- />
- <RadioButton
- android:id="@+id/text_long"
- style="@style/FieldContents"
- android:text="long"
- android:tag="Oh my goodness. SOMETHING HAPPENED!!!!"
- />
- <RadioButton
- android:id="@+id/text_emoji"
- style="@style/FieldContents"
- android:text="emoji"
- android:tag="_ Cactus _ Cactus _"
- />
- <RadioButton
- android:id="@+id/text_haiku"
- style="@style/FieldContents"
- android:text="haiku"
- android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_text"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/text_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/text_short"
+ style="@style/FieldContents"
+ android:tag="short"
+ android:text="text"
+ />
+ <RadioButton
+ android:id="@+id/text_medium"
+ style="@style/FieldContents"
+ android:text="medium"
+ android:tag="Something happened"
+ />
+ <RadioButton
+ android:id="@+id/text_long"
+ style="@style/FieldContents"
+ android:text="long"
+ android:tag="Oh my goodness. SOMETHING HAPPENED!!!!"
+ />
+ <RadioButton
+ android:id="@+id/text_emoji"
+ style="@style/FieldContents"
+ android:text="emoji"
+ android:tag="_ Cactus _ Cactus _"
+ />
+ <RadioButton
+ android:id="@+id/text_haiku"
+ style="@style/FieldContents"
+ android:text="haiku"
+ android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setContentInfo -->
- <RadioGroup
- android:id="@+id/group_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentInfo"
/>
- <RadioButton
- android:id="@+id/info_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/info_number"
- style="@style/FieldContents"
- android:text="snoozed"
- android:tag="snoozed"
- />
- <RadioButton
- android:id="@+id/info_long"
- style="@style/FieldContents"
- android:text="longer"
- android:tag="this content info is way too long"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_info"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/info_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/info_number"
+ style="@style/FieldContents"
+ android:text="snoozed"
+ android:tag="snoozed"
+ />
+ <RadioButton
+ android:id="@+id/info_long"
+ style="@style/FieldContents"
+ android:text="longer"
+ android:tag="this content info is way too long"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setNumber -->
- <RadioGroup
- android:id="@+id/group_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setNumber"
/>
- <RadioButton
- android:id="@+id/number_0"
- style="@style/FieldContents"
- android:text="0"
- android:tag="0"
- />
- <RadioButton
- android:id="@+id/number_1"
- style="@style/FieldContents"
- android:text="1"
- android:tag="1"
- />
- <RadioButton
- android:id="@+id/number_42"
- style="@style/FieldContents"
- android:text="42"
- android:tag="42"
- />
- <RadioButton
- android:id="@+id/number_334"
- style="@style/FieldContents"
- android:text="334"
- android:tag="334"
- />
- <RadioButton
- android:id="@+id/number_999"
- style="@style/FieldContents"
- android:text="999"
- android:tag="999"
- />
- <RadioButton
- android:id="@+id/number_9876"
- style="@style/FieldContents"
- android:text="9,876"
- android:tag="9876"
- />
- <RadioButton
- android:id="@+id/number_12345"
- style="@style/FieldContents"
- android:text="12,345"
- android:tag="12345"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_number"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/number_0"
+ style="@style/FieldContents"
+ android:text="0"
+ android:tag="0"
+ />
+ <RadioButton
+ android:id="@+id/number_1"
+ style="@style/FieldContents"
+ android:text="1"
+ android:tag="1"
+ />
+ <RadioButton
+ android:id="@+id/number_42"
+ style="@style/FieldContents"
+ android:text="42"
+ android:tag="42"
+ />
+ <RadioButton
+ android:id="@+id/number_334"
+ style="@style/FieldContents"
+ android:text="334"
+ android:tag="334"
+ />
+ <RadioButton
+ android:id="@+id/number_999"
+ style="@style/FieldContents"
+ android:text="999"
+ android:tag="999"
+ />
+ <RadioButton
+ android:id="@+id/number_9876"
+ style="@style/FieldContents"
+ android:text="9,876"
+ android:tag="9876"
+ />
+ <RadioButton
+ android:id="@+id/number_12345"
+ style="@style/FieldContents"
+ android:text="12,345"
+ android:tag="12345"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setContentIntent -->
- <RadioGroup
- android:id="@+id/group_intent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setContentIntent"
/>
- <RadioButton
- android:id="@+id/intent_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/intent_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_intent"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/intent_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/intent_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- setDeleteIntent -->
- <RadioGroup
- android:id="@+id/group_delete"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setDeleteIntent"
/>
- <RadioButton
- android:id="@+id/delete_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/delete_alert"
- style="@style/FieldContents"
- android:text="alert"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_delete"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/delete_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/delete_alert"
+ style="@style/FieldContents"
+ android:text="alert"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setFullScreenIntent -->
<RadioGroup
android:id="@+id/group_full_screen"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
+ style="@style/FieldChoices"
android:visibility="gone"
>
<TextView
@@ -543,94 +556,94 @@
<!-- setTicker -->
- <RadioGroup
- android:id="@+id/group_ticker"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setTicker"
/>
- <RadioButton
- android:id="@+id/ticker_none"
- style="@style/FieldContents"
- android:text="none"
- android:tag=""
- />
- <RadioButton
- android:id="@+id/ticker_short"
- style="@style/FieldContents"
- android:text="short"
- android:tag="tick"
- />
- <RadioButton
- android:id="@+id/ticker_wrap"
- style="@style/FieldContents"
- android:text="wrap"
- android:tag="tick tick tick tock tock tock something fun has happened but i don't know what it is just yet"
- />
- <RadioButton
- android:id="@+id/ticker_haiku"
- style="@style/FieldContents"
- android:text="haiku"
- android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
- />
- <RadioButton
- android:id="@+id/ticker_emoji"
- style="@style/FieldContents"
- android:text="emoji"
- android:tag="_ Cactus _ Cactus _"
- />
- <RadioButton
- android:id="@+id/ticker_custom"
- style="@style/FieldContents.Disabled"
- android:text="custom view"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_ticker"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/ticker_none"
+ style="@style/FieldContents"
+ android:text="none"
+ android:tag=""
+ />
+ <RadioButton
+ android:id="@+id/ticker_short"
+ style="@style/FieldContents"
+ android:text="short"
+ android:tag="tick"
+ />
+ <RadioButton
+ android:id="@+id/ticker_wrap"
+ style="@style/FieldContents"
+ android:text="wrap"
+ android:tag="tick tick tick tock tock tock something fun has happened but i don't know what it is just yet"
+ />
+ <RadioButton
+ android:id="@+id/ticker_haiku"
+ style="@style/FieldContents"
+ android:text="haiku"
+ android:tag="sholes final approach\nlanding gear punted to flan\nrunway foam glistens"
+ />
+ <RadioButton
+ android:id="@+id/ticker_emoji"
+ style="@style/FieldContents"
+ android:text="emoji"
+ android:tag="_ Cactus _ Cactus _"
+ />
+ <RadioButton
+ android:id="@+id/ticker_custom"
+ style="@style/FieldContents.Disabled"
+ android:text="custom view"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLargeIcon -->
- <RadioGroup
- android:id="@+id/group_large_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLargeIcon"
/>
- <RadioButton
- android:id="@+id/large_icon_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/large_icon_pineapple"
- style="@style/FieldContents"
- android:text="pineapple"
- />
- <RadioButton
- android:id="@+id/large_icon_pineapple2"
- style="@style/FieldContents"
- android:text="pineapple2"
- />
- <RadioButton
- android:id="@+id/large_icon_small"
- style="@style/FieldContents"
- android:text="small"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_large_icon"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/large_icon_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_pineapple"
+ style="@style/FieldContents"
+ android:text="pineapple"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_pineapple2"
+ style="@style/FieldContents"
+ android:text="pineapple2"
+ />
+ <RadioButton
+ android:id="@+id/large_icon_small"
+ style="@style/FieldContents"
+ android:text="small"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setSound -->
<RadioGroup
android:id="@+id/group_sound"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
+ style="@style/FieldChoices"
android:visibility="gone"
>
<TextView
@@ -646,190 +659,260 @@
<!-- setVibrate -->
- <RadioGroup
- android:id="@+id/group_vibrate"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setVibrate"
/>
- <RadioButton
- android:id="@+id/vibrate_none"
- style="@style/FieldContents"
- android:text="none"
- />
- <RadioButton
- android:id="@+id/vibrate_short"
- style="@style/FieldContents"
- android:text="short"
- />
- <RadioButton
- android:id="@+id/vibrate_medium"
- style="@style/FieldContents"
- android:text="long"
- />
- <RadioButton
- android:id="@+id/vibrate_long"
- style="@style/FieldContents"
- android:text="long"
- />
- <RadioButton
- android:id="@+id/vibrate_pattern"
- style="@style/FieldContents"
- android:text="longer"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_vibrate"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/vibrate_none"
+ style="@style/FieldContents"
+ android:text="none"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_zero"
+ style="@style/FieldContents"
+ android:text="0"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_short"
+ style="@style/FieldContents"
+ android:text="100"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_long"
+ style="@style/FieldContents"
+ android:text="1000"
+ />
+ <RadioButton
+ android:id="@+id/vibrate_pattern"
+ style="@style/FieldContents"
+ android:text="...---..."
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLights -->
- <RadioGroup
- android:id="@+id/group_lights_color"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLights (color)"
/>
- <RadioButton
- android:id="@+id/lights_red"
- style="@style/FieldContents"
- android:text="red"
- android:tag="0xff0000"
- />
- <RadioButton
- android:id="@+id/lights_green"
- style="@style/FieldContents"
- android:text="green"
- android:tag="0x00ff00"
- />
- <RadioButton
- android:id="@+id/lights_blue"
- style="@style/FieldContents"
- android:text="blue"
- android:tag="0x0000ff"
- />
- <RadioButton
- android:id="@+id/lights_cyan"
- style="@style/FieldContents"
- android:text="cyan"
- android:tag="0x00ffff"
- />
- <RadioButton
- android:id="@+id/lights_magenta"
- style="@style/FieldContents"
- android:text="magenta"
- android:tag="0xff00ff"
- />
- <RadioButton
- android:id="@+id/lights_yellow"
- style="@style/FieldContents"
- android:text="yellow"
- android:tag="0xffff00"
- />
- <RadioButton
- android:id="@+id/lights_white"
- style="@style/FieldContents"
- android:text="white"
- android:tag="0xffffff"
- />
- </RadioGroup>
+ <RadioGroup
+ android:id="@+id/group_lights_color"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/lights_red"
+ style="@style/FieldContents"
+ android:text="red"
+ android:tag="0xff0000"
+ />
+ <RadioButton
+ android:id="@+id/lights_green"
+ style="@style/FieldContents"
+ android:text="green"
+ android:tag="0x00ff00"
+ />
+ <RadioButton
+ android:id="@+id/lights_blue"
+ style="@style/FieldContents"
+ android:text="blue"
+ android:tag="0x0000ff"
+ />
+ <RadioButton
+ android:id="@+id/lights_cyan"
+ style="@style/FieldContents"
+ android:text="cyan"
+ android:tag="0x00ffff"
+ />
+ <RadioButton
+ android:id="@+id/lights_magenta"
+ style="@style/FieldContents"
+ android:text="magenta"
+ android:tag="0xff00ff"
+ />
+ <RadioButton
+ android:id="@+id/lights_yellow"
+ style="@style/FieldContents"
+ android:text="yellow"
+ android:tag="0xffff00"
+ />
+ <RadioButton
+ android:id="@+id/lights_white"
+ style="@style/FieldContents"
+ android:text="white"
+ android:tag="0xffffff"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
+ <!-- setPriority -->
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
+ <TextView
+ style="@style/FieldTitle"
+ android:text="setPriority"
+ />
+ <RadioGroup
+ android:id="@+id/group_priority"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/pri_max"
+ style="@style/FieldContents"
+ android:text="MAX"
+ />
+ <RadioButton
+ android:id="@+id/pri_high"
+ style="@style/FieldContents"
+ android:text="HIGH"
+ />
+ <RadioButton
+ android:id="@+id/pri_default"
+ style="@style/FieldContents"
+ android:text="DEFAULT"
+ />
+ <RadioButton
+ android:id="@+id/pri_low"
+ style="@style/FieldContents"
+ android:text="LOW"
+ />
+ <RadioButton
+ android:id="@+id/pri_min"
+ style="@style/FieldContents"
+ android:text="MIN"
+ />
+ </RadioGroup>
+ </LinearLayout>
<!-- setLights -->
- <RadioGroup
- android:id="@+id/group_lights_blink"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="setLights (blink)"
/>
- <RadioButton
- android:id="@+id/lights_off"
- style="@style/FieldContents"
- android:text="off"
- />
- <RadioButton
- android:id="@+id/lights_slow"
- style="@style/FieldContents"
- android:text="slow"
- />
- <RadioButton
- android:id="@+id/lights_fast"
- style="@style/FieldContents"
- android:text="fast"
- />
- <RadioButton
- android:id="@+id/lights_on"
- style="@style/FieldContents"
- android:text="on"
- />
- </RadioGroup>
-
+ <RadioGroup
+ android:id="@+id/group_lights_blink"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/lights_off"
+ style="@style/FieldContents"
+ android:text="off"
+ />
+ <RadioButton
+ android:id="@+id/lights_slow"
+ style="@style/FieldContents"
+ android:text="slow"
+ />
+ <RadioButton
+ android:id="@+id/lights_fast"
+ style="@style/FieldContents"
+ android:text="fast"
+ />
+ <RadioButton
+ android:id="@+id/lights_on"
+ style="@style/FieldContents"
+ android:text="on"
+ />
+ </RadioGroup>
+ </LinearLayout>
+
<!-- flags -->
<LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_marginTop="12dp"
- >
+ style="@style/FieldGroup"
+ android:layout_marginTop="30dp"
+ >
<TextView
style="@style/FieldTitle"
android:text="flags"
/>
- <CheckBox
- android:id="@+id/flag_ongoing"
- style="@style/FieldContents"
- android:text="setOngoing"
- />
- <CheckBox
- android:id="@+id/flag_once"
- style="@style/FieldContents"
- android:text="setOnlyAlertOnce"
- />
- <CheckBox
- android:id="@+id/flag_auto_cancel"
- style="@style/FieldContents"
- android:text="setAutoCancel"
- />
+ <LinearLayout
+ style="@style/FieldChoices"
+ >
+ <CheckBox
+ android:id="@+id/flag_ongoing"
+ style="@style/FieldContents"
+ android:text="ongoing"
+ />
+ <CheckBox
+ android:id="@+id/flag_once"
+ style="@style/FieldContents"
+ android:text="onlyAlertOnce"
+ />
+ <CheckBox
+ android:id="@+id/flag_auto_cancel"
+ style="@style/FieldContents"
+ android:text="autoCancel"
+ />
+ </LinearLayout>
</LinearLayout>
-
+
<!-- defaults -->
<LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ style="@style/FieldGroup"
+ >
<TextView
style="@style/FieldTitle"
android:text="defaults"
/>
- <CheckBox
- android:id="@+id/default_sound"
- style="@style/FieldContents"
- android:text="sound"
- />
- <CheckBox
- android:id="@+id/default_vibrate"
- style="@style/FieldContents"
- android:text="vibrate"
- />
- <CheckBox
- android:id="@+id/default_lights"
- style="@style/FieldContents"
- android:text="lights"
- />
+ <LinearLayout
+ style="@style/FieldChoices"
+ >
+ <CheckBox
+ android:id="@+id/default_sound"
+ style="@style/FieldContents"
+ android:text="sound"
+ />
+ <CheckBox
+ android:id="@+id/default_vibrate"
+ style="@style/FieldContents"
+ android:text="vibrate"
+ />
+ <CheckBox
+ android:id="@+id/default_lights"
+ style="@style/FieldContents"
+ android:text="lights"
+ />
+ </LinearLayout>
</LinearLayout>
-
-
-
+ <!-- delay -->
+ <LinearLayout
+ style="@style/FieldGroup"
+ >
+ <TextView
+ style="@style/FieldTitle"
+ android:text="notify"
+ />
+ <RadioGroup
+ android:id="@+id/group_delay"
+ style="@style/FieldChoices"
+ >
+ <RadioButton
+ android:id="@+id/delay_none"
+ style="@style/FieldContents"
+ android:text="immediately"
+ />
+ <RadioButton
+ android:id="@+id/delay_5"
+ style="@style/FieldContents"
+ android:text="in 5 sec"
+ />
+ </RadioGroup>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/tests/StatusBar/res/values/styles.xml b/tests/StatusBar/res/values/styles.xml
index 103a25a..f2c9f0d 100644
--- a/tests/StatusBar/res/values/styles.xml
+++ b/tests/StatusBar/res/values/styles.xml
@@ -45,8 +45,10 @@
<style name="FieldTitle">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
- <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_width">120dp</item>
<item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">right</item>
+ <item name="android:textStyle">bold</item>
</style>
<style name="FieldContents">
@@ -61,5 +63,18 @@
<item name="android:visibility">gone</item>
</style>
+ <style name="FieldGroup">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:orientation">horizontal</item>
+ <item name="android:layout_marginTop">18dp</item>
+ </style>
+
+ <style name="FieldChoices">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:orientation">vertical</item>
+ <item name="android:baselineAlignedChildIndex">0</item>
+ </style>
</resources>
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
index 2f0c173..5d0b155 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
@@ -30,6 +30,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.os.Handler;
import android.os.Vibrator;
import android.os.Handler;
import android.text.SpannableStringBuilder;
@@ -49,11 +50,14 @@ public class NotificationBuilderTest extends Activity
private final static String TAG = "NotificationTestList";
NotificationManager mNM;
+ Handler mHandler;
+ int mStartDelay;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
+ mHandler = new Handler();
setContentView(R.layout.notification_builder_test);
if (icicle == null) {
setDefaults();
@@ -100,8 +104,13 @@ public class NotificationBuilderTest extends Activity
setChecked(R.id.large_icon_none);
setChecked(R.id.sound_none);
setChecked(R.id.vibrate_none);
+ setChecked(R.id.pri_default);
setChecked(R.id.lights_red);
setChecked(R.id.lights_off);
+ setChecked(R.id.delay_none);
+// setChecked(R.id.default_vibrate);
+// setChecked(R.id.default_sound);
+// setChecked(R.id.default_lights);
}
private View.OnClickListener mClickListener = new View.OnClickListener() {
@@ -183,9 +192,13 @@ public class NotificationBuilderTest extends Activity
}
};
- private void sendNotification(int id) {
+ private void sendNotification(final int id) {
final Notification n = buildNotification(id);
- mNM.notify(id, n);
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ mNM.notify(id, n);
+ }
+ }, mStartDelay);
}
private static CharSequence subst(CharSequence in, char ch, CharSequence sub) {
@@ -323,23 +336,26 @@ public class NotificationBuilderTest extends Activity
// vibrate
switch (getRadioChecked(R.id.group_vibrate)) {
case R.id.vibrate_none:
+ b.setVibrate(null);
break;
- case R.id.vibrate_short:
- b.setVibrate(new long[] { 0, 200 });
+ case R.id.vibrate_zero:
+ b.setVibrate(new long[] { 0 });
break;
- case R.id.vibrate_medium:
- b.setVibrate(new long[] { 0, 500 });
+ case R.id.vibrate_short:
+ b.setVibrate(new long[] { 0, 100 });
break;
case R.id.vibrate_long:
b.setVibrate(new long[] { 0, 1000 });
break;
case R.id.vibrate_pattern:
- b.setVibrate(new long[] { 0, 250, 250, 250, 250, 250, 250, 250 });
+ b.setVibrate(new long[] { 0, 50, 200, 50, 200, 50, 500,
+ 500, 200, 500, 200, 500, 500,
+ 50, 200, 50, 200, 50 });
break;
}
// lights
- final int color = getRadioInt(R.id.group_lights_color, 0xff0000);
+ final int color = getRadioHex(R.id.group_lights_color, 0xff0000);
int onMs;
int offMs;
switch (getRadioChecked(R.id.group_lights_blink)) {
@@ -365,6 +381,35 @@ public class NotificationBuilderTest extends Activity
b.setLights(color, onMs, offMs);
}
+ // priority
+ switch (getRadioChecked(R.id.group_priority)) {
+ case R.id.pri_min:
+ b.setPriority(Notification.PRIORITY_MIN);
+ break;
+ case R.id.pri_low:
+ b.setPriority(Notification.PRIORITY_LOW);
+ break;
+ case R.id.pri_default:
+ b.setPriority(Notification.PRIORITY_DEFAULT);
+ break;
+ case R.id.pri_high:
+ b.setPriority(Notification.PRIORITY_HIGH);
+ break;
+ case R.id.pri_max:
+ b.setPriority(Notification.PRIORITY_MAX);
+ break;
+ }
+
+ // start delay
+ switch (getRadioChecked(R.id.group_delay)) {
+ case R.id.delay_none:
+ mStartDelay = 0;
+ break;
+ case R.id.delay_5:
+ mStartDelay = 5000;
+ break;
+ }
+
// flags
b.setOngoing(getChecked(R.id.flag_ongoing));
b.setOnlyAlertOnce(getChecked(R.id.flag_once));
@@ -383,7 +428,7 @@ public class NotificationBuilderTest extends Activity
}
b.setDefaults(defaults);
- return b.getNotification();
+ return b.build();
}
private void setChecked(int id) {
@@ -396,14 +441,14 @@ public class NotificationBuilderTest extends Activity
return g.getCheckedRadioButtonId();
}
- private CharSequence getRadioTag(int id) {
+ private String getRadioTag(int id) {
final RadioGroup g = (RadioGroup)findViewById(id);
final View v = findViewById(g.getCheckedRadioButtonId());
- return (CharSequence) v.getTag();
+ return (String) v.getTag();
}
private int getRadioInt(int id, int def) {
- CharSequence str = getRadioTag(id);
+ String str = getRadioTag(id);
if (TextUtils.isEmpty(str)) {
return def;
} else {
@@ -415,6 +460,22 @@ public class NotificationBuilderTest extends Activity
}
}
+ private int getRadioHex(int id, int def) {
+ String str = getRadioTag(id);
+ if (TextUtils.isEmpty(str)) {
+ return def;
+ } else {
+ if (str.startsWith("0x")) {
+ str = str.substring(2);
+ }
+ try {
+ return Integer.parseInt(str.toString(), 16);
+ } catch (NumberFormatException ex) {
+ return def;
+ }
+ }
+ }
+
private boolean getChecked(int id) {
final CompoundButton b = (CompoundButton)findViewById(id);
return b.isChecked();