https://github.com/MrEngineer13/SnackBar
toast-like alert pattern for Android inspired by the Google Material Design Spec
https://github.com/MrEngineer13/SnackBar
hacktoberfest hacktoberfest2020
Last synced: 5 months ago
JSON representation
toast-like alert pattern for Android inspired by the Google Material Design Spec
- Host: GitHub
- URL: https://github.com/MrEngineer13/SnackBar
- Owner: MrEngineer13
- License: apache-2.0
- Created: 2014-08-21T01:46:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-10-15T04:40:58.000Z (over 4 years ago)
- Last Synced: 2024-08-05T19:35:40.954Z (9 months ago)
- Topics: hacktoberfest, hacktoberfest2020
- Language: Java
- Homepage:
- Size: 467 KB
- Stars: 1,222
- Watchers: 59
- Forks: 174
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android-ui - https://github.com/MrEngineer13/SnackBar
README
# SnackBar; toast-like alert pattern for Android inspired by the [Google Material Design Spec](http://www.google.com/design/spec/components/snackbars-and-toasts.html)
[](https://android-arsenal.com/details/1/869)

# Deprecated
This library is deprecated in favor of the new [Design Support Library](http://developer.android.com/tools/support-library/features.html#design) which includes a [Snackbar](http://developer.android.com/reference/android/support/design/widget/Snackbar.html). It is due to this development that this library is no longer activly being developed.
# Features
* Set message text and optionally duration
* Shows only one message at a time
* Can have action item (e.g. undo, refresh, etc.)
* Set text color of action items
* Swipe down to dismiss all notifications as per documentation
* Backwards compatible to 2.3.x#### New Features since 1.0.0
* Set custom background color
* Set custom height
* Set custom typeface
[](https://play.google.com/store/apps/details?id=com.mrengineer13.snackbar.sample)
# Usage
1. Add SnackBar to your project
###Maven
Just add the following to your `build.gradle`.dependencies {
compile 'com.github.mrengineer13:snackbar:1.2.0'
}2. Show a message
#### Build SnackBar in Activity
new SnackBar.Builder(this)
.withOnClickListener(this)
.withMessage("This library is awesome!") // OR
.withMessageId(messageId)
.withTypeFace(myAwesomeTypeFace).withActionMessage("Action") // OR
.withActionMessageId(actionMsgId).withTextColorId(textColorId)
.withBackGroundColorId(bgColorId)
.withVisibilityChangeListener(this)
.withStyle(style)
.withDuration(duration)
.show();#### Build SnackBar in Fragment
new SnackBar.Builder(getActivity().getApplicationContext(), root)
.withOnClickListener(this)
.withMessage("This library is awesome!") // OR
.withMessageId(messageId)
.withTypeFace(myAwesomeTypeFace).withActionMessage("Action") // OR
.withActionMessageId(actionMsgId).withTextColorId(textColorId)
.withBackGroundColorId(bgColorId)
.withVisibilityChangeListener(this)
.withStyle(style)
.withDuration(duration)
.show();## Using this library?
If you're using this library in one of your projects just [send me a tweet](https://twitter.com/MrEngineer13) and I'll add your project to the list.
Icon | Application
------------ | -------------| [Plume]
| [Score It]
| [Lotería Navidad 2014]
| [Journal]
| [My Garage]
| [QuoteMe]
# Contribution
## Pull requests are welcome!Feel free to contribute to SnackBar.
Just create your branch then submit pull request on the dev branch.
If you have a bug to report a feature to request or have other questions, [file an issue](https://github.com/MrEngineer13/SnackBar/issues/new). I'll try to answer as soon as I can.
[Plume]:https://play.google.com/store/apps/details?id=com.levelup.touiteur
[Score It]:https://play.google.com/store/apps/details?id=com.sbgapps.scoreit
[Lotería Navidad 2014]:https://play.google.com/store/apps/details?id=com.moya.garcia.loterianavidad&hl=es
[Journal]:https://play.google.com/store/apps/details?id=com.journey.app
[My Garage]:https://play.google.com/store/apps/details?id=com.moremu.mygarage
[QuoteMe]:https://play.google.com/store/apps/details?id=com.wching.quoteme