Add device default light and dark dialogs to ApiDemos
Change-Id: I538c2cfb975828cd0e1e065d4cf5589e573307d5
This commit is contained in:
@@ -56,5 +56,11 @@
|
|||||||
<Button android:id="@+id/two_buttons_holo_light"
|
<Button android:id="@+id/two_buttons_holo_light"
|
||||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
android:text="@string/alert_dialog_two_buttons_holo_light"/>
|
android:text="@string/alert_dialog_two_buttons_holo_light"/>
|
||||||
|
<Button android:id="@+id/two_buttons_default_light"
|
||||||
|
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/alert_dialog_two_buttons_default_light"/>
|
||||||
|
<Button android:id="@+id/two_buttons_default_dark"
|
||||||
|
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||||
|
android:text="@string/alert_dialog_two_buttons_default_dark"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -522,6 +522,8 @@
|
|||||||
<string name="alert_dialog_two_buttons">OK Cancel dialog with a message</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_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_buttons_holo_light">OK Cancel dialog with Holo Light theme</string>
|
||||||
|
<string name="alert_dialog_two_buttons_default_light">OK Cancel dialog with DeviceDefault Light theme</string>
|
||||||
|
<string name="alert_dialog_two_buttons_default_dark">OK Cancel dialog with DeviceDefault theme</string>
|
||||||
<string name="alert_dialog_two_buttons2">OK Cancel dialog with a long message</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_two_buttons2ultra">OK Cancel dialog with ultra long message</string>
|
||||||
<string name="alert_dialog_select_button">List dialog</string>
|
<string name="alert_dialog_select_button">List dialog</string>
|
||||||
|
|||||||
@@ -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_ULTRA_LONG_MESSAGE = 9;
|
||||||
private static final int DIALOG_YES_NO_OLD_SCHOOL_MESSAGE = 10;
|
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_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;
|
private static final int MAX_PROGRESS = 100;
|
||||||
|
|
||||||
@@ -120,6 +122,32 @@ public class AlertDialogSamples extends Activity {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.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:
|
case DIALOG_YES_NO_LONG_MESSAGE:
|
||||||
return new AlertDialog.Builder(AlertDialogSamples.this)
|
return new AlertDialog.Builder(AlertDialogSamples.this)
|
||||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||||
@@ -406,6 +434,22 @@ public class AlertDialogSamples extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* 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() {
|
mProgressHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
|
|||||||
Reference in New Issue
Block a user