Google Summer of Code – First 2 Weeks

Hello everyone, I know I mentioned in my earlier blog post (that was the first blog post about my Google Summer of Code journey), that I shall be posting details regarding my Google Summer of Code project as it continues. But unfortunately I couldn’t update because of my hectic summers and schedule. But here it is ! An overview of First 2 weeks my GSoC.

first_2_week_blog_image

Now coming to the project updates, let’s first have a look of what’s done till now. The first feature I decided to implement was the “NewsRoom” Section – Section where details of recent news/updates, press releases or highlights of the organization will be displayed. Currently, ‘International Neuroinformatics Coodinating Facility’ website www.incf.org has a news section already that they regularly update. Link of their online newsroom section is: www.incf.org/newsroom/ . For those news to appear in android app, I had to find some way that can be used as data source from website. After I explored a little, I managed to find RSS Feed for those news/updates at incf.org website. So now I had found the source.

Next task was to integrate that source into mobile app. The approach I used for this purpose is to first download that RSS Feed into mobile and save that file as ‘news.xml‘ and then use android XMLPullParser for parsing RSS Feed  to extract the relevant information i.e. Date of publishing, Title, Text of the update. Besides the extraction of keys from RSS, another challange I had to face was to extract the image from html source embedded with Update Text and display that image thumbnail along the left side of news. For this purpose, I used ‘JAVA HTML Parser Library – jsoup ‘ – It works great like jQuery for extracting DOM elements. Following is the piece of code I used for extracting image:

Document doc = Jsoup.parse(curText);   //curText is the Raw HTML from which image is to be extracted
 Element e = doc.select("img[src]").first();
 if(null != e) {
 String imgUrl = e.attr("src");
 Log.i("incf", "Image URL extracted = " + imgUrl);
 currentRssItem.setImgUrl(imgUrl);  //here it sets the extracted image URI
 }

I also had to do custom ListView implementation because default ListView only supports text. But I wanted to display the each newsfeed item such that each list item is divided into 2 parts – the part on left side would be having thumbnail image and part on right side was supposed to have 3 things: News Title, News Text & Publishing Date. The Adapter for Newsfeed ListView is implemented in file NewsAdapter.java

If you want to explore all source code for NewsRoom module that I implemented, that’s available on Github repo of this project. Here is it’s link: https://github.com/shumail92/GCA-Android/tree/master/Conference-v2/src/com/g_node/gca/newsroom

After all these efforts, I managed to finally implement this successfully and move on next module implementation. Following is the preview screenshot fo NewsRoom Module:

newsroom_screenshot

Share your thoughts on this in comments below – I shall be looking forward to any suggestions or feedback :)

2 thoughts on “Google Summer of Code – First 2 Weeks

Leave a Reply