realtalk403/realtalk — pull request #83 by colinkho (2013-05-16 09:10:01+00:00)
Title: Implemented GCM + cleaned up package names + modified activities to use gcm

Overview:
This is a major change to the RealTalk chat framework. Chat logs are now managed by the ChatController and joining and leaving chatrooms should use the ChatController instead of ChatManager directly. Also, updates to chatrooms are done by GCM (infinite while loop is done), therefore the server should be less burdened by the number of requests and hence timeout less often. A slight change has been implemented to the Login Activity and a major one to Chat Room Activity.

Modified:
AndroidManifest.xml - added permissions to use gcm, changed package name to exclude example and added GCM's receiver.
activity_main.xml - edited some of the id names to be more reflective
*.java - edited all files to use new package name
ChatRoomActivity.java - did not remove old methods used to retrieving chat logs. Implemented new methods that make use of the chatcontroller instead. Also set up a receiver used to trigger events whereby new messages are received through gcm.
CreateRoomActivity.java - should not throw a run time exception, should just warn that server is done and prevent further usage. Added TODO
LoginActivity.java - GCM relies heavily on the registration id of the device tagged to the correct user. Hence after logging in / auth, it updates the server of the new reg id regardless.
SelectRoomActivity.java - Commented out location code for the time being. I didnt find a good way to integrate the location code with this. Hence i have commented it out and taylor should be able to follow up on this.
ChatRoomModel.java & HallwayModel.java - had to modify as they were insufficient to chatcontroller's needs
PullMessageResultSet.java - implemented necessary getters

Added:
gcm.jar - library needed to use gcm
ChatController.java - holds an instance of the current logged on user and also the chat rooms that the user is currently in
CommonUtilities.java - added constants and also a method used to broadcast to activity about a new message
GCMIntentService.java - Service that handles the GCM messages from the receiver.
GCMReceiver.java - Allows GCMReceiver to be placed in a different package other than in src.
GCMUtilities.java - Utilities for GCM