美文网首页Android Weekly Notes
Android Weekly Notes #472

Android Weekly Notes #472

作者: 圣骑士wind | 来源:发表于2021-08-07 23:46 被阅读0次

Android Weekly Issue #472

The dangers of JSON + default values

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

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

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

因为:

  • 序列化的时候给这个字段为null.
  • 反序列化的时候给这个字段为默认值.

解决方案就是应该避免给可空字段加上非空值.
这个人还给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

相关文章

网友评论

    本文标题:Android Weekly Notes #472

    本文链接:https://www.haomeiwen.com/subject/eysnvltx.html