src/main/java/de/blau/android/util/Snack.java
/**
     * Display a snackbar with an warning message with a possible action
     * 
     * @param v view to display the snackbar on
     * @param msg message to display
     * @param actionRes action text resrouce id
     * @param listener called when action is selected
     */
Display a snackbar with an warning message with a possible action

@param v view to display the snackbar on
@param msg message to display
@param actionRes action text resrouce id
@param listener called when action is selected
Display a snackbar with an warning message with a possible action @param v view to display the snackbar on @param msg message to display @param actionRes action text resrouce id @param listener called when action is selected
public static void barWarning(@Nullable View v, @NonNull String msg, int actionRes, View.OnClickListener listener) {
        if (v == null) {
            Log.e(DEBUG_TAG, NULL_VIEW_IN_BAR_WARNING);
            return;
        }
        try {
            Snackbar snackbar = Snackbar.make(v, msg, Snackbar.LENGTH_LONG);
            snackbar.setDuration(SHOW_DURATION_ACTION);
            snackbar.getView().setBackgroundColor(ThemeUtils.getStyleAttribColorValue(v.getContext(), R.attr.snack_warning, R.color.material_yellow));
            snackbar.setActionTextColor(ContextCompat.getColor(v.getContext(), R.color.ccc_white));
            snackbar.setAction(actionRes, listener);
            snackbar.addCallback(callback);
            enqueueWarning(snackbar);
        } catch (IllegalArgumentException e) {
            Log.e(DEBUG_TAG, "barWarning got " + e.getMessage());
        }
    }
public static void barWarning ( @ Nullable View v , @ NonNull String msg , int actionRes , View . OnClickListener listener ) { if ( v == null ) { Log . e ( DEBUG_TAG , NULL_VIEW_IN_BAR_WARNING ) ; return ; } try { Snackbar snackbar = Snackbar . make ( v , msg , Snackbar . LENGTH_LONG ) ; snackbar . setDuration ( SHOW_DURATION_ACTION ) ; snackbar . getView ( ) . setBackgroundColor ( ThemeUtils . getStyleAttribColorValue ( v . getContext ( ) , R . attr . snack_warning , R . color . material_yellow ) ) ; snackbar . setActionTextColor ( ContextCompat . getColor ( v . getContext ( ) , R . color . ccc_white ) ) ; snackbar . setAction ( actionRes , listener ) ; snackbar . addCallback ( callback ) ; enqueueWarning ( snackbar ) ; } catch ( IllegalArgumentException e ) { Log . e ( DEBUG_TAG , "barWarning got " + e . getMessage ( ) ) ; } }
Display a snackbar with an warning message with a possible action
Display a snackbar with an warning message with a possible action