{"id":13631350,"url":"https://github.com/zhujiang521/PlayAndroid","last_synced_at":"2025-04-17T21:32:50.100Z","repository":{"id":37371771,"uuid":"265420729","full_name":"zhujiang521/PlayAndroid","owner":"zhujiang521","description":"🔥🔥🔥 Kotlin + MVVM + LCE版玩安卓，暗黑模式、横竖屏、无网、弱网、无数据、加载失败等等各种情况，协程、Room、Hilt、DataStore、LiveData、Retrofit、屏幕适配、本地缓存、多语言切换、多 lib，你想要的我都有！！！","archived":false,"fork":false,"pushed_at":"2024-12-09T07:08:21.000Z","size":44928,"stargazers_count":1655,"open_issues_count":17,"forks_count":234,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-13T13:55:32.024Z","etag":null,"topics":["compose","coroutines","datastore","hilt","jetpack","kotlin","mvvm","retrofit2","room"],"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/zhujiang521.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":"2020-05-20T01:59:28.000Z","updated_at":"2025-04-11T13:33:16.000Z","dependencies_parsed_at":"2023-01-30T05:46:22.520Z","dependency_job_id":"e0600659-a363-4efd-8ae5-a4a18b574030","html_url":"https://github.com/zhujiang521/PlayAndroid","commit_stats":{"total_commits":315,"total_committers":3,"mean_commits":105.0,"dds":0.06666666666666665,"last_synced_commit":"701d518f62b056b0c5c2d5222c5f9093e8b75c92"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhujiang521%2FPlayAndroid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhujiang521%2FPlayAndroid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhujiang521%2FPlayAndroid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhujiang521%2FPlayAndroid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhujiang521","download_url":"https://codeload.github.com/zhujiang521/PlayAndroid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249381007,"owners_count":21261227,"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":["compose","coroutines","datastore","hilt","jetpack","kotlin","mvvm","retrofit2","room"],"created_at":"2024-08-01T22:02:21.910Z","updated_at":"2025-04-17T21:32:49.360Z","avatar_url":"https://github.com/zhujiang521.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Play Android\n\n### 项目新增了 Compose 版本，大家如果想体验的话下载代码直接切换为 main 或 compose 分支即可，有问题直接提 issues。\n\n## 我的新书\n大家可以购买我的新书[《Jetpack Compose：Android全新UI编程》](https://juejin.cn/post/7027020266312056840)进行阅读，里面有完整的 Compose 框架供大家学习。\n\n[京东购买地址](https://item.jd.com/10039809078875.html)\n\n[当当购买地址](http://product.dangdang.com/593507948.html)\n\n呸呸呸，太不要脸了，又在推荐自己的新书。。。\n\n如果对你有帮助的话，别忘记点个 Star，感激不尽。\n\n## 公众号\n如果想关注我的话可以关注我的公众号：《江江安卓》，里面会不定期更新有关安卓的知识及个人见解。\n\n### 体验\n\n如果想要下载尝试下的话可以直接点击链接进行下载，或者扫描下面的二维码进行下载。\n\n[https://www.pgyer.com/llj2](https://www.pgyer.com/llj2)\n\n![img](https://www.pgyer.com/app/qrcode/llj2)\n\n如果上面的下载次数用完的话可以点击下面链接：\n[https://github.com/zhujiang521/PlayAndroid/raw/master/apk/app-release_7zip_aligned_signed.apk](https://github.com/zhujiang521/PlayAndroid/raw/master/apk/app-release_7zip_aligned_signed.apk)\n\n### 玩安卓MVVM版截图\n\n首先来看下之前已经实现的大概样式吧：\n\n#### 初始样式\n\n| ![](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/d8174415292b44f5811b85bf37c1d802~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5f31266f469b4f429edcbdc0cccfbd1c~tplv-k3u1fbpfcp-zoom-1.image) |\n| ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2ade872693944653878bcdc083f95f38~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/35da6aa74259481b97b5e72274065289~tplv-k3u1fbpfcp-zoom-1.image) |\n\n看着样式还好，但之前只是简单做了下，实现了最基本的功能，切换成横屏之后基本没办法看，更不要说分屏、夜间模式、本地缓存、无网弱网情况、无数据情况等等了，接下来看一下现在新增的适配页面吧。\n\n#### 夜间模式\n\n| ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2f4675435bc14eb6b2ad3c8835eef67d~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2fb514278fe54c069105f416eb288f29~tplv-k3u1fbpfcp-zoom-1.image) |\n| ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/445d5c6ae8844821bf5883a0cb550aec~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6ae7729491c14b1ebb75155a66ac7af7~tplv-k3u1fbpfcp-zoom-1.image) |\n\n#### 横屏适配\n\n| ![](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/07e5a55a73cd4331bf8f9c4a26d9f90f~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8e0e9bbd5cfc49c5848a9e37676829cb~tplv-k3u1fbpfcp-zoom-1.image) |\n| ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f28b9034bdf645c7b090f88b695ea6f3~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/9534ff4ece1c41fb8cd433d7a06283de~tplv-k3u1fbpfcp-zoom-1.image) |\n\n#### 无网、无数据适配\n\n| ![](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ec30cd391fe84d77a37b0f74be68b15a~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2fc9925bff314a71bd996f39cd99c732~tplv-k3u1fbpfcp-zoom-1.image) |\n| ------------------------------------------------------------ | ------------------------------------------------------------ |\n| ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/69d36313d7f845e4a1704db526d45b35~tplv-k3u1fbpfcp-zoom-1.image) | ![](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/0f12e1c05adf4bafae9788e8a6543506~tplv-k3u1fbpfcp-zoom-1.image) |\n\n### 实现过程\n\n项目用到了很多技术，基本上都是现在安卓app的最新标配，比如：MVVM、JetPack（LiveData、Room、ViewModel）、Retrofit、协程、Glide等等。\n\n其实在优化这个Demo的时候觉得做了好多事，但是真的让我写的时候就有点懵逼了，因为用到的东西比较多，随便拎出一个来都能单独写一篇文章；\n\n比如在apk大小的优化，这个apk最后被我优化到只剩3.3MB，现在随便一个apk都得几十MB吧。apk优化的挺多，比如代码混淆、资源文件的混淆、不需要的语言删除、图片转webp等等，如果想深入了解apk压缩的话，可以去看我之前写的这篇文章：[玩安卓必须要掌握的性能优化之APK极限压缩](https://zhujiang.blog.csdn.net/article/details/104434151)。\n\n又比如新增的浏览历史功能中用到了**Room**，没有**Room**的时候基本都在使用原生或者使用**LitePal**和**GreenDAO**等来实现，虽然**LitePal**和**GreenDAO**也是**ORM**的方式来实现的数据库操作，但是总体来说还是没有**Room**好用，**Room**写好实现的DAO接口文件即可，在你编译的时候会直接生成对应的实现类，真的很香。\n\n类似上面的还有很多，如果代码哪块写的不好或者有优化的地方欢迎大家告诉我或者给我提issues。\n\n### 使用到的库\n\n[banner](https://github.com/youth5201314/banner)\n\n[bugly](https://bugly.qq.com/v2/workbench/apps)\n\n[SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout)\n\n[utilCode](https://github.com/Blankj/AndroidUtilCode/)\n\n[glide](https://github.com/bumptech/glide)\n\n[retrofit](https://square.github.io/retrofit/)\n\ndataStore\n\ncoroutines\n\nroom\n\n### License\n\n```xml\nCopyright (c) 2020 朱江\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```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhujiang521%2FPlayAndroid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhujiang521%2FPlayAndroid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhujiang521%2FPlayAndroid/lists"}