{"id":13427835,"url":"https://github.com/Tapadoo/Alerter","last_synced_at":"2025-03-16T00:32:39.351Z","repository":{"id":39618120,"uuid":"80848838","full_name":"Tapadoo/Alerter","owner":"Tapadoo","description":"An Android Alerting Library","archived":false,"fork":false,"pushed_at":"2023-07-21T08:28:18.000Z","size":37084,"stargazers_count":5530,"open_issues_count":48,"forks_count":633,"subscribers_count":102,"default_branch":"master","last_synced_at":"2025-03-14T18:01:03.848Z","etag":null,"topics":["alerting","android","android-app","android-development","android-library","android-ui","app","customisation","google","java","material-design","material-ui","ui"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/Tapadoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-02-03T16:50:47.000Z","updated_at":"2025-03-13T11:51:24.000Z","dependencies_parsed_at":"2022-07-14T08:49:25.477Z","dependency_job_id":"e8864d28-c38d-437c-8ac6-5d6dc5d8a828","html_url":"https://github.com/Tapadoo/Alerter","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tapadoo%2FAlerter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tapadoo%2FAlerter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tapadoo%2FAlerter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tapadoo%2FAlerter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tapadoo","download_url":"https://codeload.github.com/Tapadoo/Alerter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809865,"owners_count":20351403,"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":["alerting","android","android-app","android-development","android-library","android-ui","app","customisation","google","java","material-design","material-ui","ui"],"created_at":"2024-07-31T01:00:41.044Z","updated_at":"2025-03-16T00:32:39.346Z","avatar_url":"https://github.com/Tapadoo.png","language":"Kotlin","funding_links":[],"categories":["Libraries","Kotlin","库","通知"],"sub_categories":["UI 组件"],"readme":"# Alerter - An Android Alerter Library, now in Kotlin!\n\nThis library aims to overcome the limitations of Toasts and Snackbars, while reducing the\ncomplexity of your layouts.\n\n[![API](https://img.shields.io/badge/API-14%2B-orange.svg?style=flat)](https://android-arsenal.com/api?level=14) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Alerter-blue.svg?style=flat)](https://android-arsenal.com/details/1/5302) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23245-blue.svg)](http://androidweekly.net/issues/issue-245)\n\n![Header](./documentation/header.png)\n\n## General\n\nWith simplicity in mind, the Alerter employs the builder pattern to facilitate easy integration into any app.\nA customisable Alert View is dynamically added to the Decor View of the Window, overlaying all content. \n\n## Install\n\nInclude the JitPack.io Maven repo in your project's build.gradle file\n\n```groovy\nallprojects {\n repositories {\n    maven { url \"https://jitpack.io\" }\n }\n}\n```\n\nThen add this dependency to your app's build.gradle file\n\n```groovy\ndependencies {\n    implementation 'com.github.tapadoo:alerter:$current-version'\n}\n```\n\n# Usage\n\n![Default Alert](./documentation/alert_default.gif)\n\nFrom an Activity -\n\n```kotlin\nAlerter.create(this@DemoActivity)\n       .setTitle(\"Alert Title\")\n       .setText(\"Alert text...\")\n       .show()\n```\n\nOr from a Fragment -\n\n```kotlin\nAlerter.create(activity)\n       .setTitle(\"Alert Title\")\n       .setText(\"Alert text...\")\n       .show()\n```\n\nTo check if an alert is showing - \n\n\n```kotlin\nAlerter.isShowing()\n```\n\nTo hide a currently showing Alert - \n\n```kotlin\nAlerter.hide()\n```\n\n# Customisation\n\n### Background Colour\n\n```kotlin\nAlerter.create(this@DemoActivity)\n       .setTitle(\"Alert Title\")\n       .setText(\"Alert text...\")\n       .setBackgroundColorRes(R.color.colorAccent) // or setBackgroundColorInt(Color.CYAN)\n       .show()\n```\n\n![Coloured Alert](./documentation/alert_coloured.gif)\n\n### Icon\n\n```kotlin\nAlerter.create(this@DemoActivity)\n       .setText(\"Alert text...\")\n       .setIcon(R.drawable.alerter_ic_mail_outline)\n       .setIconColorFilter(0) // Optional - Removes white tint\n       .setIconSize(R.dimen.custom_icon_size) // Optional - default is 38dp\n       .show()\n```\n\n![Custom Icon Alert](./documentation/alert_icon.gif)\n\n### On screen duration, in milliseconds\n\n```kotlin\nAlerter.create(this@DemoActivity)\n       .setTitle(\"Alert Title\")\n       .setText(\"Alert text...\")\n       .setDuration(10000)\n       .show()\n```\n\n### Without title\n\n```kotlin\nAlerter.create(this@DemoActivity)\n       .setText(\"Alert text...\")\n       .show()\n```\n\n![Text Only Alert](./documentation/alert_text_only.gif)\n\n### Adding an On Click Listener\n\n```kotlin\n Alerter.create(this@DemoActivity)\n        .setTitle(\"Alert Title\")\n        .setText(\"Alert text...\")\n        .setDuration(10000)\n        .setOnClickListener(View.OnClickListener {\n            Toast.makeText(this@DemoActivity, \"OnClick Called\", Toast.LENGTH_LONG).show();\n        })\n        .show()\n```\n\n![On Click Alert](./documentation/alert_on_click.gif)\n\n### Verbose text\n\n```kotlin\n Alerter.create(this@DemoActivity)\n        .setTitle(\"Alert Title\")\n        .setText(\"The alert scales to accommodate larger bodies of text. \" +\n                 \"The alert scales to accommodate larger bodies of text. \" +\n                 \"The alert scales to accommodate larger bodies of text.\")\n        .show()\n```\n\n![Verbose Alert](./documentation/alert_verbose.gif)\n\n### Custom Enter/Exit Animations\n\n```kotlin\n  Alerter.create(this@KotlinDemoActivity)\n         .setTitle(\"Alert Title\")\n         .setText(\"Alert text...\")\n         .setEnterAnimation(R.anim.alerter_slide_in_from_left)\n         .setExitAnimation(R.anim.alerter_slide_out_to_right)\n         .show()\n```\n\n### Visibility Callbacks\n\n```kotlin\n Alerter.create(this@KotlinDemoActivity)\n        .setTitle(\"Alert Title\")\n        .setText(\"Alert text...\")\n        .setDuration(10000)\n        .setOnShowListener(OnShowAlertListener {\n            Toast.makeText(this@KotlinDemoActivity, \"Show Alert\", Toast.LENGTH_LONG).show()\n        })\n        .setOnHideListener(OnHideAlertListener {\n            Toast.makeText(this@KotlinDemoActivity, \"Hide Alert\", Toast.LENGTH_LONG).show()\n        })\n        .show()\n```\n\n### Custom Fonts and Text Appearance\n\n```kotlin \n Alerter.create(this@DemoActivity)\n        .setTitle(\"Alert Title\")\n        .setTitleAppearance(R.style.AlertTextAppearance_Title)\n        .setTitleTypeface(Typeface.createFromAsset(getAssets(), \"Pacifico-Regular.ttf\"))\n        .setText(\"Alert text...\")\n        .setTextAppearance(R.style.AlertTextAppearance_Text)\n        .setTextTypeface(Typeface.createFromAsset(getAssets(), \"ScopeOne-Regular.ttf\"))\n        .show()\n```\n\n![Verbose Alert](./documentation/alert_custom_font.gif)\n\n### Swipe to Dismiss\n\n```kotlin\n Alerter.create(this@DemoActivity)\n        .setTitle(\"Alert Title\")\n        .setText(\"Alert text...\")\n        .enableSwipeToDismiss()\n        .show()\n```\n![Verbose Alert](./documentation/alert_swipe_to_dismiss.gif)\n\n### Progress Bar\n\n```kotlin\n Alerter.create(this@DemoActivity)\n        .setTitle(\"Alert Title\")\n        .setText(\"Alert text...\")\n        .enableProgress(true)\n        .setProgressColorRes(R.color.colorAccent)\n        .show()\n```\n\n![Verbose Alert](./documentation/alert_progress_bar.gif)\n\n### With Buttons\n\n```kotlin\n Alerter.create(this@KotlinDemoActivity)\n        .setTitle(R.string.title_activity_example)\n        .setText(\"Alert text...\")\n        .addButton(\"Okay\", R.style.AlertButton, View.OnClickListener {\n            Toast.makeText(this@KotlinDemoActivity, \"Okay Clicked\", Toast.LENGTH_LONG).show()\n        })\n        .addButton(\"No\", R.style.AlertButton, View.OnClickListener {\n            Toast.makeText(this@KotlinDemoActivity, \"No Clicked\", Toast.LENGTH_LONG).show()\n        })\n        .show()\n```\n\n![Verbose Alert](./documentation/alert_with_buttons.gif)\n\n### With Custom Layout\n```kotlin\n Alerter.create(this@KotlinDemoActivity, R.layout.custom_layout)\n        .setBackgroundColorRes(R.color.colorAccent)\n        .also { alerter -\u003e\n            val tvCustomView = alerter.getLayoutContainer()?.tvCustomLayout\n            tvCustomView?.setText(R.string.with_custom_layout)\n        }\n        .show()\n```\n\n![Verbose Alert](./documentation/alert_with_custom_layout.gif)\n\n# Contributing \u0026 Reporting Issues\n\n[Please read this if you're reporting an issue, or thinking of contributing!](./CONTRIBUTING.md)\n\n## Licence\n\nSee the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).\n\nCopyright 2017 Tapadoo, Dublin.\n\n\u003cimg src=\"https://2upm2b1wdft320vzjj34rpga-wpengine.netdna-ssl.com/wp-content/uploads/2019/12/logo-tapadoo-dark.png\" width=\"200\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTapadoo%2FAlerter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTapadoo%2FAlerter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTapadoo%2FAlerter/lists"}