Android开发成长Android Weekly Notes

Android Weekly Notes #426

2020-08-16  本文已影响0人  圣骑士wind

Android Weekly Issue #426

Android Design System and Theming: Typography

如何在应用中添加字体.

Material Design Type System定义了13种样式.

这个视频里建议我们把style, theme和字体分开来定义.

Material Slider

Google发布的material库, 里面的滑动条.

AndroidX有:
androidx.appcompat.widget.AppCompatSeekBar.

Material有:
com.google.android.material.slider.Slider, 还有范围选择的: com.google.android.material.slider.RangeSlider.

Accurate Measurements With getTextBounds()

关于文字Span的测量.

里面还推荐了一个101的文章:
https://proandroiddev.com/android-and-typography-101-5f06722dd611

Android Vitals - Is this a cold start?

LeakCanary作者的系列文章, 讨论如何判断一个app的冷启动.

Kotlin JSON serialization crash course

Gson对于Kotlin的可空支持得不好.

可以看这里: JSON to Kotlin data class

JakeWharton的留言:

Please don't use Gson. 2 out of 3 maintainers agree: it's deprecated. 

Use Moshi, Jackson, or kotlinx.serialization which all understand Kotlin's nullability. 

Gson does not and will do dumb things, and it won't be fixed. Please abandon it.

Signed, a Gson maintainer.

除了Moshi之外, Kotlin自己也提供了序列化方案.

使用的时候需要添加依赖(按官方文档).

然后把data类标记为@Serializable.

可以给字段设置默认值.
要忽略的字段标记为: @Transient.

Code Coverage Best Practices

关于测试覆盖率的一些best practices.

Code

News

可以在应用中评价了:
https://android-developers.googleblog.com/2020/08/in-app-review-api.html

上一篇 下一篇

猜你喜欢

热点阅读