Android Weekly Notes Issue #252

Android Weekly Issue #252

April 9th, 2017
Android Weekly Issue #252.
本期内容: 变化的渐变背景实现; Kotlin 1.1特性; Parcelable数据处理; RecyclerView动画实现; MVI模式的实现; 远程team的合作; 面向对象的原则: Law of Demeter; 用JUnit 5和Kotlin结合写测试.
(本期内容有点水, 不知道是我的状态不好还是Weekly的状态不好).

ARTICLES & TUTORIALS

Make a moving Gradient Background in Android

用AnimationList做一个不断改变的渐变色背景.

用根节点是<的drawable作为View的背景:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/gradient_blue"
android:duration="5000"/>
<item
android:drawable="@drawable/gradient_red"
android:duration="5000"/>
<item
android:drawable="@drawable/gradient_teal"
android:duration="5000"/>
<item
android:drawable="@drawable/gradient_purple"
android:duration="5000"/>
<item
android:drawable="@drawable/gradient_indigo"
android:duration="5000"/>
</animation-list>

其中的item是不同的渐变色drawable, 比如:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:endColor="#34e89e"
android:startColor="#0f3443" />
</shape>

在Java代码中获取, 然后start它即可:

LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear_layout);
AnimationDrawable animationDrawable = (AnimationDrawable) linearLayout.getBackground();
animationDrawable.setEnterFadeDuration(2500);
animationDrawable.setExitFadeDuration(5000);
animationDrawable.start();

另外, 作者推荐一个发现渐变色组合的网站: UiGradients.

Kotlin 1.1 is also for Android Developers

Kotlin 1.1带来的一些很酷的features.

Proper Parcelable Testing

作者写了一个继承Parcelable接口的类, 然后把它存在savedInstanceState的Bundle里, 本文是他使用时的一些小建议.

RecyclerView interaction with Animated Markers - Part 3

动画实现: 当滚动列表的时候, 对应的Marker在地图上突出显示.

My take on Model View Intent (MVI) — Part 1: State Renderer

作者很推荐MVI模式, 讲了自己的应用是如何实现这种模式的.

简要说了用Espresso对本程序进行自动化UI测试的方法.

Effective Remote Teams

remote team如何工作.

Object Oriented Tricks: #2 Law of Demeter

面向对象编程Tricks系列之2: Law of Demeter, 德米特法则.

每一个单元应该尽量少地知道其他单元的业务, 仅知道和自己紧密联系的单元业务. Tell Don't Ask.

JUnit 5: Kotlin

如何结合Kotlin和JUnit 5来写测试.

LIBRARIES & CODE

spruce-android

一个轻量级的动画库.

Traceur

一个RxJava2的debug工具, 可以打出异步调用的最初崩溃信息.

scratch

清除用户数据然后重启应用.

what_the_thing

拿着相机对着东西, 然后学习如何用不同的语言来说它们的一个app, 用React Native实现.

posted @   圣骑士wind  阅读(307)  评论(0编辑  收藏  举报
编辑推荐:
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2013-04-13 JUnit4:多组数据的单元测试:用JUnit4做参数化测试
2013-04-13 JUnit4:Test注解的两个属性:expected和timeout
2013-04-13 JUnit4基础 使用JUnit4进行单元测试
点击右上角即可分享
微信分享提示