Android Weekly Issue #416
在相关链接里看到这个文章:
https://zsmb.co/lets-review-pokedex/
这个大哥把pokedex给review了.
Modern Security in Android (part 1)
安全的系列文章.
Make your apps fold; Make it work with foldable displays
可折叠设备的app.
A hidden Kotlin gem: Deprecations with ReplaceWith
如果@Deprecated
加上replaceWith
:
@Deprecated(
message = "Use simpler logout() instead",
replaceWith = ReplaceWith("logout()")
)
fun doLogout() {
logout()
}
点击Alt + Enter就可以自动替换成建议的方法.
还可以有参数和加import:
@Deprecated(
message = "Use simpler login with Credentials",
replaceWith = ReplaceWith(
expression = "login(Credentials(usr, pwd))",
imports = ["auth.Credentials"]
)
)
fun doLogin(pwd: String, usr: String) {
}
@Deprecated默认的等级是warning, 其实还有error和hidden.
Kotlin Collection Functions Cheat Sheet
Kotlin集合方法的小抄.
Stop using Gradle buildSrc. Use composite builds instead
buildSrc
的一些缺点: 慢, 缓存失效等.
解决方法: https://docs.gradle.org/current/userguide/composite_builds.html
News
Android Studio 4.0
几个比较重要的改变:
- motion layout的编辑器
- Smart editor feature when writing rules for R8
- 项目配置:
android {
// The default value for each feature is shown below.
// You can change the value to override the default behavior.
buildFeatures {
// Determines whether to support View Binding.
// Note that the viewBinding.enabled property is now deprecated.
viewBinding = false
// Determines whether to support Data Binding.
// Note that the dataBinding.enabled property is now deprecated.
dataBinding = false
...
}
}
- build analyzer:
https://developer.android.com/studio/build/build-analyzer
网友评论