Android Weekly Issue #290

December 31st, 2017

Android Weekly Issue #290

本期内容包括介绍Kotlin逆变协变的一篇(虽然没说清楚,但我补充了),IoT相关制作MIDI Controler的Part two,以及比较炫酷的Shared Element Reveal动画,以及LiveData与DataBinding相关,Kotlin扩展Fragment/Activity方法做测试,Rx逐条打Log等等.

ARTICLES & TUTORIALS

Lessons learned implementing Redux on Android

文章介绍了模仿Web的Redux,实现其kotlin版本,实现Reducer,通过StateAction来驱动状态的转换.

State -> UI -> Action -> Reducer -> Store.

In and out type variant of Kotlin

文章介绍了Kotlin中泛型添加inout的意义.

实际上in作为参数表示的是consume方,可以将super type可以赋值给sub type.类似于Java里面的<? super X>,其作为泛型的Collection只能add数据,无法get访问内部成员.

out作为返回值表示producer,与in相反,它可以将sub type赋值给super type.类似于Java中的<? extends X>,其作为反省的Collection只能get访问,不能add数据.

Building a distributed MIDI Controller with Android Things and Nearby API #2

IoT的MIDI播放器第二篇,感兴趣的可以仔细看.

Meaningful Motion: Circular Reveal & Shared Elements

在Shared Element Transaction Animation的基础上加上了ViewAnimationUtils#createCircularReveal实现Reveal效果. 即Activity/Fragment跳转过程中Shared Element先移动再充满Container.

RxAndroid: Handle Interrupt With “switchMap”

通过switchMap将Happy与Unhappy的pass都加进来(Observer.merge)进行处理,switchMap与flatMap的区别是它内部只有一个active的observer,简单的来说,它不会对转换后的Observable进行merge,而是在新的来到的时候cancel之前的.

The curious case of haunting fragments

作者研究Fragment addToBackStack以及pop之间的事情,但是作者貌似没用对...

所以之后他居然推荐用Activity了,说Fragment太难用...

Unit testing protected lifecycle methods with Kotlin

作者写了个工具库,给Activity的生命周期方法都写了扩展,这样就可以直接通过对象调用了...可以用来写Activity的单元测试.

Kotlin Coding Conventions

Kotlin最新的code style,基本跟Java类似,但这里比较详细,包括什么时候换行,什么时候single line等等.

Lessons from my first multi-platform Kotlin project

作者对Kotlin Multiple Platform进行总结,首先platform层应该根据js/jvm/native进行划分,而不是操作系统,操作系统的划分应该属于之下的regular层,而最上层为common层.

MVP的应用非常重要,其次是下层可以访问上层的一切,上层需要访问下层应该通过expected与actual来实现.

Android Architecture Components LiveData with Data Binding

Google最新的Databinding已经支持LiveData了,通过与LiveData进行绑定,可以保证UI在后台的时候不会因为数据变化而刷新,避免了没有必要的操作.

Briefly about RxJava Logging

作者介绍了通过doOnEach (Flowable)以及doOnEvent(others)来了解Observable的状态,帮助你添加新的feature中debug遇到的问题,不至于整个Rx Chains出现问题而不知道问题处在哪里.

LIBRARIES & CODE

TableView

很项强大TableView,基于RecyclerView,用来显示复杂数据.有点类似数据库表格.

retrofit2-kotlin-coroutines-adapter

Jake Warthon写的支持Kotlin Coroutine的Retrofit2, 返回Deferred类型.

RxTest

像这个来测Rx的Observable,是不是很牛.

Observable.just("Hello RxTest!")
.test {
it shouldEmit "Hello RxTest!"
it should complete()
it shouldHave noErrors()
}

MockK

支持Koltin DSL的mock库, 叫mockk....

KotlinAndroidViewBindings

其实感觉跟ViewBinding没多大关系, 主要是实现了Delegate,可以取代findViewById,Butterknife以及Kotlin Android Extension.

直接通过by bindWithXX()来找到View.

litho-kotlin

Facebook litho的kotlin dsl support.

kotlin-math

支持很多vector计算的lib,帮助简化graphic math.

