Class Notify


  • public final class Notify
    extends java.lang.Object
    Helper class for showing soft notifications to the user via Toast, Snackbar, and AlertDialog
    • Constructor Summary

      Constructors 
      Constructor Description
      Notify()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void alertOk​(android.app.Activity activity, int title, int message)
      Show the message via a AlertDialog object.
      static void alertOk​(android.app.Activity activity, int title, int message, int okButtonTitle, android.content.DialogInterface.OnClickListener okListener)
      Show the message via a AlertDialog object.
      static void alertOk​(android.app.Activity activity, java.lang.String title, java.lang.String message)
      Show the message via a AlertDialog object.
      static void alertOk​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, android.content.DialogInterface.OnClickListener okListener)
      Show the message via a AlertDialog object.
      static void alertOk​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, android.content.DialogInterface.OnClickListener okListener, boolean cancellable)
      Show the message via a AlertDialog object.
      static void alertOkCancel​(android.app.Activity activity, int title, int message, int okButtonTitle, int cancelButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener)
      Show the message via a AlertDialog object.
      static void alertOkCancel​(android.app.Activity activity, int title, int message, int okButtonTitle, int cancelButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener, android.content.DialogInterface.OnDismissListener onDismissListener)
      Show the message via a AlertDialog object.
      static void alertOkCancel​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, java.lang.String cancelButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener)
      Show the message via a AlertDialog object.
      static void alertOkCancel​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, java.lang.String cancelButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener, boolean cancellable)  
      static void alertOkCancelNeutral​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, java.lang.String cancelButtonTitle, java.lang.String neutralButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener, android.content.DialogInterface.OnClickListener neutralListener, android.content.DialogInterface.OnDismissListener onDismissListener)
      Show the message via a AlertDialog object.
      static void alertOkCancelWithLinks​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, android.content.DialogInterface.OnClickListener okListener, boolean cancellable)  
      static void alertOkCancelWithLinks​(android.app.Activity activity, java.lang.String title, java.lang.String message, java.lang.String okButtonTitle, java.lang.String cancelButtonTitle, android.content.DialogInterface.OnClickListener okListener, android.content.DialogInterface.OnClickListener cancelListener, boolean cancellable)  
      static void createNotification​(android.content.Context context, int id, int color, java.lang.String type, java.lang.String message, boolean autoCancel, android.app.PendingIntent pendingIntent)  
      static void snack​(android.view.View view, java.lang.String message)
      Show the message via a Snackbar object.
      static void snack​(android.view.View view, java.lang.String message, int duration)
      Show the message via a Snackbar object.
      static void snack​(android.view.View view, java.lang.String message, java.lang.String actionText, android.view.View.OnClickListener listener, int duration)
      Show the message via a Snackbar object.
      static void toast​(android.content.Context context, int message)
      Show the message via a Toast object.
      static void toast​(android.content.Context context, int message, int duration)
      Show the message via a Toast object.
      static void toast​(android.content.Context context, java.lang.String message)
      Show the message via a Toast object.
      static void toast​(android.content.Context context, java.lang.String message, int duration)
      Show the message via a Toast object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Notify

        public Notify()
    • Method Detail

      • toast

        @UiThread
        public static void toast​(android.content.Context context,
                                 java.lang.String message)
        Show the message via a Toast object. NOTE: Default duration is Toast.LENGTH_LONG
        Parameters:
        context - the current Android Context
        message - the message to be shown to the user
      • toast

        public static void toast​(android.content.Context context,
                                 @StringRes
                                 int message)
        Show the message via a Toast object. NOTE: Default duration is Toast.LENGTH_LONG
        Parameters:
        context - the current Android Context
        message - the message to be shown to the user
      • toast

        @UiThread
        public static void toast​(android.content.Context context,
                                 java.lang.String message,
                                 int duration)
        Show the message via a Toast object.
        Parameters:
        context - the current Android Context
        message - the message to be shown to the user
        duration - the Toast duration
      • toast

        @UiThread
        public static void toast​(android.content.Context context,
                                 @StringRes
                                 int message,
                                 int duration)
        Show the message via a Toast object.
        Parameters:
        context - the current Android Context
        message - the message to be shown to the user
        duration - the Toast duration
      • snack

        @UiThread
        public static void snack​(android.view.View view,
                                 java.lang.String message)
        Show the message via a Snackbar object. NOTE: Default duration is BaseTransientBottomBar.LENGTH_LONG
        Parameters:
        view - the view to anchor the Snackbar to
        message - the message to be shown to the user
      • snack

        @UiThread
        public static void snack​(android.view.View view,
                                 java.lang.String message,
                                 int duration)
        Show the message via a Snackbar object.
        Parameters:
        view - the view to anchor the Snackbar to
        message - the message to be shown to the user
        duration - the Snackbar duration
      • snack

        @UiThread
        public static void snack​(android.view.View view,
                                 java.lang.String message,
                                 java.lang.String actionText,
                                 android.view.View.OnClickListener listener,
                                 int duration)
        Show the message via a Snackbar object. NOTE: Default duration is BaseTransientBottomBar.LENGTH_LONG
        Parameters:
        view - the view to anchor the Snackbar to
        message - the message to be shown to the user
        actionText - the text for the action button
        listener - the listener for clicking the action button
        duration - the Snackbar duration
      • createNotification

        public static void createNotification​(android.content.Context context,
                                              int id,
                                              int color,
                                              java.lang.String type,
                                              java.lang.String message,
                                              boolean autoCancel,
                                              android.app.PendingIntent pendingIntent)
      • alertOk

        public static void alertOk​(android.app.Activity activity,
                                   java.lang.String title,
                                   java.lang.String message)
        Show the message via a AlertDialog object. NOTE: Default title is "Ok"
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
      • alertOk

        public static void alertOk​(android.app.Activity activity,
                                   @StringRes
                                   int title,
                                   @StringRes
                                   int message)
        Show the message via a AlertDialog object. NOTE: Default title is "Ok"
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
      • alertOk

        public static void alertOk​(android.app.Activity activity,
                                   java.lang.String title,
                                   java.lang.String message,
                                   java.lang.String okButtonTitle,
                                   android.content.DialogInterface.OnClickListener okListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
      • alertOk

        public static void alertOk​(android.app.Activity activity,
                                   java.lang.String title,
                                   java.lang.String message,
                                   java.lang.String okButtonTitle,
                                   android.content.DialogInterface.OnClickListener okListener,
                                   boolean cancellable)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
        cancellable - true to make dialog cancellable, else false
      • alertOk

        public static void alertOk​(android.app.Activity activity,
                                   @StringRes
                                   int title,
                                   @StringRes
                                   int message,
                                   @StringRes
                                   int okButtonTitle,
                                   android.content.DialogInterface.OnClickListener okListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
      • alertOkCancel

        public static void alertOkCancel​(android.app.Activity activity,
                                         java.lang.String title,
                                         java.lang.String message,
                                         java.lang.String okButtonTitle,
                                         java.lang.String cancelButtonTitle,
                                         android.content.DialogInterface.OnClickListener okListener,
                                         android.content.DialogInterface.OnClickListener cancelListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
        cancelButtonTitle - the negative button title
        cancelListener - the negative button listener
      • alertOkCancel

        public static void alertOkCancel​(android.app.Activity activity,
                                         java.lang.String title,
                                         java.lang.String message,
                                         java.lang.String okButtonTitle,
                                         java.lang.String cancelButtonTitle,
                                         android.content.DialogInterface.OnClickListener okListener,
                                         android.content.DialogInterface.OnClickListener cancelListener,
                                         boolean cancellable)
      • alertOkCancelWithLinks

        public static void alertOkCancelWithLinks​(android.app.Activity activity,
                                                  java.lang.String title,
                                                  java.lang.String message,
                                                  java.lang.String okButtonTitle,
                                                  android.content.DialogInterface.OnClickListener okListener,
                                                  boolean cancellable)
      • alertOkCancelWithLinks

        public static void alertOkCancelWithLinks​(android.app.Activity activity,
                                                  java.lang.String title,
                                                  java.lang.String message,
                                                  java.lang.String okButtonTitle,
                                                  java.lang.String cancelButtonTitle,
                                                  android.content.DialogInterface.OnClickListener okListener,
                                                  android.content.DialogInterface.OnClickListener cancelListener,
                                                  boolean cancellable)
      • alertOkCancel

        public static void alertOkCancel​(android.app.Activity activity,
                                         @StringRes
                                         int title,
                                         @StringRes
                                         int message,
                                         @StringRes
                                         int okButtonTitle,
                                         @StringRes
                                         int cancelButtonTitle,
                                         android.content.DialogInterface.OnClickListener okListener,
                                         android.content.DialogInterface.OnClickListener cancelListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
        cancelButtonTitle - the negative button title
        cancelListener - the negative button listener
      • alertOkCancel

        public static void alertOkCancel​(android.app.Activity activity,
                                         @StringRes
                                         int title,
                                         @StringRes
                                         int message,
                                         @StringRes
                                         int okButtonTitle,
                                         @StringRes
                                         int cancelButtonTitle,
                                         android.content.DialogInterface.OnClickListener okListener,
                                         android.content.DialogInterface.OnClickListener cancelListener,
                                         android.content.DialogInterface.OnDismissListener onDismissListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
        cancelButtonTitle - the negative button title
        cancelListener - the negative button listener
        onDismissListener - callback after dismiss dialog
      • alertOkCancelNeutral

        public static void alertOkCancelNeutral​(android.app.Activity activity,
                                                java.lang.String title,
                                                java.lang.String message,
                                                java.lang.String okButtonTitle,
                                                java.lang.String cancelButtonTitle,
                                                java.lang.String neutralButtonTitle,
                                                android.content.DialogInterface.OnClickListener okListener,
                                                android.content.DialogInterface.OnClickListener cancelListener,
                                                android.content.DialogInterface.OnClickListener neutralListener,
                                                android.content.DialogInterface.OnDismissListener onDismissListener)
        Show the message via a AlertDialog object.
        Parameters:
        activity - the Android Activity
        title - the title for the AlertDialog
        message - the message to be shown to the user
        okButtonTitle - the positive button title
        okListener - the positive button listener
        cancelButtonTitle - the negative button title
        cancelListener - the negative button listener
        neutralButtonTitle - the neutral button title
        neutralListener - the neutral button listener
        onDismissListener - callback after dismiss dialog