src/main/java/de/blau/android/util/Snack.java
/**
     * Enqueue a snackbar on a queue removing items if space is exhausted
     * 
     * Note: caller needs to provide synchronization
     * 
     * @param queue the queue to use
     * @param s the snackbar to queue
     */
Enqueue a snackbar on a queue removing items if space is exhausted

caller needs to provide synchronization

@param queue the queue to use
@param s the snackbar to queue
Enqueue a snackbar on a queue removing items if space is exhausted caller needs to provide synchronization @param queue the queue to use @param s the snackbar to queue
static void enqueue(LinkedList<Snackbar> queue, Snackbar s) {
        if (queue.size() >= QUEUE_CAPACITY) {
            Snackbar first = queue.peekFirst();
            if (first != null) {
                queue.removeFirst();
                if (first.isShown()) {
                    first.dismiss(); 
                }
            }
        }
        queue.offer(s);
    }
static void enqueue ( LinkedList < Snackbar > queue , Snackbar s ) { if ( queue . size ( ) >= QUEUE_CAPACITY ) { Snackbar first = queue . peekFirst ( ) ; if ( first != null ) { queue . removeFirst ( ) ; if ( first . isShown ( ) ) { first . dismiss ( ) ; } } } queue . offer ( s ) ; }
Enqueue a snackbar on a queue removing items if space is exhausted
Enqueue a snackbar on a queue removing items if space is exhausted
// will try to remove itself but that is OK