2021-05-30

Google I/O 2021 Android精华内容

Google I/O 2021结束了, 都有什么精彩内容呢?
Android部分的Playlist附上: Android & Play at Google I/O 2021

Developer Keynote (Google I/O '21)

对于Android的部分来说, 主要是:

Android 12

  • user safety.
  • performance; improved app startup; customizable launch animations.
  • user experience; widgets.

Create beautiful apps, easier

现代化的Android开发.

  • Android Studio的升级.
  • Kotlin: Kotlin Symbol Processing.
  • Jetpack: 各种libraries和Compose.

Build across screens.

  • 各种屏幕.
  • Voice.
  • Watches: Health services.

The top 3 things to know in Modern Android Development | Android @ Google I/O'21

Android开发的三个top topic:

  • Jetpack: 一系列的Jetpack libraries发布了新版.

01-Jetpack-libraries.png

  • Tooling: Android Studio的升级, 有了WorkManager Inspector, UI的Inspector支持了View和Compose.
  • Kotlin.

02-kotlin-updates.png

03-coroutines-flows.png

What's new in Android | Keynote

Android 12 -> S.

  • @Deprecated -> deprecated.
  • Color.
  • Widgets.
  • Launch animations: 系统自带启动动画, 可以定制.
  • Notifications: 新的template style; Trampoline(?) 优化点开notification的那个短暂延迟.
  • Toasts: 带icon, 说明是哪个app弹的toasts; 控制个数.
  • Picture in Picture的改善.
  • ImageView有个setRenderEffect可以模糊照片了.
  • 可以用theme定制模糊.

04-Blurry-Theme.png

  • list的弹力拉伸效果. (我自己起的名字, 其实人家叫stretch overscroll).
  • Graphics: AVIF. 可以过滤支持的media类型.
  • Privacy: 关于permission的一些改进; 剪贴板内容会有toast说明来源; foreground restrictions.

What's new in Android development tools | Session

Android Studio版本号设计.

05-Android-Studio-Versions.png

  • Preview工具可以设置横屏, 定制尺寸, 显示blueprints, play animation. Compose的preview有交互模式.
  • Accessibility test framework scanner.
  • 适配多种屏幕: Layout validation.
  • 折叠屏, 手表.
  • 模拟器还可以模拟heart rate.
  • snapshots test.
  • WorkManager的tasks.
  • Migrate to Non-Transitive R Classes...

What's new in Jetpack | Session

解释了Jetpack的初衷和现状.
alpha和beta版本的意思.

  • Experimental Annotations -> Stable.
  • CameraX -> Stable.
  • AppSearch -> Alpha.
  • DataStore -> 用来取代SharedPreferences.

06-datastore-1.png

07-datastore-vs-sharedpreferences.png

  • Security Crypto -> Stable.
  • Hilt -> Stable.
  • WorkManager -> Stable. (Android Studio也推出了新的WorkManager Inspector.)
  • Room -> Stable.

08-room.png

  • ConstraintLayout -> Stable. MotionLayout + Motion Editor.
  • Fragment -> Stable.
    (详见release notes: https://developer.android.com/jetpack/androidx/releases/fragment.)
    重建了FragmentManager; 新增了get result的callback; 废弃了一些API, 并且Fragment StrictMode可以检测项目中是否还在使用.
  • Navigation -> Alpha. 现在支持多个backstacks.
  • Google Shortcuts -> Alpha.
  • EmojiCompat -> Alpha. (AppCompat 1.4.0以后默认包含.)
  • Paging -> Stable.
  • Macrobenchmark -> Alpha. (app启动和滚动效率; local/CI.)
  • Compose integrations.

09-compose-integrations.png

What's new in Jetpack Compose | Session

为什么我们需要一个全新的UI Toolkit呢. -> 为了适应更加现代化的开发方式.

faster & easier.

Compose将数据转换成UI.

Checkbox的例子:

10-checkbox-snippet.png
UI完全由参数控制. -> single source of truth. 没有其他的状态需要sync.

把参数和回调提到方法参数中去:

11-checkbox-in-reality.png

  • You completely describe your UI for a given state.
  • The framework updates your UI when the state changes.

这里有个图, 推荐ViewModel暴露一个Screen状态, 集中管理, 然后下发到每个composable.

12-viewmodel-expose-single-state.png

这样也利于测试.

Compose实现了material design, 提供了组件, 还有theming system.

有一个owl app的实现解说.

和传统view的interop.

13-compose-view-interop.png

State of Kotlin on Android | Session

  • Kotlin变得越来越流行, 不仅app, 还有server.
  • Kotlin Symbol Processing目前发布了alpha.
  • 编译器的升级.
  • 好多好多的ktx库.
  • protobuf的支持: https://developers.google.com/protocol-buffers/docs/kotlintutorial
  • coroutines的debugger -> coming soon. 可以在线程之间跳转, 查看信息.

What's new in Android Gradle plugin | Session

New APIs in the Android Gradle Plugin

Using Jetpack libraries in Compose | Session

Jetpack Compose和Jetpack中其他库可以很好的结合使用.

18-compose-with-jetpack-libraries.png

Top 12 tips to get ready for Android 12 | Session

Getting Ready for Android 12.

  • Developer Options -> App Compatibility Changes.
  • Foreground services were designed for multi-tasking and completing a user action. -> 从后台启动foreground services将被限制.
  • Expedited Jobs with WorkManager APIs.
  • User may turn off the mic and camera sensors using mic and camera toggles.
  • Apps that have not been used for an extended period will be hibernated. (permissions, storage, services)
  • Nearby device permission. Decouple Bluetooth scanning from Location.
  • MAC address restriction.
  • Safe component exporting. 有intent filter就必须显式声明exported.
  • Custom notifications deprecation.
  • App link improvements.
  • WebView Samesite.
  • New stretch overscroll.








原文转载:http://www.shaoqun.com/a/768967.html

跨境电商:https://www.ikjzd.com/

r标:https://www.ikjzd.com/w/1070

二类电商:https://www.ikjzd.com/w/1457


GoogleI/O2021结束了,都有什么精彩内容呢?Android部分的Playlist附上:Android&PlayatGoogleI/O2021DeveloperKeynote(GoogleI/O'21)对于Android的部分来说,主要是:Android12usersafety.performance;improvedappstartup;customizablelaunc
空中云汇:https://www.ikjzd.com/w/2684
writer:https://www.ikjzd.com/w/1280
新蛋:https://www.ikjzd.com/w/79
老公带女同事回家调情一整天:http://lady.shaoqun.com/m/a/271070.html
投资343亿后,亚马逊欲在印度创造100万个岗位!:https://www.ikjzd.com/articles/114778
1秒读懂这个FBA补货公式,卖家再也不用担心断货了!:https://www.ikjzd.com/articles/94011

No comments:

Post a Comment