CookieBar is a lightweight library for showing a brief message at the top or bottom of the screen.

CookieV

Cookie

Usage

Gradle

dependencies {
   	compile 'com.liuguangqiang.cookie:library:1.0'
}

Maven

<dependency>
  <groupId>com.liuguangqiang.cookie</groupId>
  <artifactId>library</artifactId>
  <version>1.0</version>
  <type>aar</type>
</dependency>

A simple CookieBar.

 new CookieBar.Builder(MainActivity.this)
                        .setTitle("TITLE")
                        .setMessage("MESSAGE")
                        .show();

A CookieBar with a icon and a action button.

 new CookieBar.Builder(MainActivity.this)
                        .setTitle("TITLE")
                        .setIcon(R.mipmap.ic_launcher)
                        .setMessage("MESSAGE")
                        .setAction("ACTION", new OnActionClickListener() {
                            @Override
                            public void onClick() {
                            }
                        })
                        .show();

You can change the default style by set the Theme's attributes.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
   <item name="cookieTitleColor">@color/default_title_color</item>
   <item name="cookieMessageColor">@color/default_message_color</item>
   <item name="cookieActionColor">@color/default_action_color</item>
   <item name="cookieBackgroundColor">@color/default_bg_color</item>
</style>

Or dynamically change the style with a cookie builder.

  • layoutGravity
  • backgroundColor
  • titleColor
  • messageColor
  • actionColor
  • duration

New Features

1.0.0

  • The action button could be replaced by a icon.

GitHub