{"id":17472352,"url":"https://github.com/pranavpandey/dynamic-toasts","last_synced_at":"2025-04-10T01:10:50.583Z","repository":{"id":45903740,"uuid":"95198149","full_name":"pranavpandey/dynamic-toasts","owner":"pranavpandey","description":"Custom toasts with color and icon on Android.","archived":false,"fork":false,"pushed_at":"2025-03-05T19:17:13.000Z","size":3150,"stargazers_count":161,"open_issues_count":2,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-10T01:10:41.882Z","etag":null,"topics":["android","custom","error","hint","icon","library","material-design","text","toast","warning"],"latest_commit_sha":null,"homepage":"https://dynamic.pranavpandey.com","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/pranavpandey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"pranavpandey","patreon":"pranavpandey","open_collective":"pranavpandeydev","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["paypal.me/pranavpandeydev"]}},"created_at":"2017-06-23T08:06:59.000Z","updated_at":"2025-03-05T19:17:17.000Z","dependencies_parsed_at":"2023-12-10T15:11:37.035Z","dependency_job_id":null,"html_url":"https://github.com/pranavpandey/dynamic-toasts","commit_stats":{"total_commits":218,"total_committers":1,"mean_commits":218.0,"dds":0.0,"last_synced_commit":"1cba05b7cf3f58352f777134fcf0d9d11988627e"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavpandey%2Fdynamic-toasts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavpandey%2Fdynamic-toasts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavpandey%2Fdynamic-toasts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranavpandey%2Fdynamic-toasts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pranavpandey","download_url":"https://codeload.github.com/pranavpandey/dynamic-toasts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137886,"owners_count":21053775,"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","custom","error","hint","icon","library","material-design","text","toast","warning"],"created_at":"2024-10-18T17:08:25.987Z","updated_at":"2025-04-10T01:10:50.564Z","avatar_url":"https://github.com/pranavpandey.png","language":"Java","funding_links":["https://github.com/sponsors/pranavpandey","https://patreon.com/pranavpandey","https://opencollective.com/pranavpandeydev","paypal.me/pranavpandeydev","https://paypal.me/pranavpandeydev"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./graphics/icon.png\" height=\"160\"\u003e\n\n# Dynamic Toasts\n\n[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?)](https://www.apache.org/licenses/LICENSE-2.0.html)\n[![Build Status](https://travis-ci.org/pranavpandey/dynamic-toasts.svg?branch=master)](https://travis-ci.org/pranavpandey/dynamic-toasts)\n[![Release](https://img.shields.io/maven-central/v/com.pranavpandey.android/dynamic-toasts)](https://search.maven.org/artifact/com.pranavpandey.android/dynamic-toasts)\n\n**A simple library to display themed toasts with icon and text on Android 2.3 (API 9) and above.**\n\n\u003e [!IMPORTANT]\n\u003e Since v0.4.0, it uses [26.x.x support libraries][android-support] so, minimum SDK will be \nAndroid 4.0 (API 14).\n\u003cbr/\u003eSince v2.0.0, it uses [AndroidX][androidx] so, first [migrate][androidx-migrate] your \nproject to AndroidX.\n\u003cbr/\u003eSince v4.1.0, it is dependent on Java 8 due to the dependency on\n[Dynamic Utils][dynamic-utils].\n\u003cbr/\u003eSince v4.2.0, it is targeting Java 17 to provide maximum compatibility.\n\u003cbr/\u003eSince v4.3.0, the minimum SDK is Android 4.4 (API 19) to comply with the latest policies.\n\n\u003cimg src=\"./graphics/preview.png\"\u003e\n\n---\n\n## Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Configuration](#configuration)\n    - [Default toast](#default-toast)\n    - [Default toast with duration](#default-toast-with-duration)\n    - [Default toast with icon](#default-toast-with-icon)\n    - [Default toast with icon and duration](#default-toast-with-icon-and-duration)\n    - [Error toast](#error-toast)\n    - [Error toast with duration](#error-toast-with-duration)\n    - [Success toast](#success-toast)\n    - [Success toast with duration](#success-toast-with-duration)\n    - [Warning toast](#warning-toast)\n    - [Warning toast with duration](#warning-toast-with-duration)\n    - [Custom toast](#custom-toast)\n    - [Custom toast with duration](#custom-toast-with-duration)\n    - [Custom toast with icon](#custom-toast-with-icon)\n    - [Custom toast with icon and duration](#custom-toast-with-icon-and-duration)\n    - [Cheat sheets](#cheat-sheets)\n    - [Dependency](#dependency)\n- [License](#license)\n\n---\n\n## Installation\n\nIt can be installed by adding the following dependency to your `build.gradle` file:\n\n```groovy\ndependencies {\n    // For AndroidX enabled projects.\n    implementation 'com.pranavpandey.android:dynamic-toasts:4.3.0'\n\n    // For legacy projects.\n    implementation 'com.pranavpandey.android:dynamic-toasts:1.3.0'\n}\n```\n\n---\n\n## Usage\n\nIt has several method to display toasts based on the requirement. Each method returns a `Toast`\nobject which can be customised further.\n\nPlease call `show()` method to display the toast.\n\n\u003e For a complete reference, please read the [documentation][documentation].\n\n### Configuration\n\nOptional configuration to customise the toasts further like custom background color or drawable, \ncustom text size, typeface or icon size, etc.\n\nVarious methods can be called anywhere in the app to do customisations.\n\n```java\nDynamicToast.Config.getInstance()\n    // Background color for default toast.\n    .setDefaultBackgroundColor(@ColorInt int defaultBackgroundColor)\n    // Tint color for default toast.\n    .setDefaultTintColor(@ColorInt int defaultTintColor)\n    // Background color for error toast.\n    .setErrorBackgroundColor(@ColorInt int errorBackgroundColor)\n    // Background color for success toast.\n    .setSuccessBackgroundColor(@ColorInt int successBackgroundColor)\n    // Background color for warning toast.\n    .setWarningBackgroundColor(@ColorInt int warningBackgroundColor)\n    // Custom icon for error toast. Pass `null` to use default icon.\n    .setErrorIcon(@Nullable Drawable errorIcon)\n    // Custom icon for success toast. Pass `null` to use default icon.\n    .setSuccessIcon(@Nullable Drawable successIcon)\n    // Custom icon for warning toast. Pass `null` to use default icon.\n    .setWarningIcon(@Nullable Drawable warningIcon)\n    // Disable icon for all the toasts.\n    .setDisableIcon(boolean disableIcon)\n    // Custom icon size in `pixels` for all the toasts.\n    .setIconSize(int iconSize)\n    // Custom text size in `SP` for all the toasts.\n    .setTextSize(int textSize)\n    // Custom text typeface for all the toasts. Pass `null` to use system typeface.\n    .setTextTypeface(@Nullable Typeface textTypeface)\n    // Custom background drawable for all the toasts. Pass `null` to use default background.\n    .setToastBackground(@Nullable Drawable toastBackground)\n    // Apply customisations.\n    .apply();\n```\n\nCall `reset()` method to reset all the customisations.\n\n```java\n// Reset customisations.\nDynamicToast.Config.getInstance().reset();\n```\n\n### Default toast\n\nSimple toast based on the vanilla Android theme for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.make(context, \"Default toast\").show();\n```\n\n### Default toast with duration\n\nSimple toast based on the vanilla Android theme for supplied duration.\n\n```java\nDynamicToast.make(context, \"Default toast with duration\", duration).show();\n```\n\n### Default toast with icon\n\nSimple toast based on the vanilla Android theme with a icon for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.make(context, \"Default toast with icon\", drawable).show();\n```\n\n### Default toast with icon and duration\n\nSimple toast based on the vanilla Android theme with a icon for supplied duration.\n\n```java\nDynamicToast.make(context, \"Default toast with icon and duration\", drawable, duration).show();\n```\n\n### Error toast\n\nError toast with `#F44336` background for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.makeError(context, \"Error toast\").show();\n```\n\n### Error toast with duration\n\nError toast with `#F44336` background for supplied duration.\n\n```java\nDynamicToast.makeError(context, \"Error toast with duration\", duration).show();\n```\n\n### Success toast\n\nSuccess toast with `#4CAF50` background for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.makeSuccess(context, \"Success toast\").show();\n```\n\n### Success toast with duration\n\nSuccess toast with `#4CAF50` background for supplied duration.\n\n```java\nDynamicToast.makeSuccess(context, \"Success toast with duration\", duration).show();\n```\n\n### Warning toast\n\nWarning toast with `#FFEB3B` background for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.makeWarning(context, \"Warning toast\").show();\n```\n\n### Warning toast with duration\n\nWarning toast with `#FFEB3B` background for supplied duration.\n\n```java\nDynamicToast.makeWarning(context, \"Warning toast with duration\", duration).show();\n```\n\n### Custom toast\n\nCustom toast based on the supplied background and tint color for `Toast.LENGTH_SHORT` duration.\n\n```java\nDynamicToast.make(context, \"Custom toast\", tintColor, backgroundColor).show();\n```\n\n### Custom toast with duration\n\nCustom toast based on the supplied background and tint color for supplied duration.\n\n```java\nDynamicToast.make(context, \"Custom toast with duration\", tintColor, backgroundColor, duration).show();\n```\n\n### Custom toast with icon\n\nCustom toast based on the supplied icon, background and tint color theme for `Toast.LENGTH_SHORT` \nduration.\n\n```java\nDynamicToast.make(context, \"Custom toast with icon\", drawable, tintColor, backgroundColor).show();\n```\n\n### Custom toast with icon and duration\n\nCustom toast based on the supplied icon, background and tint color theme for supplied duration.\n\n```java\nDynamicToast.make(context, \"Custom toast with icon and duration\", drawable, \n        tintColor, backgroundColor, duration).show();\n```\n\n### Cheat sheets\n\nUse dynamic hint to display cheat sheets for any `view`. All the methods are same as explained \nabove, just replace `DynamicToast` with `DynamicHint` to create a cheat sheet.\n\n\u003e Use `DynamicHint.show(view, toast)` method to display it according to the anchor view position.\n\n### Dependency\n\nIt depends on the [dynamic-utils][dynamic-utils] to perform various internal operations. \nSo, its functions can also be used to perform other useful operations.\n\n---\n\n## Author\n\nPranav Pandey\n\n[![GitHub](https://img.shields.io/github/followers/pranavpandey?label=GitHub\u0026style=social)](https://github.com/pranavpandey)\n[![Follow on Twitter](https://img.shields.io/twitter/follow/pranavpandeydev?label=Follow\u0026style=social)](https://twitter.com/intent/follow?screen_name=pranavpandeydev)\n[![Donate via PayPal](https://img.shields.io/static/v1?label=Donate\u0026message=PayPal\u0026color=blue)](https://paypal.me/pranavpandeydev)\n\n---\n\n## License\n\n    Copyright 2017-2024 Pranav Pandey\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\n\n[android-support]: https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0\n[androidx]: https://developer.android.com/jetpack/androidx\n[androidx core]: https://developer.android.com/jetpack/androidx/releases/core\n[androidx-migrate]: https://developer.android.com/jetpack/androidx/migrate\n[documentation]: https://pranavpandey.github.io/dynamic-toasts\n[dynamic-utils]: https://github.com/pranavpandey/dynamic-utils\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavpandey%2Fdynamic-toasts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranavpandey%2Fdynamic-toasts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavpandey%2Fdynamic-toasts/lists"}