Google Summer of Code – week # 10 – 11

This blog post covers previous last 2 weeks – Though most of the Schedule section had been covered till last week, it wasn’t still complete yet. I mentioned this in my last blog post as well that Schedule may take another week to complete and by week # 10, it was complete. Let’s move on towards the details…



The idea was that clicking on any of the Schedule item should show it’s detail. But as Schedule item can be any from Session, Track or Event, approach was supposed to cover these 3 differently. Initially, I created an Activity: – Clicking on the Schedule item opens this activity and that Schedule item is passed to the activity.

The problem that I encountered there was to pass custom objects (Event, Session, Track object) in intent because these weren’t simple strings those can be passed by calling putString() method. For this purpose, I converted these custom objects to serializable by making each class to implement serializable interface, because a serializable can be passed to an intent by calling bundle.putSerializable() method.

//Passing object to intent

 Intent intent = new Intent(getActivity(), ScheduleItemExtended.class);

 Bundle bundle = new Bundle();
 bundle.putSerializable("event", eventObject);


 // Getting the passed object in activity
 EventScheduleItem event = (EventScheduleItem) bundle.getSerializable("event");

The example above shows passing of an ‘Event’ to intent whereas any of the Schedule objects can be passed in the same way.  Next I created 3 different layout files each for a Schedule object and based on the type of object that’s passed to ScheduleItemExtended Activity, the relevant layout is set for that activity. If the object is Session, it shows the information about TRACKS in that SESSION – Clicking on any of the TRACK Button shows the EVENTS inside that TRACK – Clicking on any of the EVENT Button shows the detail of that particular Event. (Will be more clear in the screenshot).

Launching Abstract from the Event (if exists)

An event may have an Abstract linked with it. The task was to implement option for opening relevant Abstract from Event if it exists. Details about this can be found here on issue # 13 on GitHub that my mentor opened.

This is the example of abstract key in event JSON Object:

 "title": "Neuro-electric Transitions",
 "subtitle": "might be there",
 "start": "13:30",
 "end": "14:30",
 "location": "B01.063",
 "date": "2014-08-01",
 "authors": ["George Martin"],
 "type": "talk",
 "abstract": ""

In this example, Event ‘Neuro-electric Transitions‘ has associated Abstract with it and the UUID of that Abstract is the part of URL after last slash (/) – First step was to extract the UUID of Abstract from the URL. For this purpose, I used JAVA’s String lastIndexOf method to find the last occurring slash (/) and extract string starting after that slash till end. This code did the job:

String event_uuid = event_abstract_url.substring(event_abstract_url.lastIndexOf("/")+1, event_abstract_url.length());

// event_abstract_url is the complete URL string from event object's Abstract Key

Once I had the Abstract UUID, I added a simple check to see if there’s any Abstract against that UUID in Database by executing an SQL Query to fetch Abstracts and putting a check condition in where clause. In case of no Abstract for that UUID, cursor.getCount returns < 1 – Based on this cursor count value, ‘Open Abstract’ button is enabled (if Abstract exists) or disabled (if Abstract doesn’t exist).

schedule_extended_module_screenshot(Screenshot showing Schedule Details for Session, Track and Event)

What Else ?

Besides Schedule, I also worked on Main Menu screen and completely revamped it’s layout and that really looks stylish now (Shall post screenshot soon in next blogpost). Another thing that wasn’t done till now was Up/Back navigation wasn’t implemented for any of the section. I worked on that part and implemented back/up navigation and set parentActivity attribute for activities in  manifest.xml.

Major part of the app has been completed and time is being spent on code improvement and performance optimization now.

That’s all for past 2 weeks – if you have any question about the code or related, feel free to ask in comments and do share your thoughts and feedback on it in comments below. I’ll be looking forward to any suggestions or feedback.

GSoC Week # 10,11  – (20 July 2014 – 03 August 2014)

Leave a Reply