Add device default light and dark dialogs to ApiDemos

Change-Id: I538c2cfb975828cd0e1e065d4cf5589e573307d5
This commit is contained in:
Alan Viverette
2014-08-28 16:39:27 -07:00
parent b52c7ae862
commit fe3ba7fbc9
3 changed files with 52 additions and 0 deletions

View File

@@ -67,6 +67,8 @@ public class AlertDialogSamples extends Activity {
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 DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE = 12;
private static final int DIALOG_YES_NO_DEFAULT_DARK_MESSAGE = 13;
private static final int MAX_PROGRESS = 100;
@@ -120,6 +122,32 @@ public class AlertDialogSamples extends Activity {
}
})
.create();
case DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_DEVICE_DEFAULT_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_DEFAULT_DARK_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK)
.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)
@@ -405,6 +433,22 @@ public class AlertDialogSamples extends Activity {
showDialog(DIALOG_YES_NO_HOLO_LIGHT_MESSAGE);
}
});
/* Two points, in the light default theme */
Button twoButtonsDefaultLightTitle = (Button) findViewById(R.id.two_buttons_default_light);
twoButtonsDefaultLightTitle.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_YES_NO_DEFAULT_LIGHT_MESSAGE);
}
});
/* Two points, in the dark default theme */
Button twoButtonsDefaultDarkTitle = (Button) findViewById(R.id.two_buttons_default_dark);
twoButtonsDefaultDarkTitle.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_YES_NO_DEFAULT_DARK_MESSAGE);
}
});
mProgressHandler = new Handler() {
@Override