Skip to content
Tiny library that uses Android Design Support Library and lets you create and show snackbars in a fluent manner.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
art Fixes. Apr 4, 2016
fluentsnackbar-sample Update for sample apk. Dec 25, 2016
fluentsnackbar Closed #3. Dec 25, 2016
gradle/wrapper - updated dependencies Dec 25, 2016
.gitignore Init. Apr 4, 2016
LICENSE.txt MIT license. Apr 5, 2016
README.md Closed #3. Dec 25, 2016
build.gradle - updated dependencies Dec 25, 2016
gradle.properties Init. Apr 4, 2016
gradlew Init. Apr 4, 2016
gradlew.bat Init. Apr 4, 2016
settings.gradle Fluent API. Apr 4, 2016

README.md

FluentSnackbar

Release Android Arsenal

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.

Screenshot

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'
}
You can’t perform that action at this time.