FluentSnackbar


Source link: https://github.com/AntonyGolovin/FluentSnackbar

FluentSnackbar

Tiny library that uses Android Design Support Library and lets you create and show snackbars in a fluent manner. Contains queue feature. You can also download sample apk.

All you need to know

public class MainActivity extends AppCompatActivity {

private FluentSnackbar mFluentSnackbar;

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

 mFluentSnackbar = FluentSnackbar.create(this);
 // you can also use any View instead of Activity

 mFluentSnackbar.create("Text")

  .maxLines(2) // default is 1 line

  .backgroundColorRes(R.color.purple_500) // default is #323232

  .textColorRes(R.color.blue_grey_500) // default is Color.WHITE

  .duration(Snackbar.LENGTH_SHORT) // default is Snackbar.LENGTH_LONG

  .actionText("Action text") // default is "Action"

  .actionTextColorRes(R.color.colorAccent)

  .important()

  .action(new View.OnClickListener() {

@Override

public void onClick(View v) {

 Toast.makeText(MainActivity.this, "Action clicked", Toast.LENGTH_SHORT).show();

}

  
}
)

  .show();

  
}
 
}
 

If you want to show several messages following one by one you can use important() method. Such snackbars cannot be dismissed by another snackbars and will be shown throughout their duration. So you can create a queue of snackbars. Just call important() and then show() for each FluentSnackbar.Builder.

Gradle dependency

Add this in your root build.gradle:

allprojects {

  repositories {

...

maven {
 url "https://jitpack.io" 
}

  
}
 
}

and then add this in your module build.gradle:

dependencies {

  compile 'com.github.antonygolovin:fluentsnackbar:1.0.0' 
}

Resources

LumberJill is a logging Utility library for Android.

CurrencyEditText is an extension of Android's EditText view object. It is a module designed to provide ease-of-use when using an EditText field for gathering currency information from a user.

A simple spinner for Android with Material Design.

This library allows you to listen to SwipeRefreshLayout start, cancel and finish events.

A reactive wrapper for Android Google Cloud Messaging (aka gcm) to get rid of Service(s) configuration, handling foreground and background notifications depending on application state.

Easily notify a user with a simple alert, inform them of an optional update, and in dire situations block the user from accessing older versions of the application completely.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes