AnimaSA/Atarashii — pull request #86 by d-sko (2014-01-30 18:33:57+00:00)
Title: API rewrite to use retrofit + some changes to all related code

First: sorry for this massive changeset, but as the API is a central part of the App there were quite many changes necessary.

I was working on issue #55 to use retrofit for API communication and I think it is now ready to show you.
While I rewrote the API stuff I had to touch a major part of the code and noticed some things that could be optimized together with the API changes. Here is an overview about my changes as this pull request is quite big:

- **API:**
- rewritten to use the retrofit library (http://square.github.io/retrofit/) which makes API handling much easier as it does all the deserialization (see MalApi.java and MalInterface.java in the api package)
- added the response package which contains all the classes for deserialization

- **database:**
- new class DatabaseManager which handles the database access stuff, this is mostly for better readability as MALManager is a little simpler now
- removed anime_time_days_d and manga_time_days_d and changed type of anime_time_days and manga_time_days to double: saving the same value in different columns is bad behaviour, better convert them if needed
- defined UNIQUE columns in every table (recordID in anime/manga, username inf friend/profile), this allows using the replace()-function so there is no need to care about if data needs to be inserted or updated (thats why itemExists() is gone)

- **general code changes:**
- needed to change nearly every thing that touches data, but tried to change as little as possible
- removed AsyncTasks for fetching anime/mangalists because they where implemented multiple times, so I rewrote them to provide a callback function and put them in the tasks-package
- simplified some things
- little cleanups (like unused imports)

- **misc:**
- updated readme and acknowledgements in about to credit Square Inc. for retrofit and Google Inc. for Gson (which is used by retrofit)

Everything should be working like before as far as I noticed, but with easier API handling.