Skip to content

Commit

Permalink
[Dialog] Removes the third action from the catalog since the guidelin…
Browse files Browse the repository at this point in the history
…es advice against having more than two.

PiperOrigin-RevId: 331584063
  • Loading branch information
cketcham authored and pekingme committed Sep 15, 2020
1 parent 11c46e6 commit 1ec32fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
35 changes: 10 additions & 25 deletions catalog/java/io/material/catalog/dialog/DialogMainDemoFragment.java
Expand Up @@ -51,7 +51,6 @@ public View onCreateDemoView(
}
String positiveText = getResources().getString(R.string.positive);
String negativeText = getResources().getString(R.string.negative);
String neutralText = getResources().getString(R.string.neutral);
String title = getResources().getString(R.string.title);
String message = getResources().getString(R.string.message);
String longMessage = getResources().getString(R.string.long_message);
Expand All @@ -64,8 +63,7 @@ public View onCreateDemoView(
.setTitle(title)
.setMessage(message)
.setPositiveButton(positiveText, null)
.setNegativeButton(negativeText, null)
.setNeutralButton(neutralText, null));
.setNegativeButton(negativeText, null));

// message, 2 actions
addDialogLauncher(
Expand All @@ -92,18 +90,7 @@ public View onCreateDemoView(
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNeutralButton(neutralText, null));

// title, message, 3 actions (short)
addDialogLauncher(
dialogLaunchersLayout,
R.string.title_message_3_actions,
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setMessage(message)
.setPositiveButton(positiveText, null)
.setNegativeButton(negativeText, null)
.setNeutralButton(neutralText, null));
.setNegativeButton(negativeText, null));

// title, message, 3 actions (long)
addDialogLauncher(
Expand Down Expand Up @@ -173,7 +160,7 @@ public void onClick(DialogInterface dialog, int which) {
R.string.title_choices_as_actions,
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setNeutralButton(neutralText, null)
.setPositiveButton(positiveText, null)
.setItems(choices, null));

// title, checkboxes, 2 actions dialog
Expand All @@ -183,7 +170,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNeutralButton(neutralText, null)
.setNegativeButton(negativeText, null)
.setMultiChoiceItems(choices, choicesInitial, null));

// title, radiobutton, 2 actions dialog
Expand All @@ -193,7 +180,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNeutralButton(neutralText, null)
.setNegativeButton(negativeText, null)
.setSingleChoiceItems(choices, 1, null));

// title, custom view, actions dialog
Expand All @@ -203,7 +190,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNeutralButton(neutralText, null)
.setNegativeButton(negativeText, null)
.setView(R.layout.seekbar_layout));

// title, scrolling long view, actions dialog
Expand All @@ -214,7 +201,7 @@ public void onClick(DialogInterface dialog, int which) {
.setTitle(title)
.setMessage(multiLineMessage.toString())
.setPositiveButton(positiveText, null)
.setNeutralButton(neutralText, null));
.setNegativeButton(negativeText, null));

// scrolling view
addDialogLauncher(
Expand All @@ -229,7 +216,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext())
.setTitle(title)
.setPositiveButton(R.string.short_text_1, null)
.setNeutralButton(R.string.short_text_2, null));
.setNegativeButton(R.string.short_text_2, null));

// title, outlined buttons
addDialogLauncher(
Expand All @@ -238,8 +225,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext(), getOutlinedButtonThemeOverlay())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNegativeButton(negativeText, null)
.setNeutralButton(neutralText, null));
.setNegativeButton(negativeText, null));

// title, filled buttons
addDialogLauncher(
Expand All @@ -248,8 +234,7 @@ public void onClick(DialogInterface dialog, int which) {
new MaterialAlertDialogBuilder(getContext(), getFilledButtonThemeOverlay())
.setTitle(title)
.setPositiveButton(positiveText, null)
.setNegativeButton(negativeText, null)
.setNeutralButton(neutralText, null));
.setNegativeButton(negativeText, null));

return view;
}
Expand Down
Expand Up @@ -29,8 +29,6 @@
<!-- Denotes what parts of an AlertDialog this button will display. [CHAR LIMIT=60] -->
<string name="title_2_actions">Title, 2 Actions</string>
<!-- Denotes what parts of an AlertDialog this button will display. [CHAR LIMIT=60] -->
<string name="title_message_3_actions">Title, Message, 3 Actions</string>
<!-- Denotes what parts of an AlertDialog this button will display. [CHAR LIMIT=60] -->
<string name="title_message_3_long_actions">Title, Message, 3 Long Actions</string>
<!-- Denotes what parts of an AlertDialog this button will display. [CHAR LIMIT=60] -->
<string name="long_title_message_too_long_actions">Long Title, Message, Over-length Buttons</string>
Expand Down Expand Up @@ -63,8 +61,6 @@
<string name="positive">Accept</string>
<!-- Text for a negative dialog action. [CHAR LIMIT=15] -->
<string name="negative">Decline</string>
<!-- Text for a neutral dialog action. [CHAR LIMIT=15] -->
<string name="neutral">Cancel</string>
<!-- Text for a dialog title. [CHAR LIMIT=30] -->
<string name="title">Title</string>
<!-- A large amount of text in order to display a long dialog. [CHAR LIMIT=NONE][DO_NOT_TRANSLATE] -->
Expand Down

0 comments on commit 1ec32fc

Please sign in to comment.