Saturday, September 3, 2011

Fixing UI font in Idea

Recently I switched my Linux OS from Ubuntu to Sabayon. And I've noticed the UI fonts of Idea (many java developers would agree IntelliJ Idea is the best IDE) are bad. Probably something related to anti-aliasing went wrong. The fix is easy, just add following line to your {idea-installation-directory}/bin/idea.vmoptions:
-Dawt.useSystemAAFontSettings=on

Thursday, July 21, 2011

Updating versionCode and versionNumber in Android manifest via Gradle

I'm working on Android project which has multiple builds for different customers.
Each build is organized as separate project and is build via Ant script. The problem is that building all those builds and updating versionCode and versionNumber is all manifest files takes a lot of time. So, I decided to use some tool to this for me. Yes, I'm a bit lazy :)
I've chosen Gradle. It leverages the power of Groovy and is able to call Ant scripts.
Groovy has great tools to work with XML, like XmlSlurper. So, updating versionCode and versionNumber in Android manifest files seemed easy. Unfortunately after significant amount of time all I got was ugly formatted Android manifest with tag0 namespaces :(
Then I put XmlSlurper aside and used String.replaceAll(Pattern pattern, String replacement) method. It took me about 5 minutes to do all replacements :)