Thursday, June 24, 2010

Tutorial - Determinate Horizontal Progressbar Theming

Sometimes it makes sense for Android apps to use horizontal progressbars to display quantitative data. The problem in using progressbars for this is that the colour is linked to the current theme of the ROM you are using. In generic Android this is a ghastly yellow and in the Desire ROM it is an even worse green colour. While it's not too bad if the progressbar is just being used as a progress bar, it isn't exactly desirable when using it to show data in your app. The good news is that you can manually theme the progressbar to suit your app and make it consistent between different ROMs.

This tutorial is relatively simple but it does assume you have a working Eclipse environment setup for Android development.

As we will be skinning a determinate horizontal progress bar, as apposed to the circular animated progress bar, ensure that the style of your progress bar is set as follows:
?android:attr/progressBarStyleHorizontal

When the Android OS displays a view it uses a default xml drawable file to determine what colours should be used when displaying. As we don't want to start skinning the bar from scratch, we'll take the default file and copy it into our projects drawable folder. The file we will need is found at:
<AndroidSDK Root Directory>\platforms\android-<version>\data\res\drawable


Now that we have our own copy of the progressbar's drawable file we want to set the progress drawable attribute of our progress bar to point to it. To do this select the target progressbar and scroll down to Progress Drawable in properties. In the values section type
@drawable/progress_horizontal, alternatively you can use the ... button in the Progress Drawable value field and browse for it.


Now that we have our progressbar pointing to our own drawable we can start to modify the XML. Open up the drawable XML file in Eclipse and you will see that it contains three main sections/ You can safetly ignore the background section as we are only interested in the secondaryProgress and progress sections.

You'll notice that each of these sections contains three colour values for creating gradients, startColor, centerColor and endColor. Each of these colour values are broken up into two parts, a two digit alpha value and a six digit RGB value.


An important thing to note is that the only difference between the startColor, centerColor and endColor of the progress section and the startColor, centerColor and endColor of the secondaryProgress section is the alpha values. This means that when we modify the RGB value of one value we must also copy it across to the corresponding value in the other section. Be careful not to accidentally copy over the alpha portion, it will throw off the 3D effect.

To begin customizing the theme we must first pick the desired colour. Fire up your favorite photo editing program and pick your desired colour on the colour picker. Now copy the corresponding RGB values into the CenterColor fields in both sections. Remember not to copy over the alpha values.

Next we want to lighten the colour a couple of shades and copy the RGB values into both endColor fields. Lighten the colour again, but this time copy the RGB values into the startColor fields. By using three different shades we are able to keep a consistent 3D look like that of the original progressbar.


There you have it, a custom themed progressbar. You may need to tweak the shading differences a few times to get the best results.

Wednesday, June 23, 2010

Rock Player - public beta

Just a quick heads up for those that are enjoying the leaked Rockbase player. A new public beta version is now available.

From my own personal testing the performance doesn't appear to have improved much, if at all, when compared to the leaked beta. Unfortunately the FPS meter is no longer available which leaves numerical comparison out. One thing I did notice was that H.264 format media I used for testing contained block artifacts which is in stark comparison to the leaked beta which had perfect picture quality.

Considering the performance is roughly the same and the visual quality appears to be better on the leaked version I wouldn't recommend upgrading at this stage. Though if you have specific issues with playback, it might be an idea to try out the new public beta to see if it has been fixed.

Another thing to note is that the public beta adds a non-removable water mark to videos top left corner and expires on July 15. The leaked beta doesn't contain this water mark although I'm not sure if it contains an expiry, I'd be surprised if it didn't.

You can get the public beta from here

Wednesday, June 16, 2010

Rock Player - DivX and MKV player

I've been on the lookout for a multi-format video player for a while now. Unfortunately the only thing that comes close to a multi-format media player is yxplayer which I've never managed to get working for any other formats than the Android defaults. Well that is until I stumbled across RockPlayer.


RockPlayer is a multi-format beta video player that is not only extremely stable but works surprisingly well. In all of my testing RockPlayer never forced closed even when it was brought to its knees by 720p content.

To test this app's capabilities I used 3 different resolution videos, ranging from your usual 350MB TV episode through to 720P content. The results were rather encouraging.

Container
ResolutionVideo FPSRendered FPS Image Quality Audio Quality
AVI640 x 368 30
29 - 30 Excellent
Excellent
AVI
1280 x 528 23
16 - 17 Excellent
Excellent
AVI
1280 x 720 26
5 - 6 Excellent
Stuttered

If you're looking for something to play HD content then this isn't going to be your silver bullet, well not at the moment anyway. Though for those of you who want to watch videos a little less daunting this may be just the thing you need. Keep in mind though that your mileage may vary on less powered phones.

It can be downloaded here

Full credit to Modaco website for bring this to my attention.


Saturday, June 12, 2010

Motorola Droid 2


I've always been a big fan of the Motorola Droid and Milestone. The screen is beautifully crips and clear, the keyboard while not very useful for my fat fingers is a god send for the Mrs. The main attraction for me, is it just feels solid. The cold weighty steel casing gives the impression of a phone that's been built with consideration and care. Infact if Motorola opened the bootloader for the milestone I'd sell my Nexus one and purchase one without a second thought. So it goes without saying when I heard about the Motorola Droid 2 my ears pricked up and I could feel that deep down excited feeling.



The hardware specs look pretty good, not extremely impressive, but still a considerable improvement over the original. A nice and welcomed bump in processor speed from 500 to 750 and a new keyboard are just what the doctor ordered.

  • Android 2.1
  • 3.7″ screen
  • 750MHz OMAP processor
  • Wi-Fi tethering
  • 8GB internal
  • 8GB SD card preinstalled
  • Updated keyboard
  • 5MP camera
  • New version of Motoblur

The obvious let down here is no Froyo but without a release date set it's really early days. I wouldn't be supprised if there was an update for Android 2.2 shortly after release. The other interesting thing here is no front facing camera and no HDMI port. Neither of those things are a deal breaker for me. I've never been really excited by video calls and a quick transfer to a computer or laptop is easy enough to warrant a HDMI port a little redundent.

Though out of all the improvements I have to say the new boot screen is the best improvement in my opinion.







Thursday, June 10, 2010

Google forced my hand

What happens when Google's Android Market doesn't quite work properly? I'm forced to annoy the poor online world with a blog containing my own Android Apps.

I also hope to drop a few tutorials here as well, although I'm not known for my consistency when it comes to things like this. The wonderful author of The Gourmet Challege is still waiting for me to finish an entry on the "Great Melbourne Raman Hunt". I'll finish it I swear!

The one thing that you will certainly find here is the most recent version of any of my Apps which at the moment total a massive one.