Chris Banes

Android Software Engineer with a love of writing user interfaces

Dark Theme, AppCompat

DayNight — Adding a dark theme to your app

This post has been updated multiple time since first publishing. The content is correct as-of March 13th 2019. The DayNight functionality in AppCompat allows your app to easily switch between a dark ⚫ and light ⚪ theme. This has many benefits for your users, especially if you have a content-heavy app (such as a Reddit client). How do I use it? You need to change your theme to extend from one of the DayNight variants, and then call one method to enable the feature. Here’s an example theme decla
AppCompat, Vector Drawable

AppCompat v23.2 — Age of the vectors

As you may have seen on the Support Lib 23.2.0 blog post, we now have compatible vector drawable implementations in the support libraries: VectorDrawableCompat and Animated VectorDrawableCompat. Those are implemented as standalone pieces of functionality. As we know that developers want to use them from resources, we’ve added support for vector drawables directly into AppCompat. There are various reasons for this integration, including: * Allows developers to easily use <vector> drawables on

Support Libraries v22.1.0

It’s been a while since my last post so here we are. You may have seen that the 22.1.0 support libraries were released yesterday, which is probably the biggest non-platform release we’ve done with the support library. Before we go any further, have a read of Ian’s official release blog post [] . It outlines all of the new features in this release, for all of the libraries. In this post I will concentrate more on t
Android Themes, View styles

Theme vs Style

Android 5.0 Lollipop brings with it new functionality which allows you to specify an override theme for a View (and any descendents). Let’s have a look at how and why you would use it. Why? You’ve probably already been using this functionality for a while without knowing: Theme.Holo.Light.DarkActionBar. Think about the Light.DarkActionBar theme for a second. It’s a light theme for your content (background is light and the foreground is dark), but the action bar use a dark theme (dark backgroun
Palette, Color extraction

Palette v21

Tried the Android Lollipop SDK? You may have noticed that Palette’s API has been updated. As before, Palette allows you to extract colors from images for use in your UI. Generating a palette The first step is to generate a Palette instance from a Bitmap. We have four related ways to do this: // Synchronous methods. // -------------------------------- // These should be used when you have access to the underlying image loading thread. // Picasso allows this through a Transformation. For other l
AppCompat, Material Design

appcompat v21: material design for pre-Lollipop devices!

The Android 5.0 SDK was released today and among the many tasty updates, includes new UI widgets and theming abilities to create material design style apps.  To enable you to bring your updated designs to older platforms, we have also updated the support libraries including AppCompat. In this post I’ll outline what’s new in AppCompat and how you can use it in your app. AppCompat (aka ActionBarCompat) started out as a backport of the Android 4.0 ActionBar [


Here’s something Roman Nurik and I wrote to help with dealing with Android System UI visibility across the different API levels. It allows you to provide a level specifying how the System UI’s visibility should be changed: LEVEL_LOW_PROFILE, LEVEL_HIDE_STATUS_BAR, LEVEL_LEAN_BACK or LEVEL_IMMERSIVE. Each one is pretty self explanatory. To use the helper: SystemUiHelper helper = new SystemUiHelper( activity, LEVEL_LEAN_BACK, // Choose from one of the levels additionalFlags); //
Palette, Color extraction

Palette preview

Tried the Android L preview SDK? You may have noticed a new support library called Palette. Palette allows you to extract colors from images for use in your UI (sound familiar?). Anyway I have made a mistake and not pushed any javadoc for it. So here is my quick overview until we push something official. Please be aware though that Palette’s API is changing for the full L release (not much though). Generating a palette The first step is to generate a Palette instance from a Bitmap. We have f

Philm is now open source

If you haven’t seen Philm yet, it is a movie collection and information app that I created for Android. It uses the Trakt and TMDB APIs. This morning I pushed the source of Philm to GitHub [] under the Apache v2.0 licence. This does not mean that I have stopped development, it’s just got to the point where I’m happy with it so can share the source. Philm has been a bit of an experiment as it uses a type of MVC-type architecture to split out UI, business and