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:
先設(shè)置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)
有個(gè)返回值決定是否跳轉(zhuǎn).
Automating analyzing of code in Android projects
Android項(xiàng)目自動(dòng)分析和檢查的一些工具.
Style Navigation Bar on Android
Bottom Bar樣式定制. 加了數(shù)字小標(biāo)簽.
Hilt Extensions in the MAD Skills series
系列視頻的第四集, 如何寫Hilt Extensions.
這一系列的四個(gè)視頻都挺好的:
- 1 Hilt基本用法
- 2 Hilt測(cè)試
- 3 Hilt原理
- 4 Hilt Extensions
另外還收藏了這個(gè)cheat sheets:
https://medium.com/androiddevelopers/dagger-code-generation-cheat-sheets-6b4fa2da4e7a
和這個(gè)視頻: Understanding Dagger 2's Codegen
The secrets of effectively snapshot testing on Android
如何設(shè)計(jì)并寫好截圖測(cè)試.
是Android View的UI測(cè)試.
Demo: https://github.com/sergio-sastre/FontSizeTestRule?ref=androidrepo.com
Skia shaders in Compose Desktop
Aurora是一系列的庫(kù), 用來寫Compose Desktop的.
Skia是一個(gè)圖像引擎. 它的Shading lauguage是SkSL.
本文講如何用Skia shaders來給desktop app畫背景.
How to return 2+ values with 0 allocation in Kotlin
如何返回多個(gè)值?
Launch Response Time
app的啟動(dòng)時(shí)間.