Fixing Line Editing on Android 8.0+

Recently I’ve been working on a toy that launches an REPL in adb shell, which would be more comfortable to use if it has the line editing functionality similar to bash. After some research, I found that actually there are a number of line editing libraries available, so it should be a nice and easy addition. However, after some integration work, I was surprised to find that all these libraries (e.g. jline3, linenoise (which was also once imported into AOSP)) only worked on older versions of Android, that is, until Android 8.0.

继续阅读


为 Android 项目使用 Travis CI 并发布持续集成版本

前言

Travis CI 是 GitHub 上开源项目采用持续集成的常见选择。为了给豆芽提供持续集成版本用于公开测试,我配置了 Travis CI,并自己编写了脚本将构建结果发布到另一个空项目的 Release 中,并将其间的过程和遇到的问题记录于此。

Travis CI 构建 Android 项目的时间较长,因此调试配置时十分耗时。希望我的经验能对他人有所帮助。

继续阅读


Thoughts on Content Handling in Android Application

Introduction

For content-oriented Android application, how and where to store the content to display is a issue every developer will be concerned with. The Android framework provided a comprehensive solution with ContentProvider (and a lot more) which suits quite well with a SQLite database; but in a lot of other scenarios, the app only need to have some information cached, while the majority of content is directly retrieved from network, thus eliminating the need for a database (and a complicated content scheme).

But when we look into the core of this issue, we will soon find out that it is in fact a problem of whether to have a central storage, and how to notify different components about a change.

继续阅读



LinearLayout 的拖放操作和动画

前言

Android 中ListView的拖放操作和动画实现已经被这个 DevByte相关的样例说明,并且也有 ListViewAnimations 这样强大的开源库进行了集成。但是,一番 Google 后,我发现基于LinearLayout的相关实现却不多。

然而,有时我们可能需要使用LinearLayout替代ListView来实现列表,例如不需要ListView的视图回收机制(比如使用Fragment作为列表项),或者我们需要把这个视图放在ScrollView中。

在使用LinearLayout实现拖放和动画时,实现代码相比于之前提到的ListView实现也需要一些变动。因为我在网络上没有找到相应的资料,所以写下这篇文章来记录这个过程。

继续阅读


Android 设计简明教程

零、前言

这是我作为一名 Android 开发者对 Android 设计的理解。在这个教程中,我主要参考官方的设计教程,同时会加入一些自己的见解,并穿插一些实用资源。其中 NovaDNG 的几篇文章对我影响较大,对此十分感谢。

在今年,Google 已经推出了新的 Material 设计规范,对真实世界进行抽象的模拟,实现了在各个平台上的统一设计标准。我对这个标准的理念认同,然而在布局等细节上有些许分歧。诸位可以学习完 Android 设计后继续学习 Material 设计,作出自己的判断。本文写作于 2014 年,而今 Material Design 已趋于成熟并且被广泛应用,因此推荐读者转而阅读 Material Design 设计规范。

继续阅读