{"id":17225763,"url":"https://github.com/loregr/lgsnackbar","last_synced_at":"2026-03-14T19:32:24.961Z","repository":{"id":163435545,"uuid":"92615428","full_name":"loregr/LGSnackbar","owner":"loregr","description":"An easy to use and customisable wrapper of the native Android Snackbar which stays visible across multiple activities.","archived":false,"fork":false,"pushed_at":"2017-07-30T16:43:51.000Z","size":870,"stargazers_count":47,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-14T01:09:40.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loregr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-27T18:02:57.000Z","updated_at":"2022-12-05T07:52:38.000Z","dependencies_parsed_at":"2024-01-27T01:18:15.023Z","dependency_job_id":"b1f0675a-adaa-49ee-b850-f486420cd823","html_url":"https://github.com/loregr/LGSnackbar","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loregr%2FLGSnackbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loregr%2FLGSnackbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loregr%2FLGSnackbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loregr%2FLGSnackbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loregr","download_url":"https://codeload.github.com/loregr/LGSnackbar/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804825,"owners_count":21164135,"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":[],"created_at":"2024-10-15T04:14:25.591Z","updated_at":"2026-03-14T19:32:24.907Z","avatar_url":"https://github.com/loregr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![logo](media/header_logo.png)\n\n\n[![travis_CI](https://travis-ci.org/loregr/LGSnackbar.svg?branch=master)](https://travis-ci.org/loregr/LGSnackbar) ![platform](https://img.shields.io/badge/platform-android-green.svg) [![license](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE.md)  [![](https://jitpack.io/v/loregr/lgsnackbar.svg)](https://jitpack.io/#loregr/lgsnackbar)\n ![API](https://img.shields.io/badge/minSdkVersion-19-orange.svg?style=flat)\n\n\nAn easy to use wrapper of the native Android Snackbar which stays visible across multiple activities. It provides different themes to start with, and allows you to easily manage common scenarios like _**success**, **warning**, **error**, **info**._\n\n## Preview\n\nDemo video:\n\n![logo](media/demo.gif)\n\nTry it on Appetize:\n\n[![appetize](media/appetize.png)](https://appetize.io/app/rp93kgkya9b02f4qb0vw2f8h4r?device=nexus5\u0026scale=75\u0026orientation=portrait\u0026osVersion=7.0)\n\n## Install\n\nIn your root/build.gradle:\n\n```groovy\nallprojects {\n  repositories {\n  ...\n  maven { url 'https://jitpack.io' }\n  }\n}  \n```\nIn your app/build.gradle\n\n```groovy\ndependencies {\n  compile 'com.github.loregr:lgsnackbar:1.0.2'\n}\n```\n\n## Preparing\n\n### Setup with a default theme\n\nDefine your default theme using `LGSnackbarManager.prepare(...)`, in your `Application` class in the `#onCreate()` method.\n\n\n```java\n@Override\npublic void onCreate() {\n    super.onCreate();\n    LGSnackbarManager.prepare(getApplicationContext(),\n                LGSnackBarThemeManager.LGSnackbarThemeName.SHINE);\n                //....\n}\n```\n\n**You can check the available themes _[here](./themes.md)_.**\n\n_Note: You can simply call `LGSnackbarManager.prepare(getApplicationContext())`, in this case `SHINE` theme will be automatically applied._\n\n### Setup with a custom theme\n\nCreate your own `LGSnackbarTheme` by passing 4 `LGSnackBarStyle` instances (one for each scenario of the theme) and the `minHeight` and the `duration` values that you want to apply to the Snackbar.\n\n\n```java\n@Override\npublic void onCreate() {\n    super.onCreate();\n    LGSnackbarManager.prepare(getApplicationContext(),\n                    customTheme());\n                //....\n}\n\n//...\n\nLGSnackBarTheme customTheme() {\n    LGSnackBarStyle successStyle = new LGSnackBarStyle(successCustomColor,\n            Color.WHITE,\n            actionSuccessCustomColor,\n            R.drawable.ic_done_white);\n\n    LGSnackBarStyle warningStyle = new LGSnackBarStyle(warningCustomColor,\n            Color.WHITE,\n            actionWarningCustomColor,\n            R.drawable.ic_warning_white);\n\n    LGSnackBarStyle errorStyle = new LGSnackBarStyle(errorCustomColor,\n            Color.WHITE,\n            actionErrorCustomColor,\n            R.drawable.ic_error_outline_white);\n\n    LGSnackBarStyle infoStyle = new LGSnackBarStyle(infoCustomColor,\n            Color.WHITE,\n            actionInfoCustomColor,\n           R.drawable.ic_info_outline_white);\n\n    return new LGSnackBarTheme(successStyle, warningStyle, errorStyle, infoStyle, 60, Snackbar.LENGTH_LONG);\n}\n```\n\n## Usage\n\nAfter preparing is done, in order to show a snackbar you can simply call:\n\n```java\nLGSnackbarManager.show(SUCCESS, \"Everything is looking good! Awesome!\");\n```\n\nWoooo, done! :-)\n\n### Callbacks and actions\n\nYou can add a callback and/or an action to your snackbar by calling:\n\n_Callback:_\n```java\nLGSnackbarManager.show(SUCCESS, \"Everything is looking good! Awesome!\",\n  new Snackbar.Callback() {\n      @Override\n      public void onShown(Snackbar sb) {\n          super.onShown(sb);\n          // LGSnackbar is now visible\n      }\n\n      @Override\n      public void onDismissed(Snackbar transientBottomBar, int event) {\n          super.onDismissed(transientBottomBar, event);\n          // LGSnackbar is now hidden\n      }\n});\n```\n_Action:_\n```java\nLGSnackbarManager.show(SUCCESS, \"Everything is looking good! Awesome!\",\n  new LGSnackbarAction(\"Action\", new View.OnClickListener() {\n     @Override\n     public void onClick(View view) {\n       // Action fired\n     }\n}));\n```\n### Custom snackbar\nIf for any reason you may need to display a custom snackbar without setting a whole new theme, you can use an `LGSnackbarBuilder`\n\n```java\nnew LGSnackbar.LGSnackbarBuilder(getApplicationContext(), \"This is a custom bar\")\n        .duration(Snackbar.LENGTH_LONG)\n        .actionTextColor(Color.GREEN)\n        .backgroundColor(Color.GRAY)\n        .minHeightDp(50)\n        .textColor(Color.WHITE)\n        .iconID(R.drawable.ic_info_outline_white)\n        .callback(null)\n        .action(null)\n        .show();\n```\n\n#####  Supported Attributes\n\n| Attribute        | Description      | Default value  |\n| ------------- |-------------| -----|\n| style      | An _LGSnackBarStyle_ instance     | Native Android snackbar style |\n| duration      | How long to display the message. Either _LENGTH\u0026#95;SHORT_ or _LENGTH\u0026#95;LONG_     | _LENGTH\u0026#95;LONG_ |\n| backgroundColor      | The color of the snackbar     | Native Android color |\n| actionTextColor      | The color of the text of an action     | Native Android color |\n| textColor      | The color of the text     | white |\n| minHeightDp      | The height of the snackbar when only one line if text is displayed     | 48 |\n| iconID      | The drawable id of the icon     | _NO\u0026#95;ICON\u0026#95;ID_ (-1) |\n| callback      | The snackbar callback     | _null_ |\n| action      | The snackbar action     | _null_ |\n\n## Issues\n\n\nFeel free to submit issues and features requests.\n\n## Contributing\n\nContributions are more then welcome. Your contribution may include bug fixing, new features or just new themes.\n\nPlease follow the \"fork-and-pull\" Git workflow (check [here](./CONTRIBUTING.md) for more).\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull request** so that I can review your changes\n\n\n If you contribute with a new theme, please update also the `themes.md` file.\n\n_NOTE: Be sure to merge the latest from \"upstream\" before making a pull request!_\n\n## Author\n\nLorenzo Greco\n\n- [Website](https://lorenzogreco.com)\n- [LinkedIn](https://www.linkedin.com/in/lorenzo-greco-61118195/)\n\n## License\n```\nMIT License\n\nCopyright (c) 2017 Lorenzo Greco\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floregr%2Flgsnackbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floregr%2Flgsnackbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floregr%2Flgsnackbar/lists"}