{"id":15040889,"url":"https://github.com/aviranabady/cookiebar2","last_synced_at":"2025-04-12T01:02:44.058Z","repository":{"id":54493742,"uuid":"96683102","full_name":"AviranAbady/CookieBar2","owner":"AviranAbady","description":"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.","archived":false,"fork":false,"pushed_at":"2022-12-22T22:55:06.000Z","size":429,"stargazers_count":669,"open_issues_count":5,"forks_count":74,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-12T01:02:43.732Z","etag":null,"topics":["alertdialog","android","android-development","android-dialog","android-library","android-message","android-notification","android-notifications","android-snackbar","android-toast","android-toastmessage","android-ui","android-ui-widgets","android-ux","androidx","cookiebar","kotlin","material-design","toast"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AviranAbady.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-09T12:33:27.000Z","updated_at":"2025-04-05T08:19:10.000Z","dependencies_parsed_at":"2023-01-30T17:16:00.853Z","dependency_job_id":null,"html_url":"https://github.com/AviranAbady/CookieBar2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AviranAbady%2FCookieBar2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AviranAbady%2FCookieBar2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AviranAbady%2FCookieBar2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AviranAbady%2FCookieBar2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AviranAbady","download_url":"https://codeload.github.com/AviranAbady/CookieBar2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501871,"owners_count":21114683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alertdialog","android","android-development","android-dialog","android-library","android-message","android-notification","android-notifications","android-snackbar","android-toast","android-toastmessage","android-ui","android-ui-widgets","android-ux","androidx","cookiebar","kotlin","material-design","toast"],"created_at":"2024-09-24T20:45:14.504Z","updated_at":"2025-04-12T01:02:44.035Z","avatar_url":"https://github.com/AviranAbady.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-CookieBar2-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6122)\n[![AndroidWeekly335](https://img.shields.io/badge/Android%20Weekly-%23335-brightgreen)](http://androidweekly.net/issues/issue-335)\n[![](https://jitpack.io/v/AviranAbady/CookieBar2.svg)](https://jitpack.io/#AviranAbady/CookieBar2)\n[![Discord - Support](https://img.shields.io/badge/Discord-Support-7289da )](https://discord.gg/aDvkVpRhmt)\n\n\nCookieBar 2\n===============\nCookieBar is a lightweight UI/UX library for displaying an interactive message on the screen.\u003cbr/\u003e\u003cbr/\u003e\n\n```gradle\nimplementation 'org.aviran.cookiebar2:cookiebar2:1.1.5'\n```\nCookieBar2 is now hosted in Maven Central, make sure you have `mavenCentral()` added to your repositories in `build.gradle`\n\n```\nbuildscript {\n    ...\n    repositories {\n        ...\n        mavenCentral()\n    }\n}\n```\n\n## Screenshot\n\u003cimg src=\"https://raw.githubusercontent.com/AviranAbady/storage/master/cookiebar2_1.1.0.gif\"\u003e\n\nLatest additions to CookieBar2:\n\n* Swipe to dismiss has been added.\n* Programmatic dismiss functionality added.\n* Only one Cookie can be displayed at a time (New top cookie will dismiss the current top one if exists).\n* Message view captures clicks, blocks downward propagation.\n* Slightly different build interface.\n* Icon animator support.\n* Custom layout can be applied to a cookie.\n* Colors presets added.\n* Root view can be overridden and customized.\n* Removed supportRtl / allowBackup from library scope (Set at app level when necessary).\n\n## Create a simple cookie\n### Using Kotlin\n```kotlin\nCookieBar.build(activity)           // Provide activity, using this@MainActivity / getActivity() or otherwise\n         .setTitle(\"TITLE\")         // String resources are also supported\n         .setMessage(\"MESSAGE\")     // i.e. R.string.message\n         .show()                    // Cookies are displayed at the top by default\n```\n### Using Java\n```java\nCookieBar.build(getactivty())\n         .setTitle(\"TITLE\")\n         .setMessage(\"MESSAGE\")\n         .setCookiePosition(CookieBar.BOTTOM)  // Cookie will be displayed at the bottom\n         .show();                              // of the screen\n```\n\n## Customize colors, icon, icon animation, call to action button, display duration\n```kotlin\nCookieBar.build(activity)\n         .setTitle(R.string.title)\n         .setTitleColor(R.color.green)\n         .setIcon(R.drawable.icon)\n         .setIconAnimation(R.animator.spin)\n         .setMessage(R.string.message)\n         .setAction(R.string.action_text) { \n              // Action code - Do something\n         }\n         .setDuration(5000) // 5 seconds\n         .show()\n```\n\n## Customize in/out animation\n```kotlin\nCookieBar.build(activity)\n         .setTitle(R.string.title)\n         .setMessage(R.string.message)\n         .setAnimationIn(android.R.anim.slide_in_left, android.R.anim.slide_in_left)\n         .setAnimationOut(android.R.anim.slide_out_right, android.R.anim.slide_out_right)\n         .show()\n```\n\n## Programmatically dismiss cookies currently being displayed\n```kotlin\nCookieBar.dismiss(activity)\n\n```\n\n\n## Create a cookie with a custom layout - Create a dialog!\n```kotlin\nCookieBar.build(activity)\n         .setCustomView(R.layout.custom_cookie)\n         .setCustomViewInitializer { view -\u003e\n             val btnNew = view.findViewById\u003cButton\u003e(R.id.custom_cookie_btn_new)\n             val btnOpen = view.findViewById\u003cButton\u003e(R.id.custom_cookie_btn_open)\n             val btnSave = view.findViewById\u003cButton\u003e(R.id.custom_cookie_btn_save)\n             val btnListener = View.OnClickListener { view -\u003e\n                 val button = view as Button\n                 button.setText(R.string.clicked)\n             }\n             btnNew.setOnClickListener(btnListener)\n             btnOpen.setOnClickListener(btnListener)\n             btnSave.setOnClickListener(btnListener)\n         }\n         .setAction(\"Close\") { CookieBar.dismiss(activity) }\n         .setTitle(R.string.custom_view_cookie_title)\n         .setMessage(R.string.custom_view_cookie_message)\n         .setEnableAutoDismiss(false)\n         .setSwipeToDismiss(false)\n         .setCookiePosition(Gravity.BOTTOM)\n         .show()\n```\n```java\n/* setCustomView -  Set the layout resource for your custom cookie view.\n   setCustomViewInitializer - Called after layout inflation, for subview setup. */\n\nCookieBar.build(MainActivity.this)\n         .setCustomView(R.layout.custom_cookie)\n         .setCustomViewInitializer(new CookieBar.CustomViewInitializer() {\n                  @Override\n                  public void initView(View view) {\n\n                           Button btnNew = view.findViewById(R.id.custom_cookie_btn_new);\n                           Button btnOpen = view.findViewById(R.id.custom_cookie_btn_open);\n                           Button btnSave = view.findViewById(R.id.custom_cookie_btn_save);\n\n                           View.OnClickListener btnListener = new View.OnClickListener() {\n\n                                    @Override\n                                    public void onClick(View view) {\n                                             Button button = (Button) view;\n                                             button.setText(R.string.clicked);\n                                    }\n                                };\n\n                           btnNew.setOnClickListener(btnListener);\n                           btnOpen.setOnClickListener(btnListener);\n                           btnSave.setOnClickListener(btnListener);\n                  }\n         })\n         .setAction(\"Close\", new OnActionClickListener() {\n                  @Override\n                  public void onClick() {\n                           CookieBar.dismiss(MainActivity.this);\n                  }\n         })\n         .setTitle(R.string.title)\n         .setMessage(R.string.message)\n         .setEnableAutoDismiss(false) // Cookie will stay on display until manually dismissed\n         .setSwipeToDismiss(false)    // Deny dismiss by swiping off the view\n         .setCookiePosition(CookieBar.BOTTOM)\n         .show();\n```\n\n## Change default cookie style by setting theme attributes\n\n```xml\n\u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\"\u003e\n   \u003citem name=\"cookieTitleColor\"\u003e@color/default_title_color\u003c/item\u003e\n   \u003citem name=\"cookieMessageColor\"\u003e@color/default_message_color\u003c/item\u003e\n   \u003citem name=\"cookieActionColor\"\u003e@color/default_action_color\u003c/item\u003e\n   \u003citem name=\"cookieBackgroundColor\"\u003e@color/default_bg_color\u003c/item\u003e\n   \u003citem name=\"cookiePadding\"\u003e24dp\u003c/item\u003e\n   \u003citem name=\"cookieTitleSize\"\u003e24sp\u003c/item\u003e\n   \u003citem name=\"cookieMessageSize\"\u003e16sp\u003c/item\u003e\n   \u003citem name=\"cookieActionSize\"\u003e18sp\u003c/item\u003e\n\u003c/style\u003e\n```\n\n## Dynamically set cookie properties\n * Cookie position (Top/Bottom)\n * Display duration\n * Title text color\n * Body text color\n * Action text color\n * Background color\n * Icon resource\n * Icon animation\n * In/Out animations for the entire view\n * View layout\n\n## Attribution\nForked from the early code base of CookieBar, by Eric Liu.\n\n## License\n\n    Copyright 2018, Aviran Abady.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faviranabady%2Fcookiebar2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faviranabady%2Fcookiebar2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faviranabady%2Fcookiebar2/lists"}