Posts Tagged ‘sdk’

h1

WorkItOut 1.4 Update Coming Soon

August 3, 2009

Apologies to everyone for being so late on this update. Hoping to get it out by Friday.

This update will include Android 1.5 SDK support.

Bug fixes/features include…

More exercises (including cardio!)
No more black bar when you scroll a list
No more on-screen number pad
Ability to sort workouts by date
Ability to change the exercise date

Still working on….

Exercises in workouts being out of sync.
Empty workouts causing a force close
Clearing text field when it comes into focus

If there are any bugs I have missed, please let me know.

h1

Orientation

March 31, 2009

Originally I had hoped that users would not want to deal with the keyboard when in the gym, so I came up with a simple number pad to enter the workout data.  If the user wanted to open the keyboard the proportion of the screen made it so that the number pad was unreachable.  First fatal mistake – since the save button was on the number pad.  Anyway….WorkItOut 1.1 fixed that.

The goal in 1.1 was to show the number pad in portrait mode and hide the number pad in landscape mode when the keyboard slides out.

Here are the steps to achieve this:

1)  Go to the AndroidManifest

For the activity add android:configChanges=”keyboardHidden|orientation”

This allows the application to handle orientation changes and makes it so the app does not restart the activity on an orientation change.  I use it for the charts also so that the app doesn’t have to ping the Google Charts site every time you change screen orientation.

2)  Use onConfigurationChanged(Configuration change)

So now that the app is controlling the configuration changes, you have to set the behavior.  I just use an if statement with change.orientation == Configuration.ORIENTATION_LANDSCAPE

If it’s landscape hide the numpad, otherwise display it.

3)  Use getWindowManager().getDefaultDisplay().getMetrics(dm)

onConfigurationChanged only comes into play when you switch from one view to another within the activity.  But what if you enter the activity in landscape mode.  For that I used the WindowManager to get the screen dimension.  If dm.heightpixels==320 then I know I am in landscape mode.

So these steps cover all the bases for sliding the keyboard open or closing it.  Obviously there is more complexity if you want to use the accelerometer to determine which orientation the screen is currently in.

h1

Google Charts Available End of March

March 17, 2009

Many users have asked for the ability to chart progress.  Luckily for the Google phone (and any web-enabled phone), we have the Google Charts API which magically much easier to use than I expected.  The tricky part was the data scaling especially since we are working with dates.  For example,  I worked out consistently for a couple of weeks and then skipped a month, I wouldn’t want the data to be displayed in equal intervals.  So how do you take dates and figure out the relative distance between them?  In this case I just converted everything to milliseconds which is pretty standard.  Although at first I tried to come up with my own way to convert dates to a number format which obviously didn’t end up working.  I have posted a link below and the chart.  Notice how the url contains all the information needed to create the chart, pretty nifty and its fast too!

Here’s a sample

http://chart.apis.google.com/chart?cht=lxy&chd=t:1231833600000,1234512000000,1236927600000|10,13,14|1231833600000,1234512000000,1236927600000|11,14,15|1231833600000,1234512000000,1236927600000|12,15,16&chtt=Pullup&chdl=Set1|Set2|Set3&chxr=0,1231833600000,1236927600000|1,10,16,1&chds=1231833600000,1236927600000,10,16,1231833600000,1236927600000,10,16,1231833600000,1236927600000,10,16&chco=FF0000,00FF00,0000FF&chxt=x,y&chxl=0:|1-13-2009|2-13-2009|3-13-2009&chxp=0,1231833600000,1234512000000,1236927600000&chs=480×320&chxtc=1,-1236927600000

workitout-google-chart