Android Weekly Notes #488

Android Weekly Issue #488

How to Secure Secrets 🔑 in Android (In-Depth) — Android Security-02

Manage your Gradle dependencies with Version Catalog (not only) in Android

多个module之后, 如何管理依赖就是个问题.

关于几种做法的总结: https://handstandsam.com/2018/02/11/kotlin-buildsrc-for-better-gradle-dependency-management/

Gradle 7.0 又出现了一种新方法:

首先在settings里面:

enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
  versionCatalogs {
    libs { 
      version('ver', '1.0.0')
      alias('my-alias').to('group', 'artifact').versionRef('ver')
      alias('another').to('group', 'artifact').versionRef('ver')
      bundle('my-bundle', ['my-alias', 'another']) 
   }
  }
}

版本提醒需要结合这个库:
https://github.com/ben-manes/gradle-versions-plugin

详情请见官方文档:
https://docs.gradle.org/current/userguide/platforms.html

Stressing memory on Android

Android的内存管理.

Compose for Wear OS: Scaffold

手表应用也可以用Compose.

What’s New in kotlinx.serialization 1.3

Kotlin serialization 1.3的新特性.

  • 序列化值的编码.
  • 可空类型的处理.
  • class discriminator.

Fastlane Tutorial for Android

fastlane还有screengrab呢.

androidTestImplementation('tools.fastlane:screengrab:2.1.0') {
  exclude group: 'com.jraska:falcon'
}
androidTestImplementation 'com.jraska:falcon:2.2.0'

本文讲了发布到Firebase和Google Play上.

Introduction to Paging 3.0 in the MAD Skills Series

Fetching data and binding it to the UI in the MAD skills series

两篇Paging3的教程, 基本介绍, 具体做法, 取到数据然后刷新到UI上.

Protecting your backends with Firebase App Check

Firebase App Check. 防止后端被恶意访问.

Using CameraX Exposure Compensation API

CameraX的曝光补偿.

Jetpack Compose: Drag-and-drop reorder for lists

Jetpack Compose的list item拖拽排序.

用的是这个库:
https://github.com/aclassen/ComposeReorderable

val state = rememberReorderState() // 1.
val tasks by viewModel.getTasks().observeAsState(listOf())

LazyColumn(
    state = state.listState,
    modifier = Modifier
        .reorderable(state, { fromPos, toPos -> // 2.
            viewModel.onTaskReordered(tasks, fromPos, toPos)
        })
        .detectReorderAfterLongPress(state) // 3.
) {
    items(tasks, key = { task -> task.id }) { task ->
        Text(
            task.text,
            Modifier
                .draggedItem(state.offsetByKey(task.id)) // 4.
        )
    }
}

Jetpack Compose: lists primer

Compose的List:
Column:

  • 所有的item都会被绘制.

LazyColumn:

  • 按屏幕显示绘制.

Code

推荐阅读更多精彩内容