Utility

public final class Utility

Utility class for most common UI Android activities

Methods

getViewgroup

public static ViewGroup getViewgroup(Activity activity)

Gets the viewgroup corresponding to an activity

Parameters:
  • activity – Activity from where are you
Returns:

Activity viewgroup

hideKeyboard

public static void hideKeyboard(Activity context)

Hides the soft keyboard

Parameters:
  • context – Caller activity

showMessage

public static void showMessage(String message, View coordinatorLayout)

Show a message in a snackbar

Parameters:
  • message – Message to show
  • coordinatorLayout – layout coordinator where snackbar should be displayed

showMessage

public static void showMessage(String message, View coordinatorLayout, String buttonString, int displayTime)

Show a message in a snackbar

Parameters:
  • message – Message to show
  • coordinatorLayout – layout coordinator where snackbar should be displayed
  • buttonString – String to use as snackbar “ok” button
  • displayTime – Time that should be the snackbar visible (Snackbar.LENGTH_*)

showMessage

public static void showMessage(String message, View coordinatorLayout, String buttonString)

Show a message in a snackbar

Parameters:
  • message – Message to show
  • coordinatorLayout – layout coordinator where snackbar should be displayed
  • buttonString – String to use as snackbar “ok” button

showMessage

public static void showMessage(String message, View coordinatorLayout, int displayTime)

Show a message in a snackbar

Parameters:
  • message – Message to show
  • coordinatorLayout – layout coordinator where snackbar should be displayed
  • displayTime – Time that should be the snackbar visible (Snackbar.LENGTH_*)