GithubHelp home page GithubHelp logo

battleshippark / snackbar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrengineer13/snackbar

0.0 2.0 0.0 582 KB

toast-like alert pattern for Android inspired by the Google Material Design Spec

License: Apache License 2.0

Java 100.00%

snackbar's Introduction

SnackBar; toast-like alert pattern for Android inspired by the Google Material Design Spec

SnackBar on Android Arsenal

Mr.Waffle

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

SnackBar Screenshot via Google

SnackBar on Google Play

Usage

##1. Add SnackBar to your project ###Maven Just add the following to your build.gradle.

dependencies {
    compile 'com.github.mrengineer13:snackbar:1.0.0'
}

###Eclipse

  1. Download ZIP then extract the SnackBar project
  2. From Eclipse menu: New > Android Project from Existing Code > SnackBar project > Finish
  3. Right click on your project
  4. Android > Library: Add > SnackBar

2. Show a message

Build SnackBar in Activity

new SnackBar.Builder(this)
    .withOnClickListener(this)
    .withMessage("This library is awesome!") // OR
    .withMessageId(messageId)

    .withActionMessage("Action") // OR
    .withActionMessageId(actionMsgId)

    .withTextColorId(textColorId)
    .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)

    .withActionMessage("Action") // OR
    .withActionMessageId(actionMsgId)

    .withTextColorId(textColorId)
    .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 and I'll add your project to the list.

Icon Application
Plume
Score It
Lotería Navidad 2014

Contribution

Pull requests are welcome!

Feel free to contribute to SnackBar.

If you've implemented a bug fix or new feature, just create a pull request on the dev branch.

If you have a bug to report a feature to request or have other questions, file an issue. I'll try to answer as soon as I can.

snackbar's People

Contributors

mrengineer13 avatar stephanebg avatar he-lu avatar aaronrietschlin avatar rashiq avatar battleshippark avatar tasomaniac avatar tommienu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.