Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CookieBar2

> 设计协作
Open source

Android library for displaying text messages, notifications and alerts at the top or bottom of the screen. A great alternative for toast and snackbar alerts.

666 stars0 likes1 views
WebsiteGitHub

About

Android library for displaying text messages, notifications and alerts at the top or bottom of the screen. A great alternative for toast and snackbar alerts.

CookieBar 2

CookieBar is a lightweight UI/UX library for displaying an interactive message on the screen.

gradle
implementation 'org.aviran.cookiebar2:cookiebar2:1.1.5'

CookieBar2 is now hosted in Maven Central, make sure you have mavenCentral() added to your repositories in build.gradle

buildscript {
    ...
    repositories {
        ...
        mavenCentral()
    }
}

Screenshot

Latest additions to CookieBar2:

  • Swipe to dismiss has been added.
  • Programmatic dismiss functionality added.
  • Only one Cookie can be displayed at a time (New top cookie will dismiss the current top one if exists).
  • Message view captures clicks, blocks downward propagation.
  • Slightly different build interface.
  • Icon animator support.
  • Custom layout can be applied to a cookie.
  • Colors presets added.
  • Root view can be overridden and customized.
  • Removed supportRtl / allowBackup from library scope (Set at app level when necessary).

Create a simple cookie

Using Kotlin

kotlin
CookieBar.build(activity)           // Provide activity, using this@MainActivity / getActivity() or otherwise
         .setTitle("TITLE")         // String resources are also supported
         .setMessage("MESSAGE")     // i.e. R.string.message
         .show()                    // Cookies are displayed at the top by default

Using Java

java
CookieBar.build(getactivty())
         .setTitle("TITLE")
         .setMessage("MESSAGE")
         .setCookiePosition(CookieBar.BOTTOM)  // Cookie will be displayed at the bottom
         .show();                              // of the screen

Customize colors, icon, icon animation, call to action button, display duration

kotlin
CookieBar.build(activity)
         .setTitle(R.string.title)
         .setTitleColor(R.color.green)
         .setIcon(R.drawable.icon)
         .setIconAnimation(R.animator.spin)
         .setMessage(R.string.message)
         .setAction(R.string.action_text) { 
              // Action code - Do something
         }
         .setDuration(5000) // 5 seconds
         .show()

Customize in/out animation

kotlin
CookieBar.build(activity)
         .setTitle(R.string.title)
         .setMessage(R.string.message)
         .setAnimationIn(android.R.anim.slide_in_left, android.R.anim.slide_in_left)
         .setAnimationOut(android.R.anim.slide_out_right, android.R.anim.slide_out_right)
         .show()

Programmatically dismiss cookies currently being displayed

kotlin
CookieBar.dismiss(activity)

Create a cookie with a custom layout - Create a dialog!

…
…

Change default cookie style by setting theme attributes

xml

Dynamically set cookie properties

  • Cookie position (Top/Bottom)
  • Display duration
  • Title text color
  • Body text color
  • Action text color
  • Background color
  • Icon resource
  • Icon animation
  • In/Out animations for the entire view
  • View layout

Attribution

Forked from the early code base of CookieBar, by Eric Liu.

License

Copyright 2018, Aviran Abady.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaalertdialogandroidandroid-developmentandroid-dialog

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category设计协作
PricingOpen source

> Related tools

F
Figma
协作式界面设计工具
S
sketch-wakatime
Sketch plugin for automatic time tracking and metrics generated from your Sketch usage.
Q
QuickColor
Quickly apply fills from the global or document color palettes to selected elements - 🎨