Android Weekly Issue #479
Detect Instagram-like gestures with Jetpack Compose
用Jetpack Compose构建UI做的手势处理来控制progress bar:
- 点击不同区域.
- 点击并且hold.
What's the equivalent of in Jetpack Compose?
输入View中的控件或者属性, 返回对应的Compose组件.
Safe delay in Android Views: goodbye Handlers, Hello Coroutines!
在Android View中安全地delay.
fun View.delayOnLifecycle(
durationInMillis: Long,
dispatcher: CoroutineDispatcher = Dispatchers.Main,
block: () -> Unit
): Job? = findViewTreeLifecycleOwner()?.let {
lifecycleOwner ->
lifecycleOwner.lifecycle.coroutineScope.launch(dispatcher) {
delay(durationInMillis)
block()
}
}
How to animate BottomSheet content using Jetpack Compose
这个文章想找Bottom Sheet动画的解决方案.
提到的这个app不错:
https://github.com/fabirt/podcast-app
这个app居然用这种方式提供多个ViewModel: https://github.com/fabirt/podcast-app/blob/3ccf4f5f7cbf38631e74cfe3be4f8b8c5aa31920/android/app/src/main/java/com/fabirt/podcastapp/ui/common/ViewModelProvider.kt
最后动画的sample: https://github.com/egorikftp/compose-animated-bottomsheet
Jetpack Compose Support in Workflow
Square的这个workflow: https://github.com/square/workflow
kotlin版本:
https://github.com/square/workflow-kotlin
Android App Modularisation and Navigation
App模块化和navigation.
Sample: https://github.com/veepee-oss/link-router
Migrate from Dagger to Hilt — A Step by Step Guide
从Dagger迁移到Hilt.
An introduction to snapshot testing on Android in 2021
关于Snapshot test的介绍, 各大公司的使用现状, 利弊分析.
后面的文章会讲细节.
Sample: https://github.com/sergio-sastre/RoadToEffectiveSnapshotTesting
Activity Recognition API Tutorial for Android
Activity Recognition API.
检测Activity的开始和退出.
Jetpack Compose – Text Shadows
文字阴影效果.
加个阴影竟然有这么多种方式.
最后选的这一种:
style = MaterialTheme.typography.h4.copy(
shadow = Shadow(
color = shadowColor,
offset = Offset(4f, 4f),
blurRadius = 8f
)
)
Pushing the right buttons in Jetpack Compose
一个button组件的开发过程.