-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
William Mora
committed
Sep 24, 2014
1 parent
eecd20d
commit c343fd5
Showing
1 changed file
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ Library that implements <a href="http://www.google.com/design/spec/components/sn | |
You can import the library from source as a module or grab via Gradle: | ||
<br /> | ||
```groovy | ||
compile 'com.williammora:snackbar:1.1.0' | ||
compile 'com.williammora:snackbar:1.2.0' | ||
``` | ||
## Usage | ||
<br /> | ||
|
@@ -34,6 +34,19 @@ Snackbar.with(getApplicationContext()) // context | |
}) // action button's ActionClickListener | ||
.show(this); // activity where it is displayed | ||
``` | ||
If you need to know when the <code>Snackbar</code> is dismissed, assign a <code>DismissListener</code>: | ||
<br /> | ||
```java | ||
Snackbar.with(getApplicationContext()) // context | ||
.text("This will do something when dismissed") // text to display | ||
.dismissListener(new Snackbar.DismissListener() { | ||
@Override | ||
public void onDismiss() { | ||
Log.d(TAG, "Snackbar dismissed"); | ||
} | ||
}) // Snackbar's DismissListener | ||
.show(this); // activity where it is displayed | ||
``` | ||
There are two <code>Snackbar</code> types: single-line (default) and multi-line (2 lines max). You can also set the duration of the <code>Snackbar</code> similar to a <a href="http://developer.android.com/reference/android/widget/Toast.html"><code>Toast</code></a>. Animation disabling is also possible. | ||
<br /> | ||
```java | ||
|
@@ -62,11 +75,16 @@ Snackbar.with(getApplicationContext()) // context | |
}) // action button's ActionClickListener | ||
.show(this); // activity where it is displayed | ||
``` | ||
It uses <a href="https://github.com/romannurik/android-swipetodismiss">Roman Nurik's SwipeToDismiss sample code</a> to implement the swipe-to-dimiss functionality.<br /><br /> | ||
If you would like to add features to it or report any bugs, refer to the <a href="https://github.com/wmora/snackbar/issues">issues</a> section.<br /><br /> | ||
It uses [Roman Nurik's SwipeToDismiss sample code](https://github.com/romannurik/android-swipetodismiss) to implement the swipe-to-dimiss functionality.<br /><br /> | ||
If you would like to add features to it or report any bugs, refer to the [issues](https://github.com/wmora/snackbar/issues) section.<br /><br /> | ||
|
||
# Examples | ||
There's a sample app included in the project. [SnackbarSampleActivity](./sample/src/main/java/com/williammora/sample/snackbar/SnackbarSampleActivity.java) is where you want to start. | ||
|
||
# Developed By | ||
# Contributors | ||
+ William Mora - [@_williammora](https://twitter.com/_williammora) - [email protected] | ||
+ [Lewis Deane](https://github.com/lewisjdeane) | ||
+ [Andrew Hughes](https://github.com/ashughes) | ||
|
||
## License | ||
[MIT](./LICENSE) |