The Great Android Test 2012

It sounds like some sort of desperate attempt to gain geek credibility, but I’ve been using smartphones and PDA’s for years. My desire to have my very own tricorder took me through the joys of an HP Jornada, a Compaq iPaq, a Dell Axim, a Palm Treo, and a couple of HTC Windows Mobile 5 and 6 based devices. I held out against the iPhone incursion for as long as I could, until I succumbed to the siren song of the 3GS.

The funny thing is that, for someone who changed device every 6 or 12 months, I’ve now had the same 3GS for nearly 3 and a half years. The combination of solid hardware and an active ecosystem meant that, despite the temptation of a higher res screen, I’ve not really seen the point in upgrading. Buying an iPad probably helped as well.

Anyway, the 3GS is getting slower and slower, and the battery has suffered from about 1500 charge cycles, so it’s time for a replacement. And being a gadget whore, I thought I’d check out the competition before lazily falling back into bed with another iDevice.

First up was the HTC One X. I’d loved my previous WinMo HTC devices, and I’d heard about the lovely screen on the One X, so I was excited. When I got it, however, I took an immediate and not entirely rational dislike to it. The hardware is solid and the screen is wonderful, but there were very quickly some minor annoyances. The power connector is at the side instead of the bottom, making charging while in a case a challenge. There’s no physical ‘home’ button, and the power button is way up at the top, making it hard to reach on such a big phone – so even turning the thing on and off was a little bit annoying. The major issue, though, was the software, although weirdly I couldn’t pin down exactly what it was that I didn’t like. It was like looking at Mickey Rourke 20 years ago and now, and trying to work out exactly what had gone wrong; it just felt lumpy and misshapen.

So, that went back and along came the legally contentious Galaxy S3. This was a very different experience – slick, smooth, well thought out. Some people complain that it’s too plasticky but, coming from a 3GS, that isn’t something I noticed particularly. There’s a physical home button, the power button and power connectors are in sensible places, and the screen, like the One X, is wonderful. And though there are alot of complaints about Touchwiz, the software seemed much more polished to me, even if there are a fair number of Samsung specific apps I have no intention of ever touching.

Widgets and screens
Things I absolutely love about the S3, and indeed the wider Android experience, are:

  • That huge screen. Going back to my 3GS is difficult. There’s a chance it might be slightly too big, but so far I haven’t tired of it (although my right pinky is getting a little sore from anchoring the bottom while doing big stretches).
  • Widgets. I love being able to grab information at a glance, and Android widgets are fabulous for that – on opening my phone I can check out the weather, the stock market and my agenda for the week, without touching a single app icon.
  • Differentiating between apps on your phone and shortcuts to launch them. On iOS the apps and their launch icons are one and the same thing, leading you to stuff apps you don’t use very often into poorly named folders. On Android you have a special ‘apps’ manager where all your apps really exist, leaving you free to keep your main screens uncluttered.
  • Proper background multitasking. Not quite as useful as I thought it might be, but as someone who uses a newsreader all the time, it’s good to know that it’s always going to be up to date.
  • Not having to pay an absurd amount of money to get an extra 16gb of storage. £70 to go from 16gb to 32gb is one of those examples of Apple hubris that never gets old.

Unsurprisingly, after 3.5 years of iPhoning, I have one or two gripes:

Useful notifications on the lock screen.
I like to pin-protect my phone, and as I mentioned above I’m a sucker for seeing lots of useful information with as little effort as possible. iOS has a killer feature for me here – all new emails, texts and missed calls are shown on front screen as soon as you touch the on button.

Here’s an example:

The sort of information I want to see on a lock screen.

On Android by default, the best you get is an icon telling you how many missed emails you have. There’s the pull-down notification bar (which Apple shamefully ripped off in iOS 5) which shows alot more info, but that groups emails together, once again leaving me with the certain knowledge that I have some emails, but no information on what they are.

After hours of looking around there’s an app called Executive Assistant that seems to do most of what I want, but there are still problems. Most annoyingly, because Google locks down the email database from third party apps, EA has to fetch emails itself, which both messy and a waste of battery. It also doesn’t clear the list of new emails automatically on unlock, so you have to clean it out manually.

