com.joooonho.SelectableRoundedImageView Java Examples

The following examples show how to use com.joooonho.SelectableRoundedImageView. 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: VideoMessageBaseItemView.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
@Override
public void setMessageData(RcvHolder holder, final EMMessage emMessage, final int position)
{
    SelectableRoundedImageView imgThumb = holder.findView(R.id.img_chat_listitem_video_content);
    TextView tvDuration = holder.findView(R.id.tv_chat_listitem_video_content_duration);
    TextView tvFileLength = holder.findView(R.id.tv_chat_listitem_video_content_filelength);

    EMVideoMessageBody messageBody = (EMVideoMessageBody) emMessage.getBody();

    //缩略图
    String localThumb = messageBody.getLocalThumb();
    String remoteThumb = messageBody.getThumbnailUrl();
    if (StringUtil.isNotEmpty(localThumb) && new File(localThumb).exists())
        CommonUtils.getInstance().getImageDisplayer()
                .display(mContext, imgThumb, localThumb, 240, 300);
    else
        CommonUtils.getInstance().getImageDisplayer()
                .display(mContext, imgThumb, remoteThumb, 240, 300);
    //视频时长
    String durationEx = mContext.getResources().getString(R.string.tv_chat_listitem_video_duration_Ex);
    String duration = durationEx.replaceFirst("%%1", String.valueOf(messageBody.getDuration()));
    tvDuration.setText(duration);
    //视频大小
    tvFileLength.setText(formetFileSize(messageBody.getVideoFileLength()));

    //点击播放
    holder.setClickListener(R.id.img_chat_listitem_video_start, new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            mPresenter.clickVideoMessage(emMessage, position);
        }
    });
    setMessage(holder, emMessage, position);
}
 
Example #2
Source File: MovieView.java    From DoubanTop with Apache License 2.0 5 votes vote down vote up
private void handleImage(ViewGroup layout, int position) {
    SelectableRoundedImageView image = (SelectableRoundedImageView) layout.getChildAt(position);
    image.setImageDrawable(mImage);
    if (TextUtils.isEmpty(mDescriptionText) && TextUtils.isEmpty(mNormalButtonText) &&
            TextUtils.isEmpty(mHighlightButtonText)) {
        image.setCornerRadiiDP(2, 2, 2, 2);
    }
}
 
Example #3
Source File: GroupMemberAdapter.java    From talk-android with MIT License 4 votes vote down vote up
public ViewHolder(View view) {
    super(view);
    imageView = (SelectableRoundedImageView) view.findViewById(R.id.image);
    removeView = view.findViewById(R.id.remove);
    text = (TextView) view.findViewById(R.id.text);
}
 
Example #4
Source File: ImageMessageBaseItemView.java    From FamilyChat with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example #5
Source File: MovieView.java    From DoubanTop with Apache License 2.0 4 votes vote down vote up
public SelectableRoundedImageView getImageView() {
    LinearLayout layoutAll = (LinearLayout) getChildAt(0);
    SelectableRoundedImageView image = (SelectableRoundedImageView) layoutAll.getChildAt(0);
    return image;
}