Android Weekly Issue #485
Accessibility in Jetpack Compose
Accessibility的codelab.
Benefits of building components instead of screens
Counter, stateful和stateless组件的比较.
组件化的好处.
Explore SplashScreen API, Android 12, Kotlin
Android 12的splash screen:
先设置theme:
<style name="SplashActivity" parent="Theme.AppCompat.NoActionBar">
<!-- Point 3-->
<item name="android:windowSplashScreenBackground">#FFFFFF</item>
<!-- Point 2-->
<item name="android:windowSplashScreenIconBackgroundColor">
#000000</item>
<!-- Point 1-->
<item name="android:windowSplashScreenAnimatedIcon">
@drawable/ic_realm_logo_250</item>
<!-- Point 4-->
<item name="android:windowSplashScreenBrandingImage">
@drawable/relam_horizontal</item> </style>
代码里:
private val viewModel: MainViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addInitialDataListener()
loadAppView()
}
private fun addInitialDataListener() {
val content: View = findViewById(android.R.id.content)
// This would be called until true is not returned from the condition
content.viewTreeObserver.addOnPreDrawListener {
return@addOnPreDrawListener viewModel.isAppReady.value ?: false
}
}
private fun loadAppView() {
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
有个返回值决定是否跳转.
Automating analyzing of code in Android projects
Android项目自动分析和检查的一些工具.
Style Navigation Bar on Android
Bottom Bar样式定制. 加了数字小标签.
Hilt Extensions in the MAD Skills series
系列视频的第四集, 如何写Hilt Extensions.
这一系列的四个视频都挺好的:
- 1 Hilt基本用法
- 2 Hilt测试
- 3 Hilt原理
- 4 Hilt Extensions
另外还收藏了这个cheat sheets:
https://medium.com/androiddevelopers/dagger-code-generation-cheat-sheets-6b4fa2da4e7a
和这个视频: Understanding Dagger 2's Codegen
The secrets of effectively snapshot testing on Android
如何设计并写好截图测试.
是Android View的UI测试.
Demo: https://github.com/sergio-sastre/FontSizeTestRule?ref=androidrepo.com
Skia shaders in Compose Desktop
Aurora是一系列的库, 用来写Compose Desktop的.
Skia是一个图像引擎. 它的Shading lauguage是SkSL.
本文讲如何用Skia shaders来给desktop app画背景.
How to return 2+ values with 0 allocation in Kotlin
如何返回多个值?
Launch Response Time
app的启动时间.