Android Weekly Notes

Android Weekly Notes #472

2021-08-07  本文已影响0人  圣骑士wind

Android Weekly Issue #472

The dangers of JSON + default values

如果一个可空字段的默认值是非空的:

data class Foo(val bar: String? = "oops")

序列化和反序列化有可能会得到不一样的对象.

因为:

解决方案就是应该避免给可空字段加上非空值.
这个人还给moshi写了个request feature: https://github.com/square/moshi/issues/1358

Navigating with Animations in Jetpack Compose

作者的库:
https://github.com/KaustubhPatange/navigator
处理navigation, 并且有很多feature, 支持动画.

作者的观点: navigation不是问题, 处理back才是难点.
还有一些库比如:

Bluetooth Pairing

蓝牙扫描和配对需要权限.

Android 12以前还需要ACCESS_LOCATION_FINE权限. 非常困惑.

Android 12加了BLUETOOTH_SCANBLUETOOTH_CONNECT权限.

文中讨论了几种适配声明方案.

Show layout bounds from command line

alias boundson='adb shell setprop debug.layout true; adb shell service call activity 1599295570 > /dev/null'

alias boundsoff='adb shell setprop debug.layout false ; adb shell service call activity 1599295570 > /dev/null'

An effective testing strategy for Android (Part 1)

关于测试策略的各种讨论.

From Nothing to Material Transitions

关于动画的讨论和实现.

Code

Video

上一篇 下一篇

猜你喜欢

热点阅读