Android Weekly Notes #479 Android Weekly Issue #479

Android Weekly Issue #479

Detect Instagram-like gestures with Jetpack Compose

用Jetpack Compose構建UI做的手勢處理來控制progress bar:

  • 點擊不同區域.
  • 點擊並且hold.

What's the equivalent of in Jetpack Compose?

輸入View中的控件或者屬性, 返回對應的Compose組件.

Safe delay in Android Views: goodbye Handlers, Hello Coroutines!

在Android View中安全地delay.

fun View.delayOnLifecycle(
    durationInMillis: Long,
    dispatcher: CoroutineDispatcher = Dispatchers.Main,
    block: () -> Unit
): Job? = findViewTreeLifecycleOwner()?.let {
    lifecycleOwner -> 
    lifecycleOwner.lifecycle.coroutineScope.launch(dispatcher) {
        delay(durationInMillis)
        block()
    }
}

How to animate BottomSheet content using Jetpack Compose

這個文章想找Bottom Sheet動畫的解決方案.

提到的這個app不錯:
https://github.com/fabirt/podcast-app

這個app居然用這種方式提供多個ViewModel: https://github.com/fabirt/podcast-app/blob/3ccf4f5f7cbf38631e74cfe3be4f8b8c5aa31920/android/app/src/main/java/com/fabirt/podcastapp/ui/common/ViewModelProvider.kt

最後動畫的sample: https://github.com/egorikftp/compose-animated-bottomsheet

Jetpack Compose Support in Workflow

Square的這個workflow: https://github.com/square/workflow

kotlin版本:
https://github.com/square/workflow-kotlin

Android App Modularisation and Navigation

App模塊化和navigation.

Sample: https://github.com/veepee-oss/link-router

Migrate from Dagger to Hilt — A Step by Step Guide

從Dagger遷移到Hilt.

An introduction to snapshot testing on Android in 2021

關於Snapshot test的介紹, 各大公司的使用現狀, 利弊分析.

後面的文章會講細節.

Sample: https://github.com/sergio-sastre/RoadToEffectiveSnapshotTesting

Activity Recognition API Tutorial for Android

Activity Recognition API.
檢測Activity的開始和退出.

https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognitionClient

Jetpack Compose – Text Shadows

文字陰影效果.

加個陰影竟然有這麼多種方式.

最後選的這一種:

style = MaterialTheme.typography.h4.copy(
    shadow = Shadow(
        color = shadowColor,
        offset = Offset(4f, 4f),
        blurRadius = 8f
    )
)

Pushing the right buttons in Jetpack Compose

一個button組件的開發過程.

Code

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章