66import org .slf4j .Logger ;
77import org .slf4j .LoggerFactory ;
88
9+ import java .util .Collection ;
910import java .util .IllegalFormatException ;
1011import java .util .List ;
1112
@@ -359,14 +360,84 @@ public void addCustomAlertBody(String body) {
359360 put ("body" , body , getOrAddCustomAlert (), false );
360361 }
361362
363+ /**
364+ * Create a custom alert (if none exist) and add a title to the custom alert.
365+ *
366+ * @param title the title of the alert
367+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
368+ */
369+ public void addCustomAlertTitle (String title ) {
370+ put ("title" , title , getOrAddCustomAlert (), false );
371+ }
372+
373+ /**
374+ * Create a custom alert (if none exist) and add a subtitle to the custom alert.
375+ *
376+ * @param subtitle the subtitle of the alert
377+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
378+ */
379+ public void addCustomAlertSubtitle (String subtitle ) {
380+ put ("subtitle" , subtitle , getOrAddCustomAlert (), false );
381+ }
382+
383+ /**
384+ * Create a custom alert (if none exist) and add a launch image to the custom alert.
385+ *
386+ * @param launchImage the subtitle of the alert
387+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
388+ */
389+ public void addCustomAlertLaunchImage (String launchImage ) {
390+ put ("launch-image" , launchImage , getOrAddCustomAlert (), false );
391+ }
392+
393+ /**
394+ * Create a custom alert (if none exist) and add a key for a localized title string to the custom alert.
395+ *
396+ * @param titleLocKey the key for a localized title string of the alert
397+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
398+ */
399+ public void addCustomAlertTitleLocKey (String titleLocKey ) {
400+ put ("title-loc-key" , titleLocKey , getOrAddCustomAlert (), false );
401+ }
402+
403+ /**
404+ * Create a custom alert (if none exist) and add a array of strings containing replacement values for variables in your title string to the custom alert.
405+ *
406+ * @param titleLocArgs the array of strings containing replacement values for variables in your title string of the alert
407+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
408+ */
409+ public void addCustomAlertTitleLocArgs (Collection <CharSequence > titleLocArgs ) {
410+ put ("title-loc-args" , titleLocArgs , getOrAddCustomAlert (), false );
411+ }
412+
413+ /**
414+ * Create a custom alert (if none exist) and add a key for a localized title string to the custom alert.
415+ *
416+ * @param subtitleLocKey the key for a localized subtitle string of the alert
417+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
418+ */
419+ public void addCustomAlertSubtitleLocKey (String subtitleLocKey ) {
420+ put ("subtitle-loc-key" , subtitleLocKey , getOrAddCustomAlert (), false );
421+ }
422+
423+ /**
424+ * Create a custom alert (if none exist) and add a array of strings containing replacement values for variables in your subtitle string to the custom alert.
425+ *
426+ * @param subtitleLocArgs the array of strings containing replacement values for variables in your title string of the alert
427+ * @throws JSONException if the custom alert cannot be added because a simple alert already exists
428+ */
429+ public void addCustomAlertSubtitleLocArgs (Collection <CharSequence > subtitleLocArgs ) {
430+ put ("subtitle-loc-args" , subtitleLocArgs , getOrAddCustomAlert (), false );
431+ }
432+
362433 /**
363434 * Create a custom alert (if none exist) and add a custom text for the right button of the popup.
364435 *
365436 * @param actionLocKey the title of the alert's right button, or null to remove the button
366437 * @throws JSONException if the custom alert cannot be added because a simple alert already exists
367438 */
368439 public void addCustomAlertActionLocKey (String actionLocKey ) {
369- Object value = actionLocKey != null ? actionLocKey : JSONObject .NULL ;
440+ Object value = actionLocKey == null ? JSONObject .NULL : actionLocKey ;
370441 put ("action-loc-key" , value , getOrAddCustomAlert (), false );
371442 }
372443
@@ -383,11 +454,11 @@ public void addCustomAlertLocKey(String locKey) {
383454 /**
384455 * Create a custom alert (if none exist) and add sub-parameters for the loc-key parameter.
385456 *
386- * @param args The loc-args parameter
457+ * @param locArgs The loc-args
387458 * @throws JSONException if the custom alert cannot be added because a simple alert already exists
388459 */
389- public void addCustomAlertLocArgs (List <?> args ) {
390- put ("loc-args" , args , getOrAddCustomAlert (), false );
460+ public void addCustomAlertLocArgs (Collection < CharSequence > locArgs ) {
461+ put ("loc-args" , locArgs , getOrAddCustomAlert (), false );
391462 }
392463
393464 /**
0 commit comments