Java Code Examples for com.hyphenate.chat.EMImageMessageBody#getRemoteUrl()
The following examples show how to use
com.hyphenate.chat.EMImageMessageBody#getRemoteUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HxImageDetailPresenter.java From FamilyChat with Apache License 2.0 | 6 votes |
public void savePic(Context context, EMMessage message) { if (message == null) return; mViewImpl.showDownloadDialog(); EMImageMessageBody messageBody = (EMImageMessageBody) message.getBody(); String remoteUrl = messageBody.getRemoteUrl(); CommonUtils.getInstance().getImageDisplayer().downloadBitmap(context, remoteUrl, new OnBitmapDownloadListener() { @Override public void onDownload(Bitmap bitmap) { saveBitmap(bitmap); } }); }
Example 2
Source File: HxImageDetailAdapter.java From FamilyChat with Apache License 2.0 | 5 votes |
@Override public Object instantiateItem(ViewGroup container, int position) { PhotoView photoView = new PhotoView(mActivity); photoView.setBackgroundColor(Color.BLACK); photoView.setScaleType(ImageView.ScaleType.FIT_CENTER); photoView.setEnabled(true); EMImageMessageBody messageBody = (EMImageMessageBody) mDataList.get(position).getBody(); String localUrl = messageBody.getLocalUrl(); String remoteUrl = messageBody.getRemoteUrl(); if (StringUtil.isNotEmpty(localUrl) && new File(localUrl).exists()) CommonUtils.getInstance().getImageDisplayer().display(mActivity, photoView, localUrl, mScreenWidth, mScreenHeight , R.drawable.pic_image_detail_place_holder, R.drawable.pic_image_detail_fail); else CommonUtils.getInstance().getImageDisplayer().display(mActivity, photoView, remoteUrl, mScreenWidth, mScreenHeight , R.drawable.pic_image_detail_place_holder, R.drawable.pic_image_detail_fail); photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { @Override public void onPhotoTap(View view, float x, float y) { if (mListener != null) mListener.OnPhotoTapListener(view, x, y); } }); container.addView(photoView); return photoView; }
Example 3
Source File: ImageMessageBaseItemView.java From FamilyChat with Apache License 2.0 | 4 votes |
@Override public void setMessageData(RcvHolder holder, final EMMessage emMessage, final int position) { EMImageMessageBody messageBody = (EMImageMessageBody) emMessage.getBody(); //根据图片高度计算ImageView的尺寸 int imgWidth = messageBody.getWidth(); int imgHeight = messageBody.getHeight(); if (imgWidth >= MAX_IMAGE_SIZE) { mLayoutWidth = MAX_IMAGE_SIZE; mLayoutHeight = mLayoutWidth * imgHeight / imgWidth; } else if (imgHeight >= MAX_IMAGE_SIZE) { mLayoutHeight = MAX_IMAGE_SIZE; mLayoutWidth = mLayoutHeight * imgWidth / imgHeight; } else { mLayoutWidth = imgWidth >= MIN_IMAGE_SIZE ? imgWidth : MIN_IMAGE_SIZE; mLayoutHeight = imgHeight >= MIN_IMAGE_SIZE ? imgHeight : MIN_IMAGE_SIZE; } SelectableRoundedImageView imageView = holder.findView(R.id.img_chat_listitem_img_content); ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); layoutParams.width = mLayoutWidth + PADDING_LEFT + PADDING_RIGHT; layoutParams.height = mLayoutHeight + PADDING_TOP + PADDING_BOTTOM; imageView.setLayoutParams(layoutParams); //判断显示图地址 String localUrl = messageBody.getLocalUrl(); String remoteUrl = messageBody.getRemoteUrl(); if (emMessage.direct() == EMMessage.Direct.SEND && StringUtil.isNotEmpty(localUrl) && new File(localUrl).exists()) CommonUtils.getInstance().getImageDisplayer() .display(mContext, imageView, localUrl, mLayoutWidth, mLayoutHeight); else CommonUtils.getInstance().getImageDisplayer() .display(mContext, imageView, remoteUrl, mLayoutWidth, mLayoutHeight); //设置点击事件 imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPresenter.clickImageMessage(emMessage, position); } }); setMessage(holder, emMessage, position); }