November 25, 2012

DroidAlone - reloaded

Whenever I speak with another android developer, the occasional chat goes to "what did you develop?" question.
Last time it happened at droidcon uk, and for the first time I felt something wasn't completely right when I showed my DroidAlone app.

DroidAlone is a useful app (so they say) that comes into play whenever you forget your phone at home. With a simple sms protected by a password choosen by the user, it can be activated. From that moment, it will start notifying you of any missed calls and sms. It also ships a lot of other nice features, such as phone location retrieval and auto reply via sms (if you want to inform the caller that he can reach you to another number).
The full description of DroidAlone can be found at Missed Calls for Android .

Everything seems to work well, it has a lot of good reviews and the few users are happy.
Except one thing. It looks (looked) like this:

It also had another view with the list of events. The other developer's reaction was "ugh". And then I realized that I can't keep producing new stuff ignoring what I have around, especially if this is the case of the only app I manage to sell a bit.

So, when I got home I decided to change the ui "just to make it more pleasant".  Then I opened the code, and I realized that my two year's old code needed a bit more than a refresh.

Here what was wrong:

  • it used tabactivity, which is very old fashioned. I decided to add the actionbar.
  • from the event list view, you had to click on the item to see the details of the event. The details where shown into a dialog. Ugh (again). In the new version I wanted all the details to be visible since they are not so long.
  • All the properties of the views in the layouts where explicit. No styles anywhere. The color resources where "background_color", or "title_color" instead of some name that remind you the color. I had to put a heavy hand on that.
  • I tried to use gridlayout a lot since it seem to be the more efficient way to dispose a layout.
  • There was no empty list information.
  • A lot of calls where deprecated. I switched to the most modern versions.
  • All the data was contained in a sqllite storage without using a content provider. I switched to using a content provider and a cursorloader, which ended up in a more compact code. I didn't need anymore to use a broadcast to notify the ui that the data was changed.
  • DroidAlone uses broadcast receivers to be notified of incoming calls / sms. Even tough the sms receiver must be enabled because an activation sms can be received at anytime, the call receiver is needed only when the app is active. I then used the package manager to disable it when not needed.
  • I wanted to refactor a lot of code. A lot of brackets where on the new line instead of the same line of the method (a la C), and it bothered me a lot. I also trusted lint and changed a lot here and there. 

Other than these things, I redraw (by my self) a lot of the assets using inkscape. Because I soon got bored to export the resources in 4 different resolutions folders, I wrote a simple python script to do that for me. You can find it here .

More than that, I got REALLY REALLY bored while writing the content provider, so I ended up writing another python script to automatically generate the content provider for me, as described in my previous post. You can find the android content provider generator here

Finally, I switched the project to maven because I am getting used to that solution, especially in case I want to add robolectric tests and keep working with intellij.

The new version of the app hasn't been released yet (I want to have it running for a while on my phone before releasing it, just to be sure that I didn't break anything).

This is how the new version will look like 

So, this is how a "little ui polishing" ended lasting more than two weeks (of my spare time). I am also glad that I think my old code is not that good. I like to think that I am better than two years ago.

comments powered by Disqus