npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jetpack-mvvm-best-practice

v1.0.0

Published

![slogan.png](https://upload-images.jianshu.io/upload_images/57036-896e7a8809a9a705.png)

Downloads

6

Readme

slogan.png

 

《重学安卓》付费读者加微信进群:myatejx

 

前言

很高兴见到你!

上周我在 各大技术社区 发表了一篇 《Jetpack MVVM 精讲》,原以为在 知识网红 唱衰安卓 的 2019 会无人问津,没想到文章一经发布,从 国内知名公司 的架构师、技术经理,到 世界级公司 的 Android 开发 都在看。😉

reader_say.png

并且从读者的反馈来看,近期大部分安卓开发 已跳出舒适圈,开始尝试认识和应用 Jetpack MVVM 到实际的项目开发中。

只可惜,关于 Jetpack MVVM,网上多是 东拼西凑、人云亦云、通篇贴代码 的文章,这不仅不能提供完整的视角 来帮助读者 首先明确背景状况,更是给还没入门 Jetpack 的读者 徒添困扰、起到 劝退 的作用。

好消息是,这一期,我们带着 精心打磨的 Jetpack MVVM 最佳实践案例 来了!

   

| 是让人 爱不释手 的 交互设计! | 是 连贯 的 用户体验 | 唯一可信源 的 统一分发 | | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | | 1231111323.gif | 222.gif | 333.gif |

| 横竖屏布局 的 无缝切换 | | :----------------------------------------------------------: | | 444.gif |

   

项目简介

本人拥有 3 年的 移动端架构 践行和设计经验,领导团队重构的 中大型项目 多达十数个,对 Jetpack MVVM 架构在 确立规范化、标准化 开发模式 以 减少不可预期的错误 所作的努力,有着深入的理解。

在这个案例中,我将为你展示,Jetpack MVVM 是如何 蕴繁于简 地 将原本十分容易出错、一出错就会耽搁半天时间的开发工作,通过 寥寥的几行代码 轻而易举地完成。😉

👆👆👆 划重点!

 

在这个项目中,

我们为 横、竖屏 的情况 分别安排了两套 截然不同的布局,并且在 生命周期重建机制状态管理DataBindingViewModelLiveDataNavigation 等知识点的帮助下,通过寥寥几行代码,轻松做到 在横竖屏两种布局间 无缝地切换,并且不产生任何 预期外的错误

我们在多个 Fragment 页面 分别安排了 播放状态 指示器(包括 播放暂停按钮状态、播放列表当前索引指示 等),并向你展示了 如何 以及为何 通过 LiveData 配合 作为唯一可信源 的 ViewModel 或单例,来实现 全应用范围内 可追溯事件 的统一分发

我们在 Fragment 和 Activity 之间分别安排了 跨页面通信,从而向你展示 如何基于 迪米特原则(也称 最少知道原则)、通过 UnPeekLiveData 和 应用级 SharedViewModel 来实现 生命周期安全的、事件源可追溯的 页面通信(事件回调)。

我们在 ui.page data.repositorybridge.request 等目录下,分别安排了 视图控制器、ViewModel 、DataRepository 等 内容,从而向你展示,单向依赖 的架构设计,是如何通过分层的 数据请求和响应,来 规避 内存泄漏 等问题。

本项目的代码一律采用 经过 ISO 认证的 标准化工业级语言 Java 来编写。并且,在上述目录 所包含的 类中,我们大都 提供了丰富的注释,来帮助你理解 骨架代码 为何要如此设计、如此设计能够 在软件工程的背景下 避免哪些不可预期的错误。

   

除了 在 蕴繁于简 的代码中 掌握 MVVM 最佳实践,你还可以 从这个开源项目中 获得的内容 包括:

  1. 整洁的代码风格 和 标准的资源命名规范。
  2. 对 视图控制器 知识点的 深入理解 和 正确使用。
  3. AndroidX 和 Material Design 2 的全面使用。
  4. ConstraintLayout 约束布局的最佳实践。
  5. 优秀的 用户体验 和 交互设计
  6. 绝不使用 Dagger,绝不使用奇技淫巧、编写艰深晦涩的代码。
  7. The one more thing is:

即日起,可在 应用商店 下载体验!

google-play1.png coolapk1.png

   

Thanks to

AndroidX

Jetpack MVVM

material-components-android

轻听

AndroidSlidingUpPanel

项目中使用的 图片素材 来自 UnSplash 提供的 无版权免费图片

项目中使用的 音频素材 来自 BenSound 提供的 无版权免费音乐

   

My Pages

Email:[email protected]

Home:KunMinX 的个人博客

Juejin:KunMinX 在掘金

《重学安卓》 专栏

付费读者加微信进群:myatejx

重学安卓小专栏

License

Copyright 2018-2019 KunMinX

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.