Skip to content

aat-antoine/Crouton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crouton

Crouton

Context sensitive notifications for Android

Overview

Crouton is a class that can be used by Android developers that feel the need for an alternative to the Context insensitive Toast.

A Crouton will be displayed at the top of an application window. You can line up multiple Croutons for display, that will be shown one after another.

As of version 1.5 Crouton can be used on any Android device without API level limitations.

A demo application is available on Google Play

Crouton Demo on Google Play

Usage

The API is kept as simple as the Toast API:

Create a Crouton for any CharSequence:

Crouton.makeText(Activity, CharSequence, Style).show();

Create a Crouton with a String from your application's resources:

Crouton.makeText(Activity, int, Style).show();

You can also cancel scheduled Croutons by calling:

Crouton.cancelAllCroutons();

Examples

Currently you can use the three different Style attributes displayed below out of the box:

Alert

Confirm

Info

Extension and Modification

The whole design of a Crouton is defined by Style. You can easily create your own Styles by calling one of the constructors of the Style class or use one of the already provided styles: Style.ALERT, Style.CONFIRM and Style.INFO.

If you want to modify the general appearance you might want to have a look at the ViewHolder.

Building

The build requires Maven. Operations are very simple:

  • mvn -f library/pom.xml clean package will build jar library;
  • mvn clean package will build jar library and sample application apk package;
  • mvn -f library/pom.xml clean install will put Crouton in your local Maven repository.

After putting Crouton in the repository you can add it as a dependency.

<dependency>
  <artifactId>crouton</artifactId>
  <version>1.5</version>
  <groupId>de.keyboardsurfer.android.widget</groupId>
</dependency>

Contribution

This section is subject to changes.

For contributors using Eclipse there's a formatter available at the download section. If you want to contribute and create pull requests, make sure to use this formatter or format your commit in a way similar to it's example.

License

Attributions

The name and the idea of Crouton originates in a blog article by Cyril Mottier.

The Crouton logo has been created by Marie Schweiz.

The initial version was written by Benjamin Weiss at Neofonie Mobile GmbH.

About

Context sensitive notifications for Android

Resources

License

Stars

Watchers

Forks

Packages

No packages published