Monday, May 31, 2010

Weekly report #1

Enjoy! (hosted on

Saturday, May 29, 2010

users team (and soon: mailing list)

Make sure you join androidu1-users team on lp :) ! I may also request a mailing list for the team, so that we'll have our own place, if you think it's a good idea - is it?

Launchpad project setup

Hi everybody! It's been a while. On Wednesday evening I broke my Ubuntu (installed an old udev driver) and made it unusable. I recovered on Thursday, talked to my mentor, seeked some feedback on IRC and investigated OAuth behaviour (there are still issues, doesn't work every time).

I have setup a launchpad project, which you will find here. Since I don't want people to unintentionally bzr branch (download) the development sources, which can be broken any time and are suitable for review (or testing) only, I have left the trunk series with main branch empty. Therefore if you're interested in the devel branch, check this out. Whenever I will implement a feature in 0.x series, I will push that to the main branch.

Tomorrow I'm co-organizing this conference, and afterwards I plan to see into releases, blueprints and milestones of the lp project (+ some nightly hacking).

Stay tuned. I wonder if my project can have it's mailing list.. ah! I'll set up androidu1-users group :D

PS I should have started writing my blog post in HTML long ago ;) No stress at all.

Wednesday, May 26, 2010

OAuth continues

And no, the log-in procedure is far from perfect. I feel that 1/3 of the time I was fighting with this error (and it, or my bug, cases authorization to work after 2nd or even 3rd try):

oauth.signpost.exception.OAuthExpectationFailedException: Request token or token secret not set in server reply. The service provider you use is probably buggy.

And now, for desert:
loginButton clicked
Retrieving request token...
Request token: xDs38NX3MsrSDP7H5hg4
Request secret: Fb7wZ9Gq3502TLRBSVXnWgg1LC4j41s8XtKKS9fqcTmJ936sc3KxxxxxxxNglBkpZS6W0WPvw31lF
Saving request information...
Saving Request Token: xDs38NX3MsrSDP7H5hg4
Saving Request Secret: Fb7wZ9Gq3502TLRBSVXnWgg1LC4j41s8XtKKS9fqcTmJ936sc3KxxxxxxxhNglBkpZS6W0WPvw31lF
Starting browser with authURL:
callback URI: androidu1://?oauth_token=xDs38NX3MsrSDP7H5hg4&oauth_verifier=0d14b808-fee3-40ba-b05e-1aedd595ab03&return=
Saved request token: xDs38NX3MsrSDP7H5hg4
Saved request secret: Fb7wZ9Gq3502TLRBSVXnWgg1LC4j41s8XtKKS9fqcTmJxxxxxxxwMhWbhNglBkpZS6W0WPvw31lF
Restoring mConsumer state...
oauthToken: xDs38NX3MsrSDP7H5hg4
oauthVerifier: 0d14b808-fee3-40ba-b05e-1aedd595ab03
Retrieving access token...
Access token: xz2Xc2rlQ7nBJ3jG4hpm
Access secret: xz2Xc2rlQ7nBJ3jG4hpm
Saving access information...
Saving OAuth Token: xz2Xc2rlxxxxxG4hpm
Saving OAuth Secret: 9l5wXfmxlF0Px4RpZ5tm9R9fFKkr5kDGlWtsDfJrZV3hVQr1xxxxxxxxx0hRPdj3ScmThxMjzM78FP
Removing request information...
Clearing Request Token
Clearing Request Secret
Sending request to U1...
200 OK

There's one bug in the log, but my eyes already hurt. G'nite.

Monday, May 24, 2010

First official coding day (night?)

I knew I would overdo it.. The beards are already singing and it's 4:15 AM on the clock :P
Is this the best coding time, or what :D! I was afraid of OAuth, which I'm new to, so I dug tens of pages and browsed at least 5-6 sample codes, using this or that, newer or older oauth version, with and without callback, blah blah blah. And I got it :D Signpost is dead simple (yeah, it's true what they write :) ), and they have those lovely sample codes, so I used one :) I jumped into ubuntuone-client Python code and dug a reference to /etc/xdg/ubuntuone/oauth_urls which I needed, set up few more variables, and..
Fetching request token from Ubuntu One...
Request token: GnpqrjR98jBcXXXXXXX
Token secret: pvBlJDjq1jgm9M14rzx0hgH2xXNnhFG8zC3VkqxDdshrSKcnbBNJwD6CCJR4XXXXXXXX
Now visit:
... and grant this app authorization
Enter the PIN code and hit ENTER when you're done:
Fetching access token from Ubuntu One...
Access token: ddxQlp8tfltXXXXXXXX
Token secret: Zn172Q7xsFdTlfB58LhLg4c8TzFmHRRhLWMQDCdvrrjJ27d0fkbk8qvVjN9rtbcnmfXXXXXXXXXXXXX
Sending request to Ubuntu One...
Response: 200 OK
Well, I'm more confident now ;)

