Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Crouton DevFest Berlin 2012

Crouton DevFest Berlin 2012

Slides of my talk on the Crouton library at the DevFest Berlin 2012. The talk is also available as a video here: http://vimeo.com/51356663

Benjamin Weiss

October 13, 2012
Tweet

More Decks by Benjamin Weiss

Other Decks in Technology

Transcript

  1. Benjamin Weiss http://gplus.to/keyboardsurfer Twitter: @keyboardsurfer Senior Software Developer at ImmobilienScout24

    Organizer: GDG Android in Berlin Co-Organizer: • Global Android Dev Camp • GTUG Community Weekend • Google I/O Extended Berlin 2012 • DevFest Berlin 2012
  2. Agenda • What is a Crouton? • Problems with Toast

    • What does a Crouton look like? • Usage • Getting started • Sources
  3. What is a Crouton "A crouton is a piece of

    sautéed or rebaked bread, often cubed and seasoned, that is used to add texture and flavor to salads [...] as an accompaniment to soups, or eaten as a snack food. The word crouton is derived from the French [...] meaning "crust"." [1]
  4. A Crouton is made of bread, like a Toast. Now

    what has it to do with Android?
  5. What does a Crouton look like? There are three predefined

    styles: Style.INFO Style.CONFIRM Style.ALERT
  6. What does a Crouton look like? There are three predefined

    styles: Style.INFO Style.CONFIRM Style.ALERT
  7. What does a Crouton look like? Any way you want

    new Style.Builder() .setDuration(int) //in milliseconds .setTextColor(int) //resId .setBackgroundDrawable(Drawable) //background drawable .setBackgroundColor(int) //resource id .setTileEnabled(boolean) //whether the image should be tiled .setHeight(int) // WRAP_CONTENT or MATCH_PARENT .setImageResource(int) //resId .setTextShadowRadius(float) //shadow radius .setGravity(int) //one of the Gravity constants .setTextAppearance(int) //resId .setInAnimation(Animation) //in animation // more options .build(); //creates the Style
  8. Usage within your code //Crouton with String Crouton. makeText(this, "Hello

    Crouton", Style.INFO). show(); //Crouton with text resource Crouton. makeText(this, R.string.hello, Style.INFO). show();
  9. Usage within your code //Cancels all pending Croutons Crouton.cancelAllCroutons(); //Clear

    all Croutons for an Activity Crouton.clearCroutonsForActivity();
  10. Getting started # clones Crouton to your machine git clone

    git://github.com/keyboardsurfer/Crouton.git # will install Crouton to your local maven repository cd library && mvn install <!--include this in your pom.xml's dependency section--> <dependency> <artifactId>crouton</artifactId> <version>1.4</version> <groupId>de.keyboardsurfer.android.widget</groupId> </dependency>