{"id":15381397,"url":"https://github.com/penfeizhou/apng4android","last_synced_at":"2025-05-15T00:06:50.583Z","repository":{"id":37382109,"uuid":"178675760","full_name":"penfeizhou/APNG4Android","owner":"penfeizhou","description":"Android animation support for APNG \u0026 Animated WebP \u0026 Gif \u0026 Animated AVIF, High performance","archived":false,"fork":false,"pushed_at":"2025-04-02T13:59:20.000Z","size":37139,"stargazers_count":609,"open_issues_count":11,"forks_count":82,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-13T20:40:15.255Z","etag":null,"topics":["android","animatedavif","animatedwebp","animation","apng","avif","awebp","glide","webp"],"latest_commit_sha":null,"homepage":"","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/penfeizhou.png","metadata":{"files":{"readme":"README-zh_CN.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,"zenodo":null}},"created_at":"2019-03-31T10:55:45.000Z","updated_at":"2025-04-12T00:30:21.000Z","dependencies_parsed_at":"2025-04-13T19:48:09.357Z","dependency_job_id":null,"html_url":"https://github.com/penfeizhou/APNG4Android","commit_stats":{"total_commits":276,"total_committers":8,"mean_commits":34.5,"dds":"0.14492753623188404","last_synced_commit":"8ad07bdacf12a69b0363d592813ac9d71e759623"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penfeizhou%2FAPNG4Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penfeizhou%2FAPNG4Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penfeizhou%2FAPNG4Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/penfeizhou%2FAPNG4Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/penfeizhou","download_url":"https://codeload.github.com/penfeizhou/APNG4Android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249198,"owners_count":22039029,"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","animatedavif","animatedwebp","animation","apng","avif","awebp","glide","webp"],"created_at":"2024-10-01T14:27:05.772Z","updated_at":"2025-05-15T00:06:50.540Z","avatar_url":"https://github.com/penfeizhou.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android 动画播放库\n* 支持常用动画格式APNG、Animated WebP、Gif、AVIF\n* 解码实现高效，占用内存极低\n* 支持按Resource、Assets、File等多种方式读取\n* 提供Glide插件，可使用Glide直接加载\n* 支持动画播放过程控制\n* 支持静图展示\n\n## [版本记录](https://github.com/penfeizhou/APNG4Android/releases)\n\n## 使用说明\n\n### 在build.gradle添加依赖\n\n```gradle\nrepositories {\n    mavenCentral()\n}\n```\n#### Animated WebP\n```gradle\ndependencies {\n    implementation 'com.github.penfeizhou.android.animation:awebp:${VERSION}'\n}\n```\n#### APNG\n```gradle\ndependencies {\n    implementation 'com.github.penfeizhou.android.animation:apng:${VERSION}'\n}\n```\n#### Gif\n```gradle\ndependencies {\n    implementation 'com.github.penfeizhou.android.animation:gif:${VERSION}'\n}\n```\n#### AVIF\n```gradle\ndependencies {\n    implementation 'com.github.penfeizhou.android.animation:avif:${VERSION}'\n}\n```\n### `使用前请注意!`\n`不要将APNG资源放置到drawable或者mipmap目录下!` 在Android app release构建过程中, aapt工具会压缩修改APNG资源的帧信息, 会导致播放不正常. 因此请将APNG资源放置到工程内的`raw`或者`assets`目录内.\n\n### 使用\n\n```java\n// 从asset file中加载\nAssetStreamLoader assetLoader = new AssetStreamLoader(context, \"wheel.png\");\n\n\n// 从resource中加载\nResourceStreamLoader resourceLoader = new ResourceStreamLoader(context, R.drawable.sample);\n\n\n// 从file中加载\nFileStreamLoader fileLoader = new FileStreamLoader(\"/sdcard/Pictures/1.webp\");\n\n\n// 创建APNG Drawable\nAPNGDrawable apngDrawable = new APNGDrawable(assetLoader);\n\n//创建 Animated webp drawable\nWebPDrawable webpDrawable = new WebPDrawable(assetLoader);\n\n//自动播放\nimageView.setImageDrawable(apngDrawable);\n\n\n//可覆盖动画中设置的播放次数\napngDrawable.setLoopLimit(10);\n\n\n// 实现Animatable2Compat接口\ndrawable.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {\n    @Override\n    public void onAnimationStart(Drawable drawable) {\n        super.onAnimationStart(drawable);\n    }\n});\n```\n## Glide插件\n\n### build.gradle中添加依赖\n\n```gradle\nrepositories {\n    ...\n    mavenCentral()\n}\ndependencies {\n    implementation 'com.github.penfeizhou.android.animation:glide-plugin:${VERSION}'\n}\n```\n### 使用Glide加载图片\n\n```java\nGlide.with(imageView).load(\"https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png\").into(imageView);\nGlide.with(imageView).load(\"https://isparta.github.io/compare-webp/image/gif_webp/webp/2.webp\").into(imageView);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenfeizhou%2Fapng4android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpenfeizhou%2Fapng4android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenfeizhou%2Fapng4android/lists"}