{"id":13647557,"url":"https://github.com/o0o0oo00/Pudding","last_synced_at":"2025-04-22T02:32:02.660Z","repository":{"id":217095827,"uuid":"176275589","full_name":"o0o0oo00/Pudding","owner":"o0o0oo00","description":":star2: Pudding use WindowManager(don't need request permission) to pull down a view that are displayed on top their attached window ","archived":false,"fork":false,"pushed_at":"2019-12-24T09:02:05.000Z","size":10266,"stargazers_count":386,"open_issues_count":1,"forks_count":36,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T21:59:01.574Z","etag":null,"topics":["alert","alerting","android-library","android-ui","custom-view","dsl","jitpack","kotlin","lambda","toast","toaster","window-manager"],"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/o0o0oo00.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":"2019-03-18T12:07:22.000Z","updated_at":"2025-04-02T20:54:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"495792dc-5dfb-40ec-93e4-d7ba9c7ccf98","html_url":"https://github.com/o0o0oo00/Pudding","commit_stats":null,"previous_names":["o0o0oo00/pudding"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o0o0oo00%2FPudding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o0o0oo00%2FPudding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o0o0oo00%2FPudding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o0o0oo00%2FPudding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o0o0oo00","download_url":"https://codeload.github.com/o0o0oo00/Pudding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250163715,"owners_count":21385295,"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":["alert","alerting","android-library","android-ui","custom-view","dsl","jitpack","kotlin","lambda","toast","toaster","window-manager"],"created_at":"2024-08-02T01:03:38.723Z","updated_at":"2025-04-22T02:32:02.652Z","avatar_url":"https://github.com/o0o0oo00.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Pudding\n[![](https://jitpack.io/v/o0o0oo00/Pudding.svg)](https://jitpack.io/#o0o0oo00/Pudding)\n\u003ca title=\"Hits\" target=\"_blank\" href=\"https://github.com/o0o0oo00/Pudding\"\u003e\u003cimg src=\"https://hits.b3log.org/o0o0oo00/Pudding.svg\"\u003e\u003c/a\u003e\n\n代替Toast/SnackBar新方式，使用WindowManager 无需申请权限\n\n### WIKI\n\n[中文说明](https://github.com/o0o0oo00/Pudding/blob/master/WIKIPAGE.md)\n\n### Usage\n\n```groovy\nallprojects {\n    repositories {\n    ...\n     maven { url 'https://jitpack.io' }\n```\n\n```groovy\n   implementation 'com.github.o0o0oo00:Pudding:1.2.1'\n```\n\n\n\nGIF可能要等会就顺畅了，一开始可能会比较迟钝 (●ﾟωﾟ●)\n\n常见的可配置的几种形式\n\nCommon configurable Pudding \n\n\u003cimg src=\"demogif/first3.gif\" width=\"300\"/\u003e\n\n```kotlin\nPudding.create(this) {\n    setTitle(\"This is Title\")\n    setText(\"this is text\")\n}.show()\n```\n\n```kotlin\nPudding.create(this) {\n    setChocoBackgroundColor(resources.getColor(R.color.colorAccent))\n    setTitleTypeface(Typeface.DEFAULT_BOLD)\n}.show()\n```\n\n```kotlin\nPudding.create(this) {\n    setTitle(\"Choco Title\")\n    setText(\"this is text\")\n    setIcon(R.drawable.ic_event_available_black_24dp)\n}.show()\n```\n\n```kotlin\nPudding.create(this) {\n    setTitle(\"Choco Title\")\n    setText(\"This is Text , it's very short and I don't like short \\n This is Text , it's very short and I don't like short\")\n    onShow {\n        Toast.makeText(this@MainActivity, \"onShowListener\", Toast.LENGTH_SHORT).show()\n    }\n    onDismiss {\n        Toast.makeText(this@MainActivity, \"onDismissListener\", Toast.LENGTH_SHORT).show()\n    }\n}.show()\n```\n\n\n配合[FancyDialog](https://github.com/o0o0oo00/FancyDialog)可实现**Pudding**显示在**Dialog**的阴影之上\n\nWith [FancyDialog](https://github.com/o0o0oo00/FancyDialog), Pudding can be displayed above the shadow of Dialog.\n\n\u003cimg src=\"demogif/withDialog.gif\" width=\"300\"/\u003e\n\n\n\n每个Activity拥有各自的Pudding，互相之间不影响\n\nEach Activity has its own Pudding, which does not affect each other.\n\n\n\u003cimg src=\"demogif/startActivity.gif\" width=\"300\" /\u003e\n\n\n**Imitate [Alerter](https://github.com/Tapadoo/Alerter) and ☆⌒(*＾-゜)v THX!! a lot** \n\n### what's different\n\nUse activity decorView we can show a view on top of Activity。but when dialog is showing , its black background will cover the view , that is not cool. so i create this repository to solve this problem , and  I hope it's useful to you\n\n### Something new\n\n* Use DSL style to config `Choco`\n* Show Queue\n* Cover Dialog/PopWindow\n* Don't need to request permission\n\n\n#### TODO\n\n1. 两种addView方式\n    -   [x] activity decorView\n    -   [x] windowManager \n        -   [x] 动画显示\n        -   [x] 生命周期控制\n        -   [x] 有权限/无权限情况 (考虑到这个需求不是很大，而且每个项目的权限适配都不一致，而且国产手机权限这一块参差不齐，所以决定不做这一块了，对功能也没影响)\n        -   [x] 各个版本的适配\n\n2. 内部显示队列(考虑可以使用kotlin通道来实现)\n    -   [x] 上一条未消失时，后来一条等待\n    -   [x] 直接顶掉上一条，上一条渐变消失\n\n3. 左右/上下滑动消失动画\n\n    - [x] 上下消失\n    - [x] 左右滑动消失\n\n4. Pudding cover dialog\n\n    - [x] 配合[FancyDialog](https://github.com/o0o0oo00/FancyDialog)实现 \n\n\n\n#### 可能会有的疑问：\n\n- [x] **Pudding**使用的是WindowManager 难道不需要申请权限吗？\n\n  - [x] **Pudding**使用`WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL`的层级低于系统级层级`TYPE_SYSTEM_ALERT`也就是在2000之下，是不需要申请权限的。\n\n- [x] 不同的Activity对应的WindowManager是否相同\n\n    - [x] 不同的window，不同的WindowManager，相同的WindowManagerGlobal（最终实现view的添加、删除、更新）\n\n- [x] 不同的WindowManager为什么可以移除对方的View\n\n    - [x] 因为所有的Activity共同只有一个WindowManagerGlobal（其内部持有所有添加的View的集合引用）\n\n- [X] 如何去维护一个Pudding队列\n\n    - [x] 用一个`Map\u003cstring,pudding\u003e`\n    - [X] 什么时间 去clear这个map (●ﾟωﾟ●)挠头？\n            when activity destory clean the key which is activity toString()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo0o0oo00%2FPudding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo0o0oo00%2FPudding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo0o0oo00%2FPudding/lists"}