Android Weekly Notes #500

Android Weekly Issue #500

Screen templates — using Compose, SwiftUI & KMM

KMM下Compose和SwiftUI的跨平臺(tái)解決方案.

ViewModel和State是同一份. 但是UI模板代碼是各個(gè)平臺(tái)各一份.

Detect text overflow in Jetpack Compose

一個(gè)超出后顯示末尾badge count的compose實(shí)現(xiàn).

Tiny things on big screens

在平板上顯示空間太大了怎么辦?

有時(shí)候可能沒有master detail的需求.
不想展示很大的button, 也不想隔很遠(yuǎn)的距離.

首先用BoxWithConstraints把內(nèi)容居中, 并且設(shè)置最大寬度.

有劉海怎么辦? 用WindowManager. 需要添加依賴.

Automatic screenshot testing for all your Compose @Previews

截圖測試:

@ShowkaseScreenshot(rootShowkaseClass = ShowkaseRoot::class)
abstract class ComposeTests : ShowkaseScreenshotTest {

    override fun onScreenshot(
        id: String,
        name: String,
        group: String,
        styleName: String?,
        screenshotType: ShowkaseScreenshotType,
        screenshotBitmap: Bitmap
    ) {
        val view = ImageView(InstrumentationRegistry.getInstrumentation().context)
        view.setImageBitmap(screenshotBitmap)
        ViewHelpers.setupView(view).setExactWidthPx(screenshotBitmap.width).setExactHeightPx(screenshotBitmap.height).layout()
        Screenshot.snap(view).setName("$group - $name").record()
    }
}

這個(gè)居然是把Compose轉(zhuǎn)為View來測.

Things you should know about Coroutines. Part 4

協(xié)程的異常處理, 文章配圖不錯(cuò).

WorkManager multi-process for libraries

LeakCanary用了WorkManager.

Code

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容