Crouton
-
Upload
benjamin-weiss -
Category
Technology
-
view
561 -
download
0
description
Transcript of Crouton
![Page 1: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/1.jpg)
CroutonContext sensitive notifications for Android
![Page 2: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/2.jpg)
Benjamin Weisshttp://gplus.to/keyboardsurferTwitter: @keyboardsurfer
Senior Software Developerat ImmobilienScout24
Organizer: GDG Android in Berlin
Co-Organizer:● Global Android Dev Camp● GTUG Community Weekend● Google I/O Extended Berlin 2012● DevFest Berlin 2012
![Page 3: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/3.jpg)
Agenda
● What is a Crouton?● Problems with Toast● What does a Crouton look like?● Usage● Getting started● Sources
![Page 4: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/4.jpg)
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]
![Page 5: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/5.jpg)
A Crouton is made of bread, like a Toast.
Now what has it to do with Android?
![Page 6: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/6.jpg)
Context aware alternative to Android's Toast
Now what has it to do with Android?
![Page 7: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/7.jpg)
Problems with Toast
● Toast is not context aware
![Page 8: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/8.jpg)
Problems with Toast
● Toast is not context aware
![Page 9: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/9.jpg)
Problems with Toast
● Toast is not context aware● Styling Toasts
![Page 10: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/10.jpg)
Problems with Toast
● Toast is not context aware● Styling Toasts
![Page 11: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/11.jpg)
What does a Crouton look like?
Any way you want
![Page 12: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/12.jpg)
What does a Crouton look like?
There are three predefined styles:
Style.INFO
Style.CONFIRM
Style.ALERT
![Page 13: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/13.jpg)
What does a Crouton look like?
There are three predefined styles:
Style.INFO
![Page 14: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/14.jpg)
What does a Crouton look like?
There are three predefined styles:
Style.INFO
Style.CONFIRM
![Page 15: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/15.jpg)
What does a Crouton look like?
There are three predefined styles:
Style.INFO
Style.CONFIRM
Style.ALERT
![Page 16: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/16.jpg)
What does a Crouton look like?
![Page 17: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/17.jpg)
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
![Page 18: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/18.jpg)
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();
![Page 19: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/19.jpg)
Usage within your code
//Cancels all pending Croutons
Crouton.cancelAllCroutons();
//Clear all Croutons for an Activity
Crouton.clearCroutonsForActivity();
![Page 20: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/20.jpg)
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>
![Page 21: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/21.jpg)
Getting started
https://github.com/
keyboardsurfer/Crouton/downloads
https://github.com/downloads/
keyboardsurfer/Crouton/crouton-1.4.jar
![Page 22: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/22.jpg)
Demo App
![Page 23: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/23.jpg)
![Page 24: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/24.jpg)
https://github.com/keyboardsurfer/Crouton
![Page 25: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/25.jpg)
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
![Page 26: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/26.jpg)
Thank you
![Page 27: Crouton](https://reader033.fdocuments.in/reader033/viewer/2022052900/555e280ed8b42a6a4c8b5021/html5/thumbnails/27.jpg)
Questions
Benjamin Weisshttp://gplus.to/keyboardsurferTwitter: @keyboardsurfer