The Chronicle of an Android Developer Apprentice (4 or 7)

Hm, four already?

We’ve all made plans, and we’re all subjected to a probability – albeit on different measures for each – of failing to adhere to the said plans. This has happened even to the most punctual of us. We’re after all a mere human being and God forbids, if I’m punctual, then you must be Han Solo.

During the third days of creating Wisespend, I had intended to create a Context menu. However, something more interesting came up and the Context menu saw itself shoved next to the stack. In fact, I had no urge need to implement Context menu for this app at all. Instead what I want to do today is a continuation to what I did yesterday which is implementing Gesture listener to the various widgets I have on the screen.

Again, I’m taking inspiration from TweetDeck. However, if TweetDeck I think is using HorizontalScrollView (because we can stop midway during the swipe that in my mind’s eye suggesting it was implemented as a series of ListView within a HorizontalScrollView), what I’m currently implementing is a gesture-based navigation. Swipe left, you go one screen to the left (if any), and swipe right, you go one screen to the right. The swipes (or any gestures, for that matter) are only registered and fired an event listener when you had finished gesturing (that is, when you release your finger from the screen) and therefore, the resulted action only happened after the gesture has been done. So, I think, you can’t stopped midway and see half-panel of each two adjacent panels.

Update: I’m going to look for AnCha later today.

I implemented the action that responded to Gestures by using the Android framework’s Animation. AlphaAnimation to set the alpha, obviously, and TranslateAnimation to move the object horizontally (left and right). After a few minutes fiddling with the implementation within the Activity instance, I pulled out the implementation and put them inside another class.

the code?

The above methods says to slide a view to visible from the left and slide a view to invisible to the right (for each swipe, there are two affected panels, and the animation was therefore done for two). This is a three steps implementation. One, I’m setting the AlphaAnimation, from invisible to visible, next, I’m setting the TranslateAnimation to move horizontally from far left off the screen, and finally, step number three, put the animations into a single AnimationSet and instructed the View to start the animation based on the AnimationSet returned (not shown). However, whether I’m going to stick with this implementation or relegated to HorizontalScrollView a la TweetDeck, still remains to be seen.

Anyway, to speed it away, once I’m done with the Animation and satisfied enough with it running both on the emulator and on my handset, I moved right away to implement the C-part from the popular CRUD. This is probably the part where I spend most of my time, implementing, writing a chunk of logic, figuring out the sqlite engine, and testing. It’s a black hole of my development time really. At this time, I had briefly look into incorporating jUnit. But heck, I’ve never had a prior experience with jUnit even during my days as a Desktop app developer so I skipped it and probably get my hands wet at it some other time.

In total, it took me well into Tuesday, or almost two days, coping with the tasks while at the same time, struggling against procrastinating. It should be noted, that I did this in my spare time. In work days, I won’t work on codes or writings until six p.m. and even that was still subjected to my other leisure activities such as watching movies, playing games, or reading books. All of which I did plenty of.

To be continued …

This entry was posted in Wisespend. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s