First of all, I’m very delighted that I have passed the GSoC Mid-Term evaluation of my project that’s the most recent development in my GSoC journey.
Right after first 2 weeks, I had my final semester exams scheduled. Thus, I requested my mentor to give me off for my final exams and he granted me leave for 10 days. So, I couldn’t work on anything during 3rd week.
Screenshot of the email that made my day 😀
Right after my exams, I resumed my programming. G-Node has now developed a web portal for conferences as well recently and rather than providing me with the JSON files for ‘Abstracts’ my mentor told me about the web portal and it’s RESTful API. So app would communicate with their online server via REST API for fetching the latest data. The major change that reflected here was the new JSON Model for Abstracts Data. They had completely changed the JSON Model for the Abstract. Mentor that’s why asked me to port the app for new model – and an amazing challenge started 😀
Initially, I started working on old model and started changing it for new model but i wasn’t getting any luck with that. After few time, I decided to go for writing it from scratch and I’m glad i took that decision. I had to change whole DB schema for the new model, DBHelper class, JSON parsing function for making up to the new model. But somehow I got it managed.
The other problem was: Like in previous version there was option for ‘Next’ & ‘Prev’ navigation of Abstracts – that wasn’t working now. The reason was that for previous model the ID was numeric and auto-increment. So for navigating to the next abstract, all it required was to increment current ID value by 1 and fetch data for that ID. But in new model, the ID has been changed to UUID rather than numeric. But thanks to SQLite, it has functionality of ROWID for each record which is unique and the ROWID is integer & auto-increment. Thus I used ROWID for getting UUID of Next and Previous record like below:
String getCurrentRowIDQuery = "SELECT ROWID FROM ABSTRACT_DETAILS WHERE UUID = '" + currentID + "';"; --currentID is UUID of current abstract
And then incremented or decremented for getting ROWID of next or previous record respectively. After getting the ROWID of required record, the next query that executed was:
String getNextAbstractUUID = "SELECT UUID FROM ABSTRACT_DETAILS WHERE ROWID = " + newRecordRowID + ";"; --newRecordRowID is Row ID of new record to be fetched
Favorite Abstracts Functionality:
The other feature I worked on during this time was to add functionality for user to ‘Add an Abstract to Favorites’. Because the Conference would be having huge number of Abstracts and user might be interested in few so he/she can now add Abstracts of his/her interest to ‘Favorites’ just by clicking a Star icon in Actionbar.
For maintaining the record of Favorite Abstracts, I added a new Table in Database: ABSTRACT_FAVORITES – with 1 column only (UUID). This table maintains UUID of Abstracts that user has favourited. And then in FavouriteAbstract Activity, the SQL Query for getting favorite Abstracts goes like this:
String query = "SELECT UUID AS _id , TOPIC, TITLE, ABSRACT_TEXT, STATE, SORTID, REASONFORTALK, MTIME, TYPE,DOI, COI, ACKNOWLEDGEMENTS FROM ABSTRACT_DETAILS WHERE _id IN (SELECT ABSTRACT_UUID FROM ABSTRACT_FAVORITES);"; --Subquery runs for getting UUIDs of favorite abstracts from ABSTRACT_FAVORITES table.<a href="http://shumailmohyuddin.com/wp-content/uploads/2014/07/abstracts_module_screenshots.jpg"> </a>
The code for whole Abstracts Module is available on Github.
You can explore it here: https://github.com/shumail92/GCA-Android/tree/master/Conference-v2/src/com/g_node/gca/abstracts
Share your thoughts in comments below. I’ll be looking forward to any suggestions or feedback.