Sunday, May 23, 2010

Regular update, May 22th

Played with verterok's u1-java-storageprotocol example client code, tried to understand the Deferred and Deferred.Callbacks usage (seems like static class fields are the easiest way to overcome issues with scope of variable visibility in the callbacks, which I don't particularly like..) and added some simple CLI interactivity, as seen below (yeah, this is somewhat the very beginning of our Android app; a regular user would be at least moderately confused :D)

Saturday, May 22, 2010

Regular update, May 21st

Hi all!

First, I wanted to thank for your comments, mails, even a wiki feature-request entry :) Your opinions and feedback is priceless, and one of the things that gratifies my efforts. Thank you, Ubuntu Community!

And now the update: yet again, Guillermo (aka verterok) is my hero ^ ^ To remind you, he's the one that has written ubuntuone-java-storageprotocol, which I will be using. He has answered all my questions, both really silly and some less-but-still-silly ;) (I am glad he believes there's no such thing as dumb questions :) ). He also spent quite a while helping me to properly configure the project with maven, which I am new to. Thank you, verterok!

Finally I was able to run the ExampleClient from within Eclipse, and see it in action. I also played a bit with the code, but plan much more code-fun for tomorrow (Saturday, that is).

Keep visiting, commenting, and sending your suggestions :) !

Thursday, May 20, 2010

Thank you Balsamiq

Hi everybody! As you already know, for the last two days (or nights actually) I have been using Balsamiq software to make my mock-ups.

I would like to happily share with you, that I have been generously granted a Balsamiq license key, so that I can use it's full potential and bring you the best quality mock-ups I can in this Open Source project. Latest pictures you have seen are just the beginning. There's still much to design and many decisions to make. I believe Balsamiq will make my sketching much more pleasant, than working with a pencil and rubber like I have before (I had quite a few sheets of paper wasted when I came up with the first drawings).

Please enjoy, and don't hesitate to share with me how would you like the application to work and look like in the future! Thank you Balsamiq!

Short / long press on a file

Hi there my dear visitors!

This time I really need your feedback, as this issue will directly impact the behavior of the application. As seen in the previous post on the mockup, there's no 'Open this file' nor 'Browse this directory', since I have concluded these would be normally what you wish to do when you tap/touch/click a file/folder. Long press, on the other hand, invokes a context menu to Share a folder with other people, or Publish (a file) via Ubuntu One, then you can copy or share the link options etc.

Question is: how would you want a short tap/touch to act upon a file on your Android Ubuntu One app? Would you think of opening it (point-and-shoot scenario ;) ), or perhaps (since you're using a mobile device) there are options you would be more probable to expect after short tap, like publish a file or remove it?

To rephrase one last time: do you want to open a file with a short tap/touch while long-press pops a menu to publish, delete; or do you want to pop a menu with the list of options (and maybe some additional info about the file) after any (short/long) press on a file?

Please leave your comments below. I will appreciate any constructive critique. (If you have used Android Dropbox application before, please note that or make sure your opinion is not influenced by you wanting to have the same behaviour as Db does.)

Thank you!

Regular update, May 19th

Finally I can present you with some better quality GUI mockups prepared with Balsamiq. It still lacks some elements (not all the settings options are visible, how the file update notification looks, how the uploading progress looks), but I think it conveys the application looks I wanted to design to share with you. Feedback is welcome, thank you for your previous comments!

Click to enlarge.

Wednesday, May 19, 2010

Balsamiq mockups

Balsamiq mockups on the way..

Tuesday, May 18, 2010

First GUI sketches

Awaiting your opinions :) Sorry for bad quality, will upload scans ASAP

Regular update, May 17th

That was quite a constructive evening! (And yet it has not finished)

