本文整理匯總了Java中org.matrix.androidsdk.rest.model.ImageMessage類的典型用法代碼示例。如果您正苦於以下問題:Java ImageMessage類的具體用法?Java ImageMessage怎麽用?Java ImageMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ImageMessage類屬於org.matrix.androidsdk.rest.model包,在下文中一共展示了ImageMessage類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listImageMessages
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* @return the imageMessages list
*/
private ArrayList<SlidableImageInfo> listImageMessages() {
ArrayList<SlidableImageInfo> res = new ArrayList<SlidableImageInfo>();
for(int position = 0; position < mAdapter.getCount(); position++) {
MessageRow row = mAdapter.getItem(position);
Message message = JsonUtils.toMessage(row.getEvent().content);
if (Message.MSGTYPE_IMAGE.equals(message.msgtype)) {
ImageMessage imageMessage = (ImageMessage)message;
SlidableImageInfo info = new SlidableImageInfo();
info.mImageUrl = imageMessage.url;
info.mRotationAngle = imageMessage.getRotation();
info.mOrientation = imageMessage.getOrientation();
info.mMimeType = imageMessage.getMimeType();
info.midentifier = row.getEvent().eventId;
res.add(info);
}
}
return res;
}
示例2: getMediaMessagePosition
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* Returns the mediaMessage position in listMediaMessages.
*
* @param mediaMessagesList the media messages list
* @param mediaMessage the imageMessage
* @return the imageMessage position. -1 if not found.
*/
int getMediaMessagePosition(ArrayList<SlidableMediaInfo> mediaMessagesList, Message mediaMessage) {
String url = null;
if (mediaMessage instanceof ImageMessage) {
url = ((ImageMessage) mediaMessage).getUrl();
} else if (mediaMessage instanceof VideoMessage) {
url = ((VideoMessage) mediaMessage).getUrl();
}
// sanity check
if (null == url) {
return -1;
}
for (int index = 0; index < mediaMessagesList.size(); index++) {
if (mediaMessagesList.get(index).mMediaUrl.equals(url)) {
return index;
}
}
return -1;
}
示例3: fillThumbnailInfo
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* Fills the imageMessage imageInfo.
*
* @param context Application context for the content resolver.
* @param imageMessage The imageMessage to fill.
* @param thumbUri The thumbnail uri
* @param mimeType The image mimeType
*/
public static void fillThumbnailInfo(Context context, ImageMessage imageMessage, Uri thumbUri, String mimeType) {
ImageInfo imageInfo = getImageInfo(context, null, thumbUri, mimeType);
if (null != imageInfo) {
if (null == imageMessage.info) {
imageMessage.info = new ImageInfo();
}
imageMessage.info.thumbnailInfo = new ThumbnailInfo();
imageMessage.info.thumbnailInfo.w = imageInfo.w;
imageMessage.info.thumbnailInfo.h = imageInfo.h;
imageMessage.info.thumbnailInfo.size = imageInfo.size;
imageMessage.info.thumbnailInfo.mimetype = imageInfo.mimetype;
}
}
示例4: getImageMessagePosition
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* Returns the imageMessages position in listImageMessages.
* @param listImageMessages the messages list.
* @param imageMessage the imageMessage
* @return the imageMessage position. -1 if not found.
*/
private int getImageMessagePosition(ArrayList<SlidableImageInfo> listImageMessages, ImageMessage imageMessage) {
for(int index = 0; index < listImageMessages.size(); index++) {
if (listImageMessages.get(index).mImageUrl.equals(imageMessage.url)) {
return index;
}
}
return -1;
}
示例5: toImageMessage
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
public static ImageMessage toImageMessage(JsonElement jsonObject) {
try {
return gson.fromJson(jsonObject, ImageMessage.class);
} catch (Exception e) {
Log.e(LOG_TAG, "## toImageMessage failed " + e.getMessage());
}
return new ImageMessage();
}
示例6: buildImageMessage
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* Build an image message from a RoomMediaMessage.
*
* @param roomMediaMessage the roomMediaMessage
* @return the image message
*/
private Message buildImageMessage(RoomMediaMessage roomMediaMessage) {
try {
String mimeType = roomMediaMessage.getMimeType(mContext);
final MXMediasCache mediasCache = mDataHandler.getMediasCache();
String mediaUrl = getMediaUrl(roomMediaMessage);
// compute the thumbnail
Bitmap thumbnailBitmap = roomMediaMessage.getFullScreenImageKindThumbnail(mContext);
if (null == thumbnailBitmap) {
thumbnailBitmap = getMediasPickerThumbnail(roomMediaMessage);
}
if (null == thumbnailBitmap) {
Pair<Integer, Integer> thumbnailSize = roomMediaMessage.getThumnailSize();
thumbnailBitmap = ResourceUtils.createThumbnailBitmap(mContext, roomMediaMessage.getUri(), thumbnailSize.first, thumbnailSize.second);
}
if (null == thumbnailBitmap) {
thumbnailBitmap = roomMediaMessage.getMiniKindImageThumbnail(mContext);
}
String thumbnailURL = null;
if (null != thumbnailBitmap) {
thumbnailURL = mediasCache.saveBitmap(thumbnailBitmap, null);
}
// get the exif rotation angle
final int rotationAngle = ImageUtils.getRotationAngleForBitmap(mContext, Uri.parse(mediaUrl));
if (0 != rotationAngle) {
// always apply the rotation to the image
ImageUtils.rotateImage(mContext, thumbnailURL, rotationAngle, mediasCache);
}
ImageMessage imageMessage = new ImageMessage();
imageMessage.url = mediaUrl;
imageMessage.body = roomMediaMessage.getFileName(mContext);
if (TextUtils.isEmpty(imageMessage.body)) {
imageMessage.body = "Image";
}
Uri imageUri = Uri.parse(mediaUrl);
if (null == imageMessage.info) {
Room.fillImageInfo(mContext, imageMessage, imageUri, mimeType);
}
if ((null != thumbnailURL) && (null != imageMessage.info) && (null == imageMessage.info.thumbnailInfo)) {
Uri thumbUri = Uri.parse(thumbnailURL);
Room.fillThumbnailInfo(mContext, imageMessage, thumbUri, "image/jpeg");
imageMessage.info.thumbnailUrl = thumbnailURL;
}
return imageMessage;
} catch (Exception e) {
Log.e(LOG_TAG, "## buildImageMessage() failed " + e.getMessage());
}
return null;
}
示例7: fillImageInfo
import org.matrix.androidsdk.rest.model.ImageMessage; //導入依賴的package包/類
/**
* Fills the imageMessage imageInfo.
*
* @param context Application context for the content resolver.
* @param imageMessage The imageMessage to fill.
* @param imageUri The full size image uri.
* @param mimeType The image mimeType
*/
public static void fillImageInfo(Context context, ImageMessage imageMessage, Uri imageUri, String mimeType) {
imageMessage.info = getImageInfo(context, imageMessage.info, imageUri, mimeType);
}