No decent email client
I was enormously surprised by this, given Google’s background, but the stock email apps in Android seem a little… sucky. Yes there’s the GMail app, but I’ve personally never particularly liked the GMail interface, and like many people I have other email accounts. There’s the stock email app, which is okay but does threaded conversation views rather clumsily. On the app store, K9 is a nice free alternative, but that doesn’t do threaded conversations at all. Ultimately Maildroid looks like the best option – good email threading, fast delivery, nice interface.

However, none of them do as good a job as the stock iOS mail of squeezing emails into a small screen space. If you get emails with lots of embedded pictures (Amazon being the email nemesis in this regard), iOS does its best to ensure you never have to scroll horizontally. All of the Android apps behave as though you’re at your desktop, looking at things through a very narrow web browser. Here’s an example of what I mean.

Minor things
There are a couple of other niggles too:

  • Scrolling up and down is still jerky. On my old, slow 3GS scrolling is still, always, silky smooth. In Android it’s lumpy, despite the hardware being 10x as fast and having 10x as much ram. I hope that Jelly Bean’s slightly tardy and unfortunately named ‘project butter’ will fix that.
  • Lack of consistency. The S3 comes with quite a few stock apps. In addition, once you’ve downloaded a new email client, a new browser, tried to fudge the notification experience into something a little more helpful, etc, the core, day-to-day phone experience feels inconsistent. That’s probably partly my fault for having trying to contort the OS into my pre-existing usage patterns, but all the same, it makes things feel unpolished.
  • Minor app gaps. I miss Toodledo. I miss Alienblue (BaconReader isn’t quite as friendly).
  • Backups. With iOS I know that, should I lose my phone, everything has been backed up to the cloud, and I can remotely wipe the original phone. It could be my unfamiliarity with Android here, but I have absolutely no idea whether or not things are backed up and, even if they are, if that backup is going to be global to all Android phones or specific to Samsung. I also can’t tell if I can wipe it or not.
  • I have a 3GS that’s nearly 3.5 years old and it’s running the latest version of iOS. Jellybean came out 3 months ago and, while there’s a rumour it’s coming to the S3 any moment, nobody really knows. Apple knows how to make me feel that my phone will last.

Conclusion
My conclusion, at the moment, is slightly inconclusive. Android is clearly a very capable platform and, once you’ve seen the S3 screen and experienced the joy of live widgets, iOS seems like a very dull place. At the same time, some very core parts of my phone experience are lacking on Android – lock screen notifications and a nicely integrated email client being the being main ones. At the moment I’m inclined to fall back to what I’m more familiar with, but that doesn’t seem as much fun…

Emacs and Unity Every Day

As I may have mentioned before, I like using Emacs. When working on Fable we were of course entirely based around the glorious Visual Studio, since the XBox and the 360 required it, and I started out using Emacs largely for editing Python and Lua code; we used those languages for various tools and scripting duties and Visual Studio at the time didn’t have very good support for ‘other’ languages. Gradually I drifted into using org-mode, then into eshell, and eventually I got to the point where I started missing certain features in other editors. Yes, even the glorious Visual Studio.

These days I’m working on a Mac, using Unity. I tried to use MonoDevelop but found it to be slow and clunky, and not being able to view two files at the same time was very frustrating. Eventually I switched entirely over to using Emacs. It wasn’t easy at first, and I still lament the lack of a decent autocompletion system, but in general I’m very happy with the workflow.

You don’t spend numerous years using Emacs without picking up a few customisations and I thought it would be worth documenting a few of the ones I use most often. If anyone finds it useful, I might dip further into the recesses of my dotemacs file.

So, here we go; Emacs things that I use every day.

Evil mode
evil-mode is a fabulous vi emulation layer in Emacs. I’m pretty new to it, and I originally turned to it in a last ditch attempt to cope with some RSI issues I’d been developing (at this point I have probably bought pretty much every ergonomic keyboard in existence). I’m not sure if it helps the RSI, but it has certainly helped my coding speed. A side benefit is that, while Emacs is incredibly flexible, it’s very easy to run out of keybindings for all your custom functionality. Evil-mode and it’s modal system largely makes that problem go away.

