Android开发成长

Android Weekly Notes #415

2020-05-26  本文已影响0人  圣骑士wind

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

上一篇 下一篇

猜你喜欢

热点阅读