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

D2a06312762581d504ba0a25e5a90def?s=128

Benjamin Weiss

October 13, 2012
Tweet

Transcript

  1. Crouton Context sensitive notifications for Android

  2. 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
  3. Agenda • What is a Crouton? • Problems with Toast

    • What does a Crouton look like? • Usage • Getting started • Sources
  4. 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]
  5. A Crouton is made of bread, like a Toast. Now

    what has it to do with Android?
  6. Context aware alternative to Android's Toast Now what has it

    to do with Android?
  7. Problems with Toast • Toast is not context aware

  8. Problems with Toast • Toast is not context aware

  9. Problems with Toast • Toast is not context aware •

    Styling Toasts
  10. Problems with Toast • Toast is not context aware •

    Styling Toasts
  11. What does a Crouton look like? Any way you want

  12. What does a Crouton look like? There are three predefined

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

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

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

    styles: Style.INFO Style.CONFIRM Style.ALERT
  16. What does a Crouton look like?

  17. 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
  18. 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();
  19. Usage within your code //Cancels all pending Croutons Crouton.cancelAllCroutons(); //Clear

    all Croutons for an Activity Crouton.clearCroutonsForActivity();
  20. 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>
  21. Getting started https://github.com/ keyboardsurfer/Crouton/downloads https://github.com/downloads/ keyboardsurfer/Crouton/crouton-1.4.jar

  22. Demo App

  23. None
  24. https://github.com/keyboardsurfer/Crouton

  25. Sources [1] https://en.wikipedia.org/wiki/Crouton [2] http://android.cyrilmottier.com/?p=773 [3] https://github.com/keyboardsurfer/Crouton [4] http://marie-schweiz.de

  26. Thank you

  27. Questions Benjamin Weiss http://gplus.to/keyboardsurfer Twitter: @keyboardsurfer