Ace jump
Inspired, I believe, by a vim plugin called from Easy Motion, ace-jump allows you to jump to any character on screen in (usually) 3 keypresses. It’s a little difficult to explain how, so I’ll skip straight to a demo of it in action. I hit space (my personal activation key in evil-mode), select a character to jump to (in this case ‘p’). Ace-jump highlights every ‘p’ there is and gives it a unique letter. I choose the one I want (in this case ‘n’) the character jumps to the correct location.
acejump_anim2

In that particular example, I’m jumping to any character on the screen which can create alot of hits, but there are other ways to call it which only highlight characters at the beginning of words.

It’s looks a bit mental at first, but once you’ve used it there’s no going back.

Mark Multiple
Another toughie to describe in text, mark-multiple allows you to select a section of text and then select further matching sections and edit them all simultaneously. If you’ve ever used Sublime Text you’ll be familiar with it. Here’s an example:

mm_anim2

Here I hit v to select the terminating semi-colon, M-j to select further semicolons below, c to change the selection, and then type in the new code. There are other ways to achieve the same thing, of course, but mark-multiple is nice and tactile.

Helm

This used to be called ‘Anything’, and it’s essentially a generic quick jump system for Emacs, and it’s easily extended. For example, I have a simple custom project management system to allow me to easily compile projects, select which files go into a tags file, etc, and I use Helm to select files anywhere in my project, regardless of whether or not they are already open. Again, a simple example should suffice:

helm_anim2

In this I hit C-x f to trigger the helm file finder, and type in part of the file I’m looking for. It shows files in my project, recently accessed files, open buffers; once I’ve narrowed down the selection enough I can then select using the cursor keys and hit enter to select the file.

Yasnippet
Alot of coding is repetitive stuff, and TextMate’s ‘snippets’ innovation was a great way of tackling some of the more tedious bits. The canonical Emacs implementation yasnippet expands on that, allowing you to create some very sophisticated code templates. Previously I’ve struggled to get it in my workflow – remembering the exact trigger phrase for an expansion never worked for me, and autocompletion often got in the way. I’ve recently discovered that you can trigger a snippet manually, however, and then use fuzzy-matching via ido to choose the right snippet. Example below:

yasnippet_anim2

In this example I’m hitting C-c s to trigger yasnippet, typing ‘fore’ to find the foreach expansion and hitting enter – it creates the skeleton and then I tab through the editable sections, filling them in as I go, with the last tab placing me in the braces. When you’re spending all day writing classes with conditions and loops and methods, this can be a big time saver.

Flymake
Something you may have noticed in one or two of the examples above is that I get syntax errors highlighted on the fly. This is the magic of flymake, which continually compiles the project in the background. I’ve got it hooked up with and a script to compile the Unity project, and it makes for a very smooth Unity coding experience. Errors underline in red as you type, the error message shows up in the minibuffer when you move the cursor into position, and it disappears when you fix it. Hardly revolutionary, but a nice productivity boost. It also seems to catch more genuine issues than the ‘on-the-fly’ error checker built into MonoDevelop, which is nice.

Shaderlab mode
Shaderlab-mode is a custom mode for editing shaders for Unity. It’s relatively basic, but it handles syntax colouring and indentation, which is all I really care about.

Wrapping it up
The upshot of this is that I spend 90% of my day in Emacs – from the start of the day when I check my todo.org list of tasks, to the edit-compile cycle for csharp, to editing shaders; I rarely leave Emacs, and when I do it’s usually just to tab on over to Unity to test out my changes.

I believe all of these extensions are available via ELPA, in marmalade or milkbox. Regardless, pulling it all together can take a little time, so I thought it might be worth sharing the details of how that’s done in my config. I’ve cobbled alot of this from various places on the intermawebs, notably http://dnquark.com/blog/2012/02/emacs-evil-ecumenicalism” title=”here”>here and here.


