Class Notify
- java.lang.Object
-
- com.cheetahdigital.corekit.helpers.Notify
-
public final class Notify extends java.lang.Object
Helper class for showing soft notifications to the user viaToast
,Snackbar
, andAlertDialog
-
-
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 aAlertDialog
object.static void
alertOk(android.app.Activity activity, int title, int message, int okButtonTitle, android.content.DialogInterface.OnClickListener okListener)
Show the message via aAlertDialog
object.static void
alertOk(android.app.Activity activity, java.lang.String title, java.lang.String message)
Show the message via aAlertDialog
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 aAlertDialog
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 aAlertDialog
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 aAlertDialog
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 aAlertDialog
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 aAlertDialog
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 aAlertDialog
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 aSnackbar
object.static void
snack(android.view.View view, java.lang.String message, int duration)
Show the message via aSnackbar
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 aSnackbar
object.static void
toast(android.content.Context context, int message)
Show the message via aToast
object.static void
toast(android.content.Context context, int message, int duration)
Show the message via aToast
object.static void
toast(android.content.Context context, java.lang.String message)
Show the message via aToast
object.static void
toast(android.content.Context context, java.lang.String message, int duration)
Show the message via aToast
object.
-
-
-
Method Detail
-
toast
@UiThread public static void toast(android.content.Context context, java.lang.String message)
Show the message via aToast
object. NOTE: Default duration isToast.LENGTH_LONG
- Parameters:
context
- the current AndroidContext
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 aToast
object. NOTE: Default duration isToast.LENGTH_LONG
- Parameters:
context
- the current AndroidContext
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 aToast
object.- Parameters:
context
- the current AndroidContext
message
- the message to be shown to the userduration
- theToast
duration
-
toast
@UiThread public static void toast(android.content.Context context, @StringRes int message, int duration)
Show the message via aToast
object.- Parameters:
context
- the current AndroidContext
message
- the message to be shown to the userduration
- theToast
duration
-
snack
@UiThread public static void snack(android.view.View view, java.lang.String message)
Show the message via aSnackbar
object. NOTE: Default duration isBaseTransientBottomBar.LENGTH_LONG
- Parameters:
view
- the view to anchor theSnackbar
tomessage
- 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 aSnackbar
object.- Parameters:
view
- the view to anchor theSnackbar
tomessage
- the message to be shown to the userduration
- theSnackbar
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 aSnackbar
object. NOTE: Default duration isBaseTransientBottomBar.LENGTH_LONG
- Parameters:
view
- the view to anchor theSnackbar
tomessage
- the message to be shown to the useractionText
- the text for the action buttonlistener
- the listener for clicking the action buttonduration
- theSnackbar
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 aAlertDialog
object. NOTE: Default title is "Ok"- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
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 aAlertDialog
object. NOTE: Default title is "Ok"- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- the positive button listenercancellable
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- the positive button listenercancelButtonTitle
- the negative button titlecancelListener
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- the positive button listenercancelButtonTitle
- the negative button titlecancelListener
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- the positive button listenercancelButtonTitle
- the negative button titlecancelListener
- the negative button listeneronDismissListener
- 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 aAlertDialog
object.- Parameters:
activity
- the AndroidActivity
title
- the title for theAlertDialog
message
- the message to be shown to the userokButtonTitle
- the positive button titleokListener
- the positive button listenercancelButtonTitle
- the negative button titlecancelListener
- the negative button listenerneutralButtonTitle
- the neutral button titleneutralListener
- the neutral button listeneronDismissListener
- callback after dismiss dialog
-
-