Hello, Hugo
Medium has gone downhill sharply since I first published some blogs on their platform 5 years ago. It’s been irritating to me as a reader of other blogs to be pushed to login or subscribe or whatever, and I don’t want my content used like that.
So, I’ve finally sorted out my own blog - using Hugo & GitHub Pages.
Farewell, Medium.
Android modularisation survey 2019 - the results!
A couple of weeks ago, I tweeted a survey to find out more about how Android developers were modularising their apps. It’s a broad and complicated topic, with no clear standard approach or conventions to follow, so I was interested to learn more.
Do you work on an android app that's split up into modules? If so, it would great if you could spend a few mins filling out this survey, gathering data on your approach - I'll publish the results so everyone in Android community can benefit!
Tracking Android app metrics
When I joined Monzo I was keen to keep a track of metrics that would help us keep a handle on the app’s size and method count. I set up a shell script on our CI to upload the numbers to StatHat each time we merged a change to our develop branch. This was great in theory, but not visible enough to be actually useful - in fact, one of the stats stopped uploading properly some months ago and we didn’t even notice.
Mysterious Kotlin 'parameter non-null exception'
This week I found myself confused by an exception when writing a simple extension method on Android’s TextView.
Consider the following extension method:
fun TextView.doSomething() { } This is about as simple as it could get - it has no parameters and returns nothing. However, when I tried to use it, I found myself with the following exception:
Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter $receiver
But that’s weird - it looks like there’s a parameter called $receiver which is null… Except, I don’t have a parameter at all!
Creating a Custom Type Adapter for Moshi
In building an app which guides a user through a process, stage by stage, we would probably use an enum to represent it.
For example, consider a process which goes from NOT_STARTED, through IN_PROGRESS to one of either REJECTED or COMPLETED:
The logic for moving between these stages is transparent to the app, we show different screens based on which stage a user is in.
But what if the mapping of stages isn’t 1:1 on the client and the server?
Dynamically changing SVG colours on Android
Recently, I needed to change the colour of part of a drawable - and I wanted to do it better than manually swapping out the whole image, or swapping in and out the changing part and overlaying this on top of a base image.
I knew I wanted the assets to be vector based if at all possible - SVG support was added in Lollipop with the VectorDrawable class and have been a great addition.
Death to Ugly Android Screenshots
Clean Status Bar is an app I created in September 2014 to try and make taking nice screenshots for the Google Play Store easy and fast. Ugly screenshots are a distraction from the app you’re trying to show off, and have become somewhat of a pet peeve of mine. When I’m looking at an app on the Play Store and wondering whether it’s worth downloading or not, the first thing I look at is the screenshots.