Had a short IRC chat with my mentor, mentioned setting up a Launchpad project, and got a link to an article relating to OAuth, as this is an area I'm not yet confident in:

Then I have talked to verterok (thanks for invaluable pointers on u1-java-storageprotocol !! Now I know where to start playing around), collecting further links:
(python script to extract my OAuth token from gnome-keyring for testing purposes)

Then found those three, perhaps semi-related, since OAuth nature is browser-based:
We need to register such callback schema handling: x-oauth-androidu1://callback 
And this one nails it!

Monday, May 17, 2010

Regular update, May 16th

Today I read a bit from Android UI Guidelines, followed by doing Hello World and Notepad Tutorial step by step, very informative :) I also imported to Eclipse the Sample Sync Adapter sample code and poked around, but was sad to realize that the target Android API was 2.0, which means that if I would implement some sync functionality as the last stage of GSoC, the application wouldn't be compatible with older phones. I also hit #ubuntuone and #ubuntu-devel to get these GUI design tools:

  • (pen and paper are still fancy)
  • (however that I've also found earlier)

I also started to poke around ubuntuone-java-storageprotocol, but I see I'll really need some pointers from verterok on this.

Sunday, May 16, 2010

Regular update, May 15th

After a load of course work at my Institute during last days, finally I had time to catch up and read Content Providers, Security and Permissions and The AndroidManifest.xml File sections, which concludes the lecture of Framework Topics. For Sunday I plan to get dirty and play around with example Android applications. If I have time, also try out ubuntuone-java-storageprotocol test Client.

Wednesday, May 12, 2010

Blogger bug

I don't really understand that, but blogger is populating newlines in my blog entries like crazy. And this looks darn stupid as if I was trying to make my posts longer (and I really don't have time to fix those :< ). I wish the wiki where I started could syndicate RSS :d

Regular update, May 11th

I was getting worried, that I have little time left. It's late in the night, and today I only managed to reread the NotePad Intents declarations and read through Data Storage section. And you know what? Actually, I'm in a pretty good shape! (See: picture on the right)

From the Framework topics, I've got only Content Providers and Security and Permissions left :) (Graphics, Audio, etc are unrelated to my project). This feels right, as it's about time I start some storageprotocol-related code testing - it will be the very base for my work.

I leave Publishing for later, as I have to implement the application first :P

Best practices - well.. I should read that, anyway - as soon as possible. I've watched some Android-team movies concerning performance, responsiveness and seamlessness.

All in all I must admit, this documentation is quite a load of reading ;)

Tuesday, May 11, 2010

Regular update, May 10th

Following section was Localization, which closed the Resources and Assets chapter. Next section is Intents and Intent Filters, which understanding is quite important for our application. I'll let myself collect a few lines of most interesting material. (By the way, if you some some wicked amount of new-lines in any post on this blog, it's some sort of blogger bug.. certainly, it's not a feature).

Useful action constant from Intent class:
ACTION_MAIN, target: activity; Start up as the initial activity of a task, with no data input and no returned output - app (i.e. activity) entry point
ACTION_SYNC, target: activity; Synchronize data on a server with data on the mobile device. - we would make sync service call that upon the app
ACTION_BATTERY_LOW, target: broadcast receiver; A warning that the battery is low - we could turn off data sync in such situations (defined in app settings)

The action in an Intent object is set by the setAction() method and read by getAction().
The setData() method specifies data only as a URI, setType() specifies it only as a MIME type, and setDataAndType() specifies it as both a URI and a MIME type. The URI is read by getData() and the type by getType().

Monday, May 10, 2010

Regular update, May 9th

From Resources and Assets, have read Resources and I18n and Available Resource Types sections. Neat idea (after GSoC) would be to use SearchManager to make the cloud searchable, with search suggestions. Also, if the user opts-in, we could introduce file search from the Quick Search Box (which would allow users so receive search suggestions from the application content from outside the app).

Sunday, May 9, 2010

Regular update, May 8th

From the User Interface, I have read last 5 sections: Applying Styles and Themes, Building Custom Components, Binding to Data with AdapterView, Common Layout Objects and How Android Draws Views. Apart from applying styles and themes (which we may use after GSoC to make the app more fancy), those sections where also quite relevant - for starters I'll stick to standard views, but later on I think it would be preferable to write a custom component to view single file entries in the file list / file browser (which would include: file name, size, icon/mime type based, perhaps when was the file last updated, etc). It's pretty late, but I'll have a look at Resources and i18n section.

