Skip to content

Latest commit

 

History

History
111 lines (72 loc) · 2.9 KB

README.md

File metadata and controls

111 lines (72 loc) · 2.9 KB

License: MIT

FloatingSnackBar

Gmail Style Floating Snackbar with Custom Functionality.

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file) :

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
		implementation 'com.google.android.material:material:1.2.0'
		implementation 'com.github.ankushyerawar:FloatingSnackBar:1.0.3'
	}

Versions

Version 0.1.0

First Release.

Version 1.0.0

Added a New Functionality to add icon to Normal Snackbar.

Version 1.0.1

Now you can change Icons of Default SnackBar Methods like success, error by passing Resource Id.

Version 1.0.2

Some small changes and Error handling.

Version 1.0.3

Now supports material design librery 1.1.0 and 1.2.0. All new featrue to support text RTL.

Sneak Peek

device-2019-12-12-104334

Usage

Each method always returns a Snackbar object, so you can customize the Snackbar much more. DON'T FORGET THE show() METHOD!

To display an error Snackbar:

SnackBar.error(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show();

To display a success Snackbar:

SnackBar.success(view, R.string.app_name, SnackBar.LENGTH_LONG).show();

To display an info Snackbar:

SnackBar.info(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show();

To display a warning Snackbar:

SnackBar.warning(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show();

To display the usual Snackbar:

SnackBar.normal(getView(),R.string.app_name, SnackBar.LENGTH_LONG).show();

To display the usual Snackbar with icon:

SnackBar.normal(getView(),"Snackbar with icon", SnackBar.LENGTH_LONG, R.drawable.ic_normal).show();

You can also create your custom Snackbar with the custom() method:

SnackBar.custom(view, R.string.app_name, SnackBar.LENGTH_LONG,R.drawable.ic_custom, Color.DKGRAY, Color.WHITE,true).show();

Here, This method also supports text rtl.

Extra

There are variants of each method, feel free to explore this library.

Pull Request

Have some new ideas or found a bug? Do not hesitate to open an issue and make a pull request.

License

This library is under MIT License. See the License file for more info.

Follow Me On

Ankush Yerawar's DEV Profile