Android Weekly Notes Issue #290的更多相关文章

  1. Android Weekly Notes Issue #230

    Android Weekly Notes Issue #230 November 6th, 2016 Android Weekly Issue #230. Android Weekly笔记, 本期内容 ...

  2. Android Weekly Notes Issue #227

    Android Weekly Issue #227 October 16th, 2016 Android Weekly Issue #227. 本期内容包括: Google的Mobile Vision ...

  3. Android Weekly Notes Issue #237

    Android Weekly Issue #237 December 25th, 2016 Android Weekly Issue #237 这是本年的最后一篇issue, 感谢大家. 本期内容包括 ...

  4. Android Weekly Notes Issue #229

    Android Weekly Issue #229 October 30th, 2016 Android Weekly Issue #229 Android Weekly笔记, 本期内容包括: 性能库 ...

  5. Android Weekly Notes Issue #221

    Android Weekly Issue #221 September 4th, 2016 Android Weekly Issue #221 ARTICLES & TUTORIALS And ...

  6. Android Weekly Notes Issue #219

    Android Weekly Issue #219 August 21st, 2016 Android Weekly Issue #219 ARTICLES & TUTORIALS Andro ...

  7. Android Weekly Notes Issue #310 (Google IO特别篇)

    Android Weekly Issue #310 May 20th, 2018 Android Weekly Issue #290 本期既有本次Google IO对于Play Console的更新简 ...

  8. Android Weekly Notes Issue #236

    Android Weekly Issue #236 December 18th, 2016 Android Weekly Issue #236 本期内容包括: Google的物联网平台Android ...

  9. Android Weekly Notes Issue #235

    Android Weekly Issue #235 December 11th, 2016 Android Weekly Issue #235 本期内容包括: 开发一个自定义View并发布为开源库的完 ...

随机推荐

  1. 2017.2.15 开涛shiro教程-第二十一章-授予身份与切换身份(一) table、entity、service、dao

    原博客地址:http://jinnianshilongnian.iteye.com/blog/2018398 根据下载的pdf学习. 第二十一章 授予身份与切换身份(一) 1.使用场景 某个领导因为某 ...

  2. 2016.6.21 maven使用cmd新建项目时,failed to execute goal org.apache.maven.plugins:maven-archetye-plugin:2.4:generate...

    在学习maven的时候,想要新建一个maven工程,在命令行执行create或generate命令. 错误如图所示: failed to execute goal org.apache.maven.p ...

  3. 2016.6.21 maven:Failure to transfer ... from ....

    问题描述: 才刚新建的工程,什么都没做,就显示pom.xml有问题,在第一行的标签上 有如下错误: 点击详情: Failure to transfer org.apache.maven:maven-p ...

  4. 2016.7.14 如何在浏览器中查看jsp文件

    参考资料: http://jingyan.baidu.com/article/ed15cb1b10f1241be36981ab.html 1.复制jsp文件地址 2.写在浏览器里 E:/lyh/tas ...

  5. vue sync

    1.使用vue cli建立工程 2.在APP.vue中: <template> <div class="details"> <myComponent ...

  6. 撸代码--linux进程通信(基于共享内存)

    1.实现亲缘关系进程的通信,父写子读 思路分析:1)首先我们须要创建一个共享内存. 2)父子进程的创建要用到fork函数.fork函数创建后,两个进程分别独立的执行. 3)父进程完毕写的内容.同一时候 ...

  7. HTML5 Support In Visual Studio 2010

    最近HTML5浪潮已经开始了,VS2010已经有一个扩展支持在HTML5智能提示.你可以从这里下载这个扩展: http://visualstudiogallery.msdn.microsoft.com ...

  8. js的常用小技巧

    //类对象转成数组 var domNodes = Array.prototype.slice.call(document.getElementsByTagName("*"));   ...

  9. Android 进阶自定义 ViewGroup 自定义布局

    前言 在我们的实际应用中, 经常需要用到自定义控件,比如自定义圆形头像,自定义计步器等等.但有时我们不仅需要自定义控件,举个例子,FloatingActionButton 大家都很常用,所以大家也很经 ...

  10. smokeping插件使用及说明

    smokeping七大组件:general(普通设置) .alerts(警报设置).Datebase(数据库参数).presentation(网络自定义).slaves(从smokeping定义).t ...