Android Weekly Notes #411
2020-04-30 本文已影响0人
圣骑士wind
Android Weekly Issue #411
Dagger navigation support in Android Studio
Android Studio的dagger工具.
Replacing Custom Views with View Binding
为啥View Binding可以取代自定义View呢?
一些基础:
这是介绍View Binding的:
https://medium.com/androiddevelopers/use-view-binding-to-replace-findviewbyid-c83942471fc
ViewBinding还可以用代理属性简化写:
class MainActivity : AppCompatActivity() {
private val binding by viewBinding(MainActivityBinding::inflate)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
binding.button.onClick {
showToast("hello world!")
}
感觉他们的custom view其实是view holder.
Unit Testing ViewModel with Coroutines and LiveData
ViewModel的单元测试.
代码
扫雷小游戏: https://github.com/lucasnlm/antimine-android
协程的使用cases:
https://github.com/LukasLechnerDev/Kotlin-Coroutine-Use-Cases-on-Android
想用协程的推荐看看.
视频
一个教程: https://www.youtube.com/playlist?list=PLU4MI50rsBvaSyQvDeMRADo2Q_MOBevo1
这个Now in Android的系列视频会说一些最近进展:
https://www.youtube.com/watch?index=2&list=PLWz5rJ2EKKc9AtgKMBBdphI-mrx8XzW56&v=C4nursAx-hY&app=desktop
文字版: https://medium.com/androiddevelopers/tagged/now-in-android