{"id":21084881,"url":"https://github.com/yuvraj24/livesmashbar","last_synced_at":"2025-06-10T10:39:25.907Z","repository":{"id":123139970,"uuid":"132318965","full_name":"yuvraj24/LiveSmashBar","owner":"yuvraj24","description":"An elegant looking and easy to use informative library with LiveData integration for Android.","archived":false,"fork":false,"pushed_at":"2021-07-24T21:25:42.000Z","size":633,"stargazers_count":118,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T23:32:50.543Z","etag":null,"topics":["android","android-app","android-application","android-development","android-library","android-sdk","android-studio","dialog","duration","gravity","kotlin","kotlin-android","kotlin-extensions","kotlin-library","lifecycleowner","livedata","overlay","snackbar","toast"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/yuvraj24.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-06T08:09:21.000Z","updated_at":"2025-03-14T04:04:12.000Z","dependencies_parsed_at":"2023-04-30T12:30:56.134Z","dependency_job_id":null,"html_url":"https://github.com/yuvraj24/LiveSmashBar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvraj24%2FLiveSmashBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvraj24%2FLiveSmashBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvraj24%2FLiveSmashBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvraj24%2FLiveSmashBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuvraj24","download_url":"https://codeload.github.com/yuvraj24/LiveSmashBar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvraj24%2FLiveSmashBar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259057167,"owners_count":22799102,"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":["android","android-app","android-application","android-development","android-library","android-sdk","android-studio","dialog","duration","gravity","kotlin","kotlin-android","kotlin-extensions","kotlin-library","lifecycleowner","livedata","overlay","snackbar","toast"],"created_at":"2024-11-19T20:27:51.509Z","updated_at":"2025-06-10T10:39:25.897Z","avatar_url":"https://github.com/yuvraj24.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiveSmashBar\n\n[![Download](https://api.bintray.com/packages/yuvraj24/maven/smashbar/images/download.svg)](https://bintray.com/yuvraj24/maven/smashbar/_latestVersion) [![API](https://img.shields.io/badge/API-16%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=16) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nLiveSmashBar allows you a great alternative for native snackbar \u0026 toast in Android. It allows a great extent of customisation \u0026 flexibility in terms of usage \u0026 behaviour.\n\nAlso it has support for **LiveData** which can be beneficial for displaying repetitive messages just be single initialization.\n\nLibrary has been designed \u0026 developed purely in *Kotlin*. ❤️\n\n![Alt text](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/liveSmashBar.png)\n\n### Spread Your ❤️:\n[![GitHub followers](https://img.shields.io/github/followers/yuvraj24.svg?style=social\u0026label=Follow)](https://github.com/yuvraj24)  [![Twitter Follow](https://img.shields.io/twitter/follow/yuvrajpy.svg?style=social)](https://twitter.com/yuvrajpy)\n\n# Samples\nYou can check the \u003ca href=\"https://github.com/yuvraj24/LiveSmashBar/tree/master/app\"\u003eDemo Project\u003c/a\u003e developed in kotlin for better understanding of concepts \u0026 usage.\n\n\u003ca href='https://play.google.com/store/apps/details?id=com.yuvraj.livesmashbar'\u003e\u003cimg alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height=\"80px\"/\u003e\u003c/a\u003e\n\n# Download\n\nThis library is available in maven \u0026 jcenter which can also be imported from source as a module.\n\n### maven\n\n```Maven\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.yuvraj.livesmashbar\u003c/groupId\u003e\n    \u003cartifactId\u003esmashbar\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n### gradle\n \n```JCenter\ndependencies {\n    // other dependencies here\n    implementation 'com.yuvraj.livesmashbar:smashbar:1.0.0'\n}\n```\n# Get Started\n\n### Basic\n\n\n\n![Alt text](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/simple_livesmashbar.png)\n\n\n\nShows a simple LiveSmashBar with description \u0026 duration.\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .description(getString(R.string.description))\n            .descriptionColor(ContextCompat.getColor(this, R.color.white))\n            .gravity(GravityView.BOTTOM)\n            .duration(3000)\n            .show();\n```\n\nAlso you can show both title \u0026 description along with duration in milliseconds. Duration is set to indefinite which means it won't dismiss until \u0026 unless specified for.Also you can use predefined parameters i.e DURATION_SHORT = 1000, DURATION_LONG = 2500 for specifying duration for LiveSmashBar.\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .title(getString(R.string.title))\n            .titleColor(ContextCompat.getColor(this, R.color.white))\n            .description(getString(R.string.description))\n            .descriptionColor(ContextCompat.getColor(this, R.color.white))\n            .gravity(GravityView.BOTTOM)\n            .duration(DURATION_SHORT)\n            .show();\n```\n\n\n## Gravity\n\n\n![Gravity_top](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/gravity_view_top.png)\n\n\nYou can show LiveSmashBar at both Bottom ae well as Top of the screen by specifying GravityView.BOTTOM / GravityView.TOP.\n\n### GravityView.BOTTOM :\n```Kotlin\nLiveSmashBar.Builder(this)\n            .title(getString(R.string.title))\n            .description(getString(R.string.description))\n            .gravity(GravityView.BOTTOM)\n            .duration(DURATION_SHORT)\n            .show();\n```\n\n### GravityView.TOP :\n```Kotlin\nLiveSmashBar.Builder(this)\n            .title(getString(R.string.title))\n            .description(getString(R.string.description))\n            .gravity(GravityView.TOP)\n            .duration(DURATION_SHORT)\n            .show();\n```\n\n\n## LiveData Support\n\n\n![LiveData](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/livedata.png)\n\n\nLiveSmashBar allows support for LiveData , which can be used for showing similar group of messages with single initialization thereby avoiding code redundancy. This can be achieved by simply creating a LiveSmashBar instance \u0026 passing the livedata object as parameter. So when ever you post anything to livedata, your LiveSmashBar will receive that call back and will display the same to the end user. Following is a sample demostrating the use of livedata,\n\n```Kotlin\nval liveData: MutableLiveData\u003cUnit\u003e = MutableLiveData()\n\nLiveSmashBar.Builder(this)\n            .showIcon()\n            .icon(R.mipmap.ic_launcher)\n            .title(getString(R.string.flutter_title)) \n            .description(getString(R.string.flutter_info)) \n            .gravity(GravityView.BOTTOM)\n            .liveDataCallback(this, liveData)\n```\n\n\n## Icon\n\n\n![Gravity_top](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/icon.png)\n\n\nYou can add icons to make details displayed on LiveSmashBar more meaningful \u0026 intuitive.\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .icon(R.mipmap.ic_launcher)\n            .title(getString(R.string.title))\n            .titleColor(ContextCompat.getColor(this, R.color.white))\n            .description(getString(R.string.description))\n            .descriptionColor(ContextCompat.getColor(this, R.color.white))\n            .gravity(GravityView.BOTTOM)\n            .duration(DURATION_SHORT)\n            .show();\n```\n\nAlso you can apply animation to icons, with the following snippet,\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .icon(R.mipmap.ic_launcher)\n            .iconAnimation(AnimIconBuilder(this).pulse())\n            .title(getString(R.string.description))\n            .titleColor(ContextCompat.getColor(this, R.color.white))\n            .gravity(GravityView.TOP)\n            .duration(3000)\n            .show()\n```\n\n\n## Primary Button\n\n\n![Primary_Action](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/primary_action.png)\n\n\nSimilar to Snackbar, a message can be accompanied by an action button which can be used to perform some functionality. Below example listens for action button click to dismiss LiveSmashBar displayed to user.\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .icon(R.mipmap.ic_launcher)\n            .title(getString(R.string.title)) \n            .description(getString(R.string.description)) \n            .primaryActionText(\"DONE\") \n            .primaryActionEventListener(object : OnEventTapListener {\n                      override fun onActionTapped(bar: LiveSmashBar) {\n                                bar.dismiss()\n                       }\n             })\n            .show();\n```\n\n\n## Dialog Style\n\n\n![Dialog_Style](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/dialog_style.png)\n\n\nLiveSmashBar can also be used to display a dialog view with a message \u0026 action buttons. By defalut the view type set is BarStyle.DEFAULT_MESSAGE which shows basic message with action button. For displaying dialog style LiveSmashBar use the following snippet,\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .icon(R.mipmap.ic_launcher)\n            .title(getString(R.string.title)) \n            .description(getString(R.string.description)) \n            .backgroundColor(ContextCompat.getColor(this, R.color.orange))\n            .setBarStyle(BarStyle.DIALOG)\n            .positiveActionText(\"DONE\")\n            .positiveActionTextColor(ContextCompat.getColor(this, R.color.white))\n            .positiveActionEventListener(object : OnEventTapListener {\n                     override fun onActionTapped(bar: LiveSmashBar) {\n                             bar.dismiss()\n                     }\n            })\n            .negativeActionText(\"CLOSE\")\n            .negativeActionTextColor(ContextCompat.getColor(this, R.color.white))\n            .negativeActionEventListener(object : OnEventTapListener {\n                     override fun onActionTapped(bar: LiveSmashBar) {\n                             bar.dismiss()\n                     }\n            })\n            .show();\n```\n\n## Overlay\n\n\n![Dialog_Style](https://github.com/yuvraj24/LiveSmashBar/blob/master/images/overlay.png)\n\n\nLiveSmashBar allows to show modal overlay messages that dims the background \u0026 highlights the message to user. It blocks the UI if function overlayBlockable() is called thereby blocking user taps on the underlying content. You can dismiss the overlay by calling function dismissOnTapOutside() for dismissing the overlay.\n\n```Kotlin\nLiveSmashBar.Builder(this)\n            .showIcon()\n            .icon(R.mipmap.ic_launcher)\n            .title(getString(R.string.flutter_title))\n            .description(getString(R.string.flutter_info))\n            .gravity(GravityView.TOP)\n            .dismissOnTapOutside()\n            .showOverlay()\n            .overlayBlockable()\n            .backgroundColor(ContextCompat.getColor(this, R.color.white))\n            .show();            \n```\n\n## Event Listeners\nYou can subscribe to events like when the LiveSmashBar is showing, or dismissing. You can also subscribe to when the LiveSmashBar is being shown or dismissed to perform animations on other views if needed.\n\nYou can also subscribe to tap events inside or outside the bar.\n\n### Show Event\n\nYou can subscribe to events on `OnEventShowListener` as follows,\n\n```kotlin\nLiveSmashBar.Builder(this) \n        .title(\"Hello World!\")\n        .description(\"You can listen to events when the LiveSmashBar is shown\")\n        .barShowListener(object : LiveSmashBar.OnEventShowListener {\n            override fun onShowing(bar: LiveSmashBar) {\n                Log.d(TAG, \"LiveSmashBar is showing\")\n            }\n\n            override fun onShown(bar: LiveSmashBar) {\n                Log.d(TAG, \"LiveSmashBar is shown\")\n            }\n        })\n        .show()\n```\n### Dismiss\nYou can listen to events on `OnEventDismissListener` for dismissing events. \nYou can also specifically get to know the reason behind the bar dismiss action - `TIMEOUT`, `MANUAL`, `TAP_OUTSIDE` and `SWIPE`.\n\n```kotlin\nLiveSmashBar.Builder(this) \n        .title(\"Hello World!\") \n        .description(\"You can listen to events when the LiveSmashBar is dismissed\")\n        .barDismissListener(object : LiveSmashBar.OnEventDismissListener {\n            override fun onDismissing(bar: LiveSmashBar, isSwiped: Boolean) {\n                Log.d(TAG, \"LiveSmashBar is dismissing with $isSwiped\")\n            }\n\n            override fun onDismissed(bar: LiveSmashBar, event: LiveSmashBar.DismissEvent) {\n                Log.d(TAG, \"LiveSmashBar is dismissed with event $event\")\n            }\n        }) \n        .show()\n```\n\n### Taps\n\nYou can listen to tap events inside or outside of the LiveSmashBar.\n\n```kotlin\nLiveSmashBar.Builder(this) \n        .title(\"Hello World!\")\n        .description(\"You can listen to tap events inside or outside the LiveSmashBar.\")\n        .listenBarTaps(object : LiveSmashBar.OnEventListener {\n            override fun onTap(bar: LiveSmashBar) {\n                Log.d(TAG, \"Bar tapped\")\n            }\n        })\n        .listenOutsideTaps(object : LiveSmashBar.OnTapListener {\n            override fun onTap(bar: LiveSmashBar) {\n                Log.d(TAG, \"Outside tapped\")\n            }\n        })\n        .show()\n```\n\n# About Me\n\n### Yuvraj Pandey\nI am a passionate Mobility Engineer which likes to push himself on various fronts of technologies.  \n\nFor more exciting updates follow me,\n\n\u003ca href=\"https://twitter.com/yuvrajpy\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/yuvraj24/LiveSmashBar/blob/master/images/twitter.png\" width=\"40\" height=\"40\"\u003e\u003c/a\u003e \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003ca href=\"https://www.linkedin.com/in/yuvrajpy\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/yuvraj24/LiveSmashBar/blob/master/images/linkedin.png\" width=\"40\" height=\"40\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003ca href=\"https://github.com/yuvraj24\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/yuvraj24/LiveSmashBar/blob/master/images/github.png\" height=\"40\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003ca href=\"https://yuvrajpy.medium.com/\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/yuvraj24/LiveSmashBar/blob/master/images/medium.png\" width=\"40\" height=\"40\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003ca href=\"https://play.google.com/store/apps/developer?id=Yuvraj+Pandey\"\u003e\u003cimg src=\"https://github.com/yuvraj24/LiveSmashBar/blob/master/images/playstore.png\" width=\"40\" height=\"40\"\u003e\u003c/a\u003e\n \n# License\n\n```\n\nCopyright 2018 Yuvraj Pandey \n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvraj24%2Flivesmashbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuvraj24%2Flivesmashbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvraj24%2Flivesmashbar/lists"}