|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.service.agent.UiAgent
public class UiAgent
The UiAgent is aware when any "Live" Activities are currently on screen, and contains business logic for sending unsolicited messages to the UI. This is useful for knowing when to send chat messages, presence updates, notifications, error messages, etc to an on screen Activity.
Field Summary | |
---|---|
private boolean |
mChat
|
private Context |
mContext
|
private Handler |
mHandler
|
private long |
mLocalContactId
|
private MainApplication |
mMainApplication
|
private boolean |
mNewMessage
|
private Bundle |
mUiBundleQueue
|
private ServiceUiRequest |
mUiEventQueue
|
static int |
UI_AGENT_NOTIFICATION_ID
|
Constructor Summary | |
---|---|
UiAgent(MainApplication mainApplication,
Context context)
Constructor. |
Method Summary | |
---|---|
long |
getLocalContactId()
This method returns the local ID of the contact the HandlerAgent is tracking. |
boolean |
isSubscribed()
Returns TRUE if an Activity is currently listening out for unsolicited events (i.e. a "Live" activity is currently on screen). |
boolean |
isSubscribedWithChat()
Returns TRUE if an Activity is currently listening out for unsolicited events (i.e. a "Live" activity is currently on screen). |
void |
sendUnsolicitedUiEvent(ServiceUiRequest uiEvent,
Bundle bundle)
Send an unsolicited UI Event to the UI. |
void |
subscribe(Handler handler,
java.lang.Long localContactId,
boolean chat)
Subscribes a UI Handler to receive unsolicited events. |
void |
unsubscribe(Handler handler)
This method ends the UI Handler's subscription. |
void |
updateChat(long contactId)
Notifies an on screen Chat capable Activity of a relevant update. |
private void |
updateChatNotification()
Update the Notification bar with Chat information directly from the database. |
void |
updatePresence(long contactId)
This method is called by the Presence engine to notify a subscribed Activity of updates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UI_AGENT_NOTIFICATION_ID
private MainApplication mMainApplication
private ServiceUiRequest mUiEventQueue
private Bundle mUiBundleQueue
private Handler mHandler
private long mLocalContactId
private boolean mChat
private boolean mNewMessage
private Context mContext
Constructor Detail |
---|
public UiAgent(MainApplication mainApplication, Context context)
Method Detail |
---|
public void sendUnsolicitedUiEvent(ServiceUiRequest uiEvent, Bundle bundle)
uiEvent
- Event to send.bundle
- Optional Bundle to send to UI, usally set to NULL.
java.security.InvalidParameterException
- UiEvent is NULL.public void subscribe(Handler handler, java.lang.Long localContactId, boolean chat)
handler
- - UI handler to receive unsolicited events.localContactId
- Provide a local contact ID to receive updates for
the given contact only.localContactId
- Set this to -1 to receive updates for every
contact.localContactId
- Set this to NULL not to receive contact updates.chat
- - TRUE if the Handler expects chat messages
java.lang.NullPointerException
- Handler must not be NULLpublic void unsubscribe(Handler handler)
handler
- - UI handler to no longer receive unsolicited events.
java.lang.NullPointerException
- Handler must not be NULLpublic long getLocalContactId()
public boolean isSubscribed()
public boolean isSubscribedWithChat()
public void updatePresence(long contactId)
contactId
- Update an Activity that shows this contact ID only.contactId
- Set this to -1 to send updates relevant to all contacts.public void updateChat(long contactId)
contactId
- Update an Activity that shows Chat information for this
localContact ID only.private void updateChatNotification()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc