summaryrefslogtreecommitdiff
path: root/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-01-27 16:35:02 -0800
committerDianne Hackborn <hackbod@google.com>2011-01-27 16:35:02 -0800
commite36d13b70d5b2dc4607d922182faafbc7d52150e (patch)
tree34eacbf02ac13f868816af17ad20c985875a01d4 /samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
parent23c0080a10b7ae694849cf820e55a54333d7f37a (diff)
Add new samples for explicit alert dialog themes.
Change-Id: I1e306c0786952ab391c479a9322065efd8566ca7
Diffstat (limited to 'samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java')
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java b/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
index 2c6b6543f..a22753a04 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java
@@ -65,6 +65,8 @@ public class AlertDialogSamples extends Activity {
private static final int DIALOG_TEXT_ENTRY = 7;
private static final int DIALOG_MULTIPLE_CHOICE_CURSOR = 8;
private static final int DIALOG_YES_NO_ULTRA_LONG_MESSAGE = 9;
+ private static final int DIALOG_YES_NO_OLD_SCHOOL_MESSAGE = 10;
+ private static final int DIALOG_YES_NO_HOLO_LIGHT_MESSAGE = 11;
private static final int MAX_PROGRESS = 100;
@@ -92,6 +94,32 @@ public class AlertDialogSamples extends Activity {
}
})
.create();
+ case DIALOG_YES_NO_OLD_SCHOOL_MESSAGE:
+ return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_TRADITIONAL)
+ .setIconAttribute(android.R.attr.alertDialogIcon)
+ .setTitle(R.string.alert_dialog_two_buttons_title)
+ .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .create();
+ case DIALOG_YES_NO_HOLO_LIGHT_MESSAGE:
+ return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_HOLO_LIGHT)
+ .setIconAttribute(android.R.attr.alertDialogIcon)
+ .setTitle(R.string.alert_dialog_two_buttons_title)
+ .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .create();
case DIALOG_YES_NO_LONG_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this)
.setIconAttribute(android.R.attr.alertDialogIcon)
@@ -362,6 +390,22 @@ public class AlertDialogSamples extends Activity {
}
});
+ /* Two points, in the traditional theme */
+ Button twoButtonsOldSchoolTitle = (Button) findViewById(R.id.two_buttons_old_school);
+ twoButtonsOldSchoolTitle.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DIALOG_YES_NO_OLD_SCHOOL_MESSAGE);
+ }
+ });
+
+ /* Two points, in the light holographic theme */
+ Button twoButtonsHoloLightTitle = (Button) findViewById(R.id.two_buttons_holo_light);
+ twoButtonsHoloLightTitle.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DIALOG_YES_NO_HOLO_LIGHT_MESSAGE);
+ }
+ });
+
mProgressHandler = new Handler() {
@Override
public void handleMessage(Message msg) {