(require 'evil)

;;This gives you all the normal Emacs editing commands when in insert-mode
;;This eases the transition somewhat.
(setcdr evil-insert-state-map nil)
(define-key evil-insert-state-map
(read-kbd-macro evil-toggle-key) ‘evil-emacs-state)

(define-key evil-insert-state-map [escape] ‘evil-normal-state)

;;Not sure why, but semicolon started misbehaving for me when in insert mode.
(define-key evil-insert-state-map (kbd “;”) ‘self-insert-command)

;;Make evil-mode up/down operate in screen lines instead of logical lines
(define-key evil-normal-state-map (kbd “j”) ‘evil-next-visual-line)
(define-key evil-normal-state-map (kbd “k”) ‘evil-previous-visual-line)

;;Exit insert mode by pressing j and then k quickly
(setq key-chord-two-keys-delay 0.2)
(key-chord-define evil-insert-state-map “jk” ‘evil-normal-state)
(key-chord-mode 1)

;;If you work in camelCase or use underscored_names, this is very helpful
(evil-define-motion evil-little-word (count)
:type exclusive
(let ((case-fold-search nil))
(forward-char)
(search-forward-regexp “[_A-Z]\\|\\W” nil t)
(backward-char)))

(evil-define-motion evil-little-word-backward (count)
:type exclusive
(let ((case-fold-search nil))
(backward-char)
(search-backward-regexp “[_A-Z]\\|\\W” nil t)))

(define-key evil-normal-state-map (kbd “, b”) ‘evil-little-word-backward)
(define-key evil-normal-state-map (kbd “, w”) ‘evil-little-word)
(define-key evil-operator-state-map (kbd “, w”) ‘evil-little-word)
(define-key evil-operator-state-map (kbd “, b”) ‘evil-little-word-backward)

;;Not sure why this isn’t the default – it is in vim – but this makes C-u to go up half a page
(define-key evil-normal-state-map (kbd “C-u”) ‘evil-scroll-up)

;;Allow quick manual triggering of snippets
(define-key evil-normal-state-map (kbd “C-c s”) ‘yas-insert-snippet)
(define-key evil-insert-state-map (kbd “C-c s”) ‘yas-insert-snippet)

;;Toggle comments
(define-key evil-visual-state-map (kbd “, c”) ‘whole-line-or-region-comment-dwim)
(define-key evil-normal-state-map (kbd “, c”) ‘whole-line-or-region-comment-dwim)

;;Easy access to the mark multiple library when in visual-mode
(define-key evil-visual-state-map (kbd “M-j”) ‘mark-next-like-this)
(define-key evil-visual-state-map (kbd “M-k”) ‘mark-previous-like-this)

;;Ace jump stuff. Honestly, I just use Space 99% of the time
(define-key evil-normal-state-map (kbd “SPC”) ‘ace-jump-char-mode)
(define-key evil-normal-state-map (kbd “, , w”) ‘ace-jump-word-mode)
(define-key evil-normal-state-map (kbd “, , c”) ‘ace-jump-char-mode)
(define-key evil-normal-state-map (kbd “, , l”) ‘ace-jump-line-mode)

(define-key evil-operator-state-map (kbd “, , c”) ‘ace-jump-char-mode)
(define-key evil-operator-state-map (kbd “, , l”) ‘ace-jump-line-mode)

;;Personally I like ace-jump to be limited to the window I’m working in
(setq ace-jump-mode-scope ‘window)

;; Remap org-mode meta keys for convenience
(mapcar (lambda (state)
(evil-declare-key state org-mode-map
(kbd “M-l”) ‘org-metaright
(kbd “M-h”) ‘org-metaleft
(kbd “M-k”) ‘org-metaup
(kbd “M-j”) ‘org-metadown
(kbd “M-L”) ‘org-shiftmetaright
(kbd “M-H”) ‘org-shiftmetaleft
(kbd “M-K”) ‘org-shiftmetaup
(kbd “M-J”) ‘org-shiftmetadown))
‘(normal insert))

(evil-mode)

Most of that should be self explanatory with the comments. One thing to mention is that this makes use of the excellent keychord.el and comment-dwim both also available via ELPA repository. Keychord allows you to combine arbitrary keypresses into triggers, and it’s what allows the ‘jk’ trick above. There’s lots of other stuff I use too – org, nav, bm, window-number, winner – and lots of personal customisations, but I’ll leave those for another day.

The main thing I really miss is proper ‘correct’ autocompletion for C#, which Visual Studio spoiled me with for years. Someone has created a plugin for Sublime, called CompleteSharp, which uses a standalone commandline program to load up your assemblies and provide completion information, and I’m sorely tempted to write some Emacs hooks for it. If only I had the time…