Presencepublic final class Presence extends Object implements android.os.ParcelableA Presence is an abstract presentation of the user's presence
information.
Note that changes made to the Presence data won't be reflected to the
server until ImConnection.updateUserPresence is called.
Only the logged in user can update its own presence data via
ImConnection.updateUserPresence . Changes to any other
contact's presence data won't be saved or sent to the server. |
Fields Summary |
---|
public static final int | OFFLINE | public static final int | DO_NOT_DISTURB | public static final int | AWAY | public static final int | IDLE | public static final int | AVAILABLE | public static final int | CLIENT_TYPE_DEFAULT | public static final int | CLIENT_TYPE_MOBILE | private int | mStatus | private String | mStatusText | private byte[] | mAvatarData | private String | mAvatarType | private int | mClientType | private Map | mExtendedInfo | public static final Parcelable.Creator | CREATOR |
Constructors Summary |
---|
public Presence()
this(Presence.OFFLINE, null, null, null, CLIENT_TYPE_DEFAULT, null);
| public Presence(int status, String statusText, byte[] avatarData, String avatarType, int clientType)
this(status, statusText, avatarData, avatarType, clientType, null);
| public Presence(int status, String statusText, byte[] avatarData, String avatarType, int clientType, Map extendedInfo)
setStatus(status);
mStatusText = statusText;
setAvatar(avatarData, avatarType);
mClientType = clientType;
mExtendedInfo = extendedInfo;
| public Presence(Presence p)
this(p.mStatus, p.mStatusText, p.mAvatarData, p.mAvatarType,
p.mClientType, p.mExtendedInfo);
| public Presence(android.os.Parcel source)
mStatus = source.readInt();
mStatusText = source.readString();
mAvatarData = source.createByteArray();
mAvatarType = source.readString();
mClientType = source.readInt();
// TODO - what ClassLoader should be passed to readMap?
// TODO - switch to Bundle
mExtendedInfo = source.readHashMap(null);
|
Methods Summary |
---|
public int | describeContents()
return 0;
| public byte[] | getAvatarData()Get avatar bitmap.
if(mAvatarData == null){
return null;
} else {
byte[] data = new byte[mAvatarData.length];
System.arraycopy(mAvatarData, 0, data, 0, mAvatarData.length);
return data;
}
| public java.lang.String | getAvatarType()Get the MIME type of avatar.
return mAvatarType;
| public int | getClientType()
return mClientType;
| public java.util.Map | getExtendedInfo()
return mExtendedInfo == null ? null : Collections.unmodifiableMap(mExtendedInfo);
| public int | getStatus()
return mStatus;
| public java.lang.String | getStatusText()
return mStatusText;
| public boolean | isOnline()
return mStatus != OFFLINE;
| public void | setAvatar(byte[] data, java.lang.String type)
if(data != null) {
mAvatarData = new byte[data.length];
System.arraycopy(data, 0, mAvatarData, 0, data.length);
} else {
mAvatarData = null;
}
mAvatarType = type;
| public void | setClientType(int clientType)
mClientType = clientType;
| public void | setStatus(int status)
if (status < OFFLINE || status > AVAILABLE ) {
throw new IllegalArgumentException("invalid presence status value");
}
mStatus = status;
| public void | setStatusText(java.lang.String statusText)
mStatusText = statusText;
| public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeInt(mStatus);
dest.writeString(mStatusText);
dest.writeByteArray(mAvatarData);
dest.writeString(mAvatarType);
dest.writeInt(mClientType);
dest.writeMap(mExtendedInfo);
|
|