Saturday, May 8, 2010

Regular update, May 7th

From the User Interface, I have read next three sections, which are: Creating Dialogs, Handling UI Events and Notifying the User. First and third of those three are pretty important for the application, that I'll be developing. During the weekend, I plan to finish the lecture of User Interface section, and jump to the next ones, like i18n, Intents (which have been already mentioned in the material), Data Storage, etc. In couple of days hopefully, I should have a clear understanding of how Android platform works. I'm already enjoying it :)

Thursday, May 6, 2010

Regular update, May 5th

From the User Interface, I have read Declaring Layout and Creating Menus sections.

More importantly, till late night I have talked to Guillermo (verterok at #ubuntuone) about Java implementation of ubuntuone storage protocol. He started it in January (it's still in the +junk ;) ), and though it's missing some features, it already handles get/put, which is great news! This means that, instead of getting dirty (at least for now!) with the low level details, I'll be able to focus on the application itself. verterok has therefore laid some basis on which I can build the Android app, very fortunate :) !

Here I'd like to thank him for his patience and time he spent helping me figure out maven issues, when attempting to compile ubuntuone-java-storageprotocol . I'll finish this entry with triumphal

[INFO] ------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Thu May 06 02:10:02 CEST 2010

Yup, time to get some sleep.

Tuesday, May 4, 2010

Regular update, May 3rd

Finished lecture of fundamentals, didn't collect notes to conserve time (the documentation is well formatted and easily searchable, so there shouldn't be any problem if I need reference).

Clearing the stack
Starting tasks
Remote call procedures
Thread-safe methods
Activity lifecycle
Saving activity state
Coordinating activities
Service lifecycle
Broadcast receiver lifecycle
Processes and lifecycles

One of most important facts to note is that we'll be using a service, not spawning a thread, to upload files to the cloud (e.g. a picture from a camera), so that Android assigns service process rank to the task, minimizing jeopardy of it being killed in the meantime :)

Next up: User Interface

Sunday, May 2, 2010

Regular update, May 2nd

Some notes from Application Fundamentals

ContentResolver can talk to any ContentProvider
activities, services, and broadcast receivers are activated by asynchronous messages (intents)
Activity.startActivityForResult() (we expect some result back, with onActivityResult())
intents are passed to activities by Android with onNewIntent()

starting service
Context.startService() (service's onStart() gets the intent)
Context.bindService() (to establish an ongoing connection, service's onBind() gets the intent)

initiating a broadcast

shutting down components
no need to shutdown ContentProvider or BroadcastReceiver
shut down activity with finish(), or use finishActivity() to shut down the one it created
shut down service with stopSelf() method, or by calling Context.stopService()

the manifest file

Regular update, May 1st

Videos watched & notes taken + reading materials

Androidology - Architecture Overview [ link ]

Decompose the app into application building blocks, which include
  • Activities
  • BroadcastReceivers (triggered by any event)
  • Services
  • ContentProviders
Androidology - Application Lifecycle [ link ]
Androidology - APIs [ link ]

Google I/O 2009 - ...Make your Android UI Fast and Efficient [ link ] (good one!)
  • reuse views with Recycler for higher fps
  • prescale bitmaps with
    image = Bitmap.createPrescaledBitmap(image, view.getWidth(), view.getHeight(), true);
  • remove backgrounds from views, which fill parents full width and height (eg if you have a map, you don't see the background, which is still rendered) [00:17:23]
  • invalidate() to redraw a view is inefficient, use invalidate(rect) or invalidate(left, top, right, bottom)
  • fewer (views) is better ;) (try to get rid of views that have only one child, too: HierarchyViewer)
  • use compound drawables (eg TextView instead of ImageView+TextView)
  • use ViewStub to inflate part of the UI on demand (eg for part of the UI that for majority of the time is invisible) [00:35:20]
  • use merge tag to reuse UI hierarchy elements
  • RelativeLayout instead of embedding linear layouts; hard to use, but it pays off
  • use custom views, custom layouts instead of overusing numerous views
  • garbage collection kicks in for 100~500ms, stops threads (so allocate little memory, or even none :d)
  • do not allocate memory in those time-critical points:

Saturday, May 1, 2010

Recommended reading

For students using GSoC mailing lists:
This will be probably announced soon:

For mentors: