Android Weekly Notes #415

Android Weekly Issue #415

SavedStateHandle to the Rescue

自带的:

class SearchFragment: Fragment{
  private val vm: SavedStateViewModel by viewModels()
}
class SavedStateViewModel(
  private val state: SavedStateHandle
) : ViewModel()

和依赖注入框架如何结合呢?
文中给出了解决方案.

本期还有另一个文章也是说这个事情:
Leveraging AssistedInjection to inject ViewModels

Android Unidirectional Data Flow — Kotlin Flow vs. RxJava

Flow和Rx的对比.

StateFlow, End of LiveData?

Kotlin协程库的StateFlow.

例子: https://github.com/scalereal/StateFlow-Demo

Reification of the Erased

Java中的泛型擦除.

reified必须和inline方法一起.

reified类型的内联方法, 编译器会拷贝方法体, 并且把泛型类型替换成声明的类型.

Java不支持inline, 所以不支持这样的特性.

The Result Monad

一个叫做: kotlin-result的库

Code

Decorator: RecyclerView的Decorator.

静态检查插件: https://github.com/GradleUp/static-analysis-plugin

变形动画: https://github.com/skydoves/TransformationLayout

Jetpack Compose的playground: https://github.com/hitherejoe/ComposeAcademy-Playground

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容