Chris Banes

I work as an engineer in the Android Developer Relations team. This is my personal blog and any views expressed here are mine, and mine alone.

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
Chris Banes
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 [https://developer.android.com/referenc
Chris Banes
SystemUI

SystemUiHelper

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); //
Chris Banes
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
Chris Banes
Philm

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 [https://github.com/chrisbanes/philm] 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
Chris Banes
Text, Android Views

Measuring Text

If you start manually drawing things to Android’s Canvas [https://developer.android.com/reference/android/graphics/Canvas.html], you will probably start to draw text as well. When doing so you need to know where to position the text when you draw, and to do that you will need to measure the text before drawing it, to compute the starting x/y values. -------------------------------------------------------------------------------- In an app recently I needed to draw some text centered both ver
Chris Banes
Color extraction

Colour Matching - Part 2

This post is the second part in a two part series. You can find the first post here [http://chris.banes.me/2014/02/18/colour-matching/]. -------------------------------------------------------------------------------- Carrying on from the previous post, we now have the palette of colours which make up our chosen image. The palette can be retrieved by calling getQuantizedColors() on our MedianCutQuantizer. We could just sort this array based on the count and job done, use the colours in desc
Chris Banes
Website

New blog... again

Just a quick post. You may have noticed that this site has changed yet again. After my Color Matching [http://chris.banes.me/2014/02/18/colour-matching/] post last week, I saw quite a few comments saying that the site was slow. The site was WordPress based with all of the standard optimizations: W3 Total Cache [http://wordpress.org/plugins/w3-total-cache/] for static caching and then CloudFlare [http://www.cloudflare.com] for it’s CDN goodness. Even though it had these, the site was still pai
Chris Banes
Color extraction

Colour Matching

Android 4.4 introduced more subtle use of colour throughout the OS and provided new guidance on using colour [http://developer.android.com/design/style/branding.html#color] in your applications to provide better branding (see this episode [http://www.youtube.com/watch?v=6QHkv-bSlds&list=PLWz5rJ2EKKc8j2B95zGMb8muZvrIy-wcF&feature=share&index=3&t=3m25s] of ADiA for more discussion). This means that the onus is now on you as a designer/developer to inject some colour into your app to make it stand
Chris Banes