summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--samples/ApiDemos/res/layout/alert_dialog.xml6
-rw-r--r--samples/ApiDemos/res/values/strings.xml2
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.java44
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java17
4 files changed, 65 insertions, 4 deletions
diff --git a/samples/ApiDemos/res/layout/alert_dialog.xml b/samples/ApiDemos/res/layout/alert_dialog.xml
index 9c6e4a3ed..98556053c 100644
--- a/samples/ApiDemos/res/layout/alert_dialog.xml
+++ b/samples/ApiDemos/res/layout/alert_dialog.xml
@@ -50,5 +50,11 @@
<Button android:id="@+id/text_entry_button"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@string/alert_dialog_text_entry"/>
+ <Button android:id="@+id/two_buttons_old_school"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="@string/alert_dialog_two_buttons_old_school"/>
+ <Button android:id="@+id/two_buttons_holo_light"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:text="@string/alert_dialog_two_buttons_holo_light"/>
</LinearLayout>
</ScrollView>
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 576ee4bfb..13b474d34 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -379,6 +379,8 @@
<string name="activity_alert_dialog">App/Alert Dialogs</string>
<string name="alert_dialog_two_buttons">OK Cancel dialog with a message</string>
+ <string name="alert_dialog_two_buttons_old_school">OK Cancel dialog with traditional theme</string>
+ <string name="alert_dialog_two_buttons_holo_light">OK Cancel dialog with Holo Light theme</string>
<string name="alert_dialog_two_buttons2">OK Cancel dialog with a long message</string>
<string name="alert_dialog_two_buttons2ultra">OK Cancel dialog with ultra long message</string>
<string name="alert_dialog_select_button">List dialog</string>
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) {
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
index 59fc01846..d6116014a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/FragmentDialog.java
@@ -89,8 +89,11 @@ public class FragmentDialog extends Activity {
case 2: return "STYLE_NO_FRAME";
case 3: return "STYLE_NO_INPUT (this window can't receive input, so "
+ "you will need to press the bottom show button)";
- case 4: return "STYLE_NORMAL with light fullscreen theme";
- case 5: return "STYLE_NORMAL with dark fullscreen theme";
+ case 4: return "STYLE_NORMAL with dark fullscreen theme";
+ case 5: return "STYLE_NORMAL with light theme";
+ case 6: return "STYLE_NO_TITLE with light theme";
+ case 7: return "STYLE_NO_FRAME with light theme";
+ case 8: return "STYLE_NORMAL with light fullscreen theme";
}
return "STYLE_NORMAL";
}
@@ -127,10 +130,16 @@ public class FragmentDialog extends Activity {
case 3: style = DialogFragment.STYLE_NO_INPUT; break;
case 4: style = DialogFragment.STYLE_NORMAL; break;
case 5: style = DialogFragment.STYLE_NORMAL; break;
+ case 6: style = DialogFragment.STYLE_NO_TITLE; break;
+ case 7: style = DialogFragment.STYLE_NO_FRAME; break;
+ case 8: style = DialogFragment.STYLE_NORMAL; break;
}
switch ((mNum-1)%6) {
- case 4: theme = android.R.style.Theme_Light; break;
- case 5: theme = android.R.style.Theme; break;
+ case 4: theme = android.R.style.Theme_Holo; break;
+ case 5: theme = android.R.style.Theme_Holo_Light_Dialog; break;
+ case 6: theme = android.R.style.Theme_Holo_Light; break;
+ case 7: theme = android.R.style.Theme_Holo_Light_Panel; break;
+ case 8: theme = android.R.style.Theme_Holo_Light; break;
}
setStyle(style, theme);
}