Java Code Examples for com.chad.library.adapter.base.BaseViewHolder#setVisible()

The following examples show how to use com.chad.library.adapter.base.BaseViewHolder#setVisible() . 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: ThemesAdapter.java    From OmniList with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Colorful.ThemeColor themeColor) {
    int primaryColor = context.getResources().getColor(themeColor.getColorRes());

    helper.setImageResource(R.id.civ_color, themeColor.getColorRes());
    helper.setText(R.id.tv_theme_name, themeColor.getDisplayName());
    helper.setTextColor(R.id.tv_theme_name, primaryColor);

    if (selectedTheme != null && themeColor.getIdentifyName().equals(selectedTheme.getIdentifyName())) {
        helper.setVisible(R.id.civ_checked_bg, true);
        helper.setImageResource(R.id.civ_checked_bg, isDarkTheme ?
                R.color.dark_theme_background : R.color.light_theme_background);
        helper.setVisible(R.id.iv_checked, true);
        helper.setImageDrawable(R.id.iv_checked, ColorUtils.tintDrawable(
                context.getResources().getDrawable(R.drawable.ic_check_circle_black_24dp), primaryColor));
        ((CircleImageView) helper.getView(R.id.civ_selected)).setFillingCircleColor(primaryColor);
    } else {
        helper.setVisible(R.id.civ_checked_bg, false);
        helper.setVisible(R.id.iv_checked, false);
        ((CircleImageView) helper.getView(R.id.civ_selected)).setFillingCircleColor(Color.LTGRAY);
    }
}
 
Example 2
Source File: TopicTimelineAdapterWithThirdLib.java    From JReadHub with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, RelevantTopicBean relevantTopicBean) {
    LocalDate date = relevantTopicBean.getCreatedAt().toLocalDate();
    int year = date.getYear();
    int month = date.getMonthValue();
    int day = date.getDayOfMonth();
    if (year == OffsetDateTime.now().getYear()) {
        holder.setText(R.id.txt_date, mContext.getString(R.string.month__day, month, day));
    } else {
        SpannableString spannableTitle = SpannableString.valueOf(mContext.getString(R.string.month__day__year, month, day, year));
        spannableTitle.setSpan(new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.text_topic_detail_news_author)),
                spannableTitle.toString().indexOf("\n") + 1,
                spannableTitle.toString().indexOf("\n") + 5,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        holder.setText(R.id.txt_date, spannableTitle);
    }
    holder.setText(R.id.txt_topic_trace_content, relevantTopicBean.getTitle());
    holder.setVisible(R.id.view_top_line, holder.getItemViewType() == VIEW_TYPE_TOP || holder.getItemViewType() == VIEW_TYPE_ONLY_ONE ? false : true);
    holder.setVisible(R.id.view_bottom_line, holder.getItemViewType() == VIEW_TYPE_BOTTOM || holder.getItemViewType() == VIEW_TYPE_ONLY_ONE ? false : true);
}
 
Example 3
Source File: NotificationAdapter.java    From JianshuApp with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, NotificationMenu entity) {
    holder.setTag(R.id.item_root, entity);

    holder.setImageResource(R.id.image_left, entity.icon);
    holder.setText(R.id.txt_head, entity.title);
    if (entity.hasSubtitle()) {
        holder.setVisible(R.id.txt_subhead, true);
        holder.setText(R.id.txt_subhead, entity.subtitle);
    } else {
        holder.setVisible(R.id.txt_subhead, false);
    }

    if (entity.unreadCount > 0) {
        holder.setVisible(R.id.txt_unread_count, true);
        holder.setText(R.id.txt_unread_count, (entity.unreadCount > 99 ? "99+" : String.valueOf(entity.unreadCount)));
    } else {
        holder.setVisible(R.id.txt_unread_count, false);
    }

    holder.setTag(R.id.item_root, holder.getLayoutPosition());
    holder.setOnClickListener(R.id.item_root, this);
}
 
Example 4
Source File: BookAdapter.java    From SmallGdufe-Android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(final BaseViewHolder viewHolder, Book item) {
    viewHolder.setText(R.id.tv_book_bookName,item.getName()+" / "+item.getAuthor())
                .setText(R.id.tv_book_barId,""+item.getBarId())
                .setText(R.id.tv_book_borrowedTime,""+item.getBorrowedTime())
                .setText(R.id.tv_book_returnTime, item.getReturnTime())
                .setText(R.id.tv_book_location, item.getLocation())
                .addOnClickListener(R.id.tv_book_renew)
    ;
    //当前借阅的情况下考虑显示续借按钮和过期书籍的红色字体显示
    if(doWhat == BookActivity.doCurrentBook){
        if(curTime > TimeUtils.timeString2TimeStamp(item.getReturnTime()) ){  //过期书籍
            viewHolder.setTextColor(R.id.tv_book_returnTime, mContext.getResources().getColor(R.color.goal_item_failed_color));
        }else{
            viewHolder.setVisible(R.id.tv_book_renew,item.getRenewTimes() == 0);    //当前借阅且是未到期情况下 续借按钮可见
            viewHolder.setTextColor(R.id.tv_book_returnTime, mContext.getResources().getColor(R.color.normal_item_text_color)); //恢复颜色,不然会显示bug,这个adapter框架的问题
        }
    }else{
        viewHolder.setVisible(R.id.tv_book_renew,false);    //BaseQuickAdapter的bug,还是得手动设置
    }
}
 
Example 5
Source File: RvNoteListAdapter.java    From SuperNote with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 显示是否线性布局时的分组信息
 *
 * @param helper
 * @param isShow 是否显示
 * @param time   时间戳
 * @describe
 */
private void showLineraLayoutGroup(boolean isShow, BaseViewHolder helper, long time) {
    // 有分组的列,marginTop为8dp,否则,为0dp
    LinearLayout ll = helper.getView(R.id.ll_note_list_linear);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) ll.getLayoutParams();
    if (isShow) {
        helper.setVisible(R.id.tv_note_list_linear_month, true);
        setLinearGroupStyle(helper, time);

        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(8), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);

    } else {
        helper.setVisible(R.id.tv_note_list_linear_month, false);
        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);
    }
}
 
Example 6
Source File: RvNoteListAdapter.java    From SuperNote with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 设置线性布局
 *
 * @describe
 */
private void setLinearLayout(BaseViewHolder helper, Note item) {

    helper.addOnClickListener(R.id.ll_note_list_line);
    helper.addOnLongClickListener(R.id.ll_note_list_line);

    // 显示竖排布局,隐藏网格布局
    helper.setVisible(R.id.cv_note_list_grid, false);
    helper.setVisible(R.id.ll_note_list_linear, true);

    TextView tvContent=helper.getView(R.id.tv_note_list_linear_content);
    if(isPrivacyAndRecycle(item))
        helper.setText(R.id.tv_note_list_linear_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
    else
        parseTextContent(tvContent,item.getNoteContent());

    // 设置便签的时间显示
    setNoteTime(helper, item.getModifiedTime());

    // 设置便签的分组显示
    setLinearLayoutGroup(helper, item.getCreatedTime());
    // 设置多选按钮
    setCheckBox(helper);
}
 
Example 7
Source File: RvNoteListAdapter.java    From SuperNote with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 设置网格布局
 *
 * @describe
 */
private void setGridLayout(BaseViewHolder helper, Note item) {

    helper.addOnClickListener(R.id.cv_note_list_grid);
    helper.addOnLongClickListener(R.id.cv_note_list_grid);

    helper.setVisible(R.id.ll_note_list_linear, false);
    helper.setVisible(R.id.cv_note_list_grid, true);

    TextView tvContent=helper.getView(R.id.tv_note_list_grid_content);
    if(isPrivacyAndRecycle(item))
        helper.setText(R.id.tv_note_list_grid_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
    else
        parseTextContent(tvContent,item.getNoteContent());

    // 设置便签的时间显示
    setNoteTime(helper, item.getModifiedTime());
    // 设置多选按钮
    setCheckBox(helper);
}
 
Example 8
Source File: DeviceListFragment.java    From AndroidSDK with MIT License 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, DeviceItem item) {
    //helper.addOnClickListener()
    helper.setText(R.id.title, item.getTitle());
    helper.setText(R.id.id, getResources().getString(R.string.device_id) + ":" + item.getId());
    helper.setText(R.id.protocol, getResources().getString(R.string.device_access_protocol) + ":" + item.getProtocol());
    helper.setText(R.id.create_time, getResources().getString(R.string.create_time) + ":" + item.getCreateTime());
    if ("HTTP".equalsIgnoreCase(item.getProtocol())) {
        helper.setVisible(R.id.online, false);
    } else {
        helper.setVisible(R.id.online, true);
        helper.setText(R.id.online, item.isOnline() ? R.string.online : R.string.offline);
    }
}
 
Example 9
Source File: EssMediaAdapter.java    From FilePicker with MIT License 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, EssFile item) {
    if (item.getItemType() == EssFile.CAPTURE) {
        helper.getView(R.id.media).setVisibility(View.GONE);
        helper.getView(R.id.capture).setVisibility(View.VISIBLE);
        helper.itemView.setLayoutParams(new ViewGroup.LayoutParams(mImageResize- UiUtils.dpToPx(mContext,4), mImageResize));
        helper.addOnClickListener(R.id.capture);
    } else {
        helper.getView(R.id.capture).setVisibility(View.GONE);
        helper.getView(R.id.media).setVisibility(View.VISIBLE);
        helper.itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mImageResize));
        ImageView imageView = helper.getView(R.id.media_thumbnail);
        RequestOptions options = new RequestOptions()
                .centerCrop()
                .override(mImageResize, mImageResize)
                .placeholder(SelectOptions.getInstance().placeHolder == null ? mContext.getResources().getDrawable(R.mipmap.png_holder) : SelectOptions.getInstance().placeHolder);
        Glide
                .with(mContext)
                .load(item.getUri())
                .apply(options)
                .into(imageView);
        if(SelectOptions.getInstance().isSingle || SelectOptions.getInstance().maxCount == 1){
            helper.setVisible(R.id.check_view,false);
        }else {
            AppCompatCheckBox checkBox = helper.getView(R.id.check_view);
            helper.setVisible(R.id.check_view,true);
            helper.addOnClickListener(R.id.check_view);
            helper.addOnClickListener(R.id.media_thumbnail);
            checkBox.setChecked(item.isChecked());
        }
    }

}
 
Example 10
Source File: ModelsPickerAdapter.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, T item) {
    helper.setText(R.id.tv_title, modelsPickerStrategy.getTitle(item));
    helper.setText(R.id.tv_sub_title, modelsPickerStrategy.getSubTitle(item));
    helper.setVisible(R.id.iv_more, modelsPickerStrategy.shouldShowMore());
    helper.setImageDrawable(R.id.iv_icon, modelsPickerStrategy.getIconDrawable(item));
    if (modelsPickerStrategy.isMultiple() && item.isSelected()) {
        helper.itemView.setBackgroundColor(getSelectedColor());
    } else {
        helper.itemView.setBackgroundColor(Color.TRANSPARENT);
    }
}
 
Example 11
Source File: EssMediaAdapter.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, EssFile item) {
    if (item.getItemType() == EssFile.CAPTURE) {
        helper.getView(R.id.media).setVisibility(View.GONE);
        helper.getView(R.id.capture).setVisibility(View.VISIBLE);
        helper.itemView.setLayoutParams(new ViewGroup.LayoutParams(mImageResize- UiUtils.dpToPx(mContext,4), mImageResize));
        helper.addOnClickListener(R.id.capture);
    } else {
        helper.getView(R.id.capture).setVisibility(View.GONE);
        helper.getView(R.id.media).setVisibility(View.VISIBLE);
        helper.itemView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mImageResize));
        ImageView imageView = helper.getView(R.id.media_thumbnail);
        RequestOptions options = new RequestOptions()
                .centerCrop()
                .override(mImageResize, mImageResize)
                .placeholder(SelectOptions.getInstance().placeHolder == null ? mContext.getResources().getDrawable(R.mipmap.png_holder) : SelectOptions.getInstance().placeHolder);
        Glide
                .with(mContext)
                .load(item.getUri())
                .apply(options)
                .into(imageView);
        if(SelectOptions.getInstance().isSingle || SelectOptions.getInstance().maxCount == 1){
            helper.setVisible(R.id.check_view,false);
        }else {
            AppCompatCheckBox checkBox = helper.getView(R.id.check_view);
            helper.setVisible(R.id.check_view,true);
            helper.addOnClickListener(R.id.check_view);
            helper.addOnClickListener(R.id.media_thumbnail);
            checkBox.setChecked(item.isChecked());
        }
    }

}
 
Example 12
Source File: LoadMoreView.java    From demo4Fish with MIT License 4 votes vote down vote up
private void visibleLoadFail(BaseViewHolder holder, boolean visible) {
    holder.setVisible(getLoadFailViewId(), visible);
}
 
Example 13
Source File: SubscriptionAdapter.java    From JianshuApp with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, SubscriptionListEntity.Subscription entity) {
    View itemView = holder.getConvertView();
    itemView.setTag(entity);
    itemView.setOnClickListener(this);
    if (entity.getSubscriptionType() == null || entity.getSubscriptionType() == SubscriptionType.notebook) {
        itemView.setLongClickable(false);
    } else {
        itemView.setLongClickable(true);
        final String userId = entity.getSource_identity().split(":")[0];
        itemView.setOnLongClickListener(v -> {
            showAddToDesktop(entity.getSubscriptionType(), userId, entity.getImage(), entity.getName());
            return true;
        });
    }


    TextView tvName = holder.getView(R.id.tv_name);
    tvName.setMaxWidth(DisplayInfo.getWidthPixels() / 2);

    holder.setText(R.id.tv_name, entity.getName());
    holder.setText(R.id.tv_desc, entity.getNewNoteTitle());

    // 未读数
    int unreadCount = entity.getUnreadCount();
    if (unreadCount == 0) {
        holder.setVisible(R.id.tv_unread, false);
        holder.setVisible(R.id.tv_notify, false);
    } else {
        holder.setVisible(R.id.tv_unread, true);
        holder.setVisible(R.id.tv_notify, true);

        String txt = unreadCount > 99 ? "99+" : String.valueOf(unreadCount);
        holder.setText(R.id.tv_unread, String.format(AppUtils.getContext().getString(R.string.count_article_update), txt));
    }


    UniversalDraweeView icon = holder.getView(R.id.avatar);
    SubscriptionType subscriptionType = entity.getSubscriptionType();
    if (subscriptionType != null) {
        switch (subscriptionType) {
            case user:
                icon.setCircle(true);
                icon.setImageURI(entity.getImage());
                break;
            case notebook:
                icon.setCircle(false);
                icon.setCornerRadiusRes(R.dimen.dp_4);
                icon.setImageURI(ImageUtils.parseUri(R.drawable.wj_image));
                break;
            default:
                icon.setCircle(false);
                icon.setCornerRadiusRes(R.dimen.dp_4);
                icon.setImageURI(entity.getImage());
                break;
        }
    }
}
 
Example 14
Source File: BookCoverAdapter.java    From AccountBook with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, BookCover item) {
    ImageLoader.getIns(mContext).load(UiUtils.getImageResIdByName(item.cover)
            , (ImageView) helper.getView(R.id.img_cover));
    helper.setVisible(R.id.img_select, item.isSelect);
}
 
Example 15
Source File: LoadMoreView.java    From demo4Fish with MIT License 4 votes vote down vote up
private void visibleLoadEnd(BaseViewHolder holder, boolean visible) {
    final int loadEndViewId=getLoadEndViewId();
    if (loadEndViewId != 0) {
        holder.setVisible(loadEndViewId, visible);
    }
}
 
Example 16
Source File: DownloadVideoAdapter.java    From v9porn with MIT License 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, V9PornItem item) {
    helper.setText(R.id.tv_91porn_item_title, item.getTitleWithDuration());
    ImageView simpleDraweeView = helper.getView(R.id.iv_91porn_item_img);
    Uri uri = Uri.parse(item.getImgUrl());
    GlideApp.with(helper.itemView).load(uri).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(simpleDraweeView);
    helper.setProgress(R.id.progressBar_download, item.getProgress());
    helper.setText(R.id.tv_download_progress, String.valueOf(item.getProgress()) + "%");
    helper.setText(R.id.tv_download_filesize, Formatter.formatFileSize(helper.itemView.getContext(), item.getSoFarBytes()).replace("MB", "") + "/ " + Formatter.formatFileSize(helper.itemView.getContext(), item.getTotalFarBytes()));
    if (item.getStatus() == FileDownloadStatus.completed) {
        helper.setText(R.id.tv_download_speed, "已完成");
        helper.setVisible(R.id.iv_download_control, false);
    } else {
        //未下载完成,显示控制
        helper.setVisible(R.id.iv_download_control, true);
        if (FileDownloader.getImpl().isServiceConnected()) {
            helper.setImageResource(R.id.iv_download_control, R.drawable.pause_download);
            if (item.getStatus() == FileDownloadStatus.progress) {
                helper.setText(R.id.tv_download_speed, item.getSpeed() + " KB/s");
            } else if (item.getStatus() == FileDownloadStatus.paused) {
                helper.setText(R.id.tv_download_speed, "暂停中");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            } else if (item.getStatus() == FileDownloadStatus.pending) {
                helper.setText(R.id.tv_download_speed, "准备中");
            } else if (item.getStatus() == FileDownloadStatus.started) {
                helper.setText(R.id.tv_download_speed, "开始下载");
            } else if (item.getStatus() == FileDownloadStatus.connected) {
                helper.setText(R.id.tv_download_speed, "连接中");
            } else if (item.getStatus() == FileDownloadStatus.error) {
                helper.setText(R.id.tv_download_speed, "下载错误");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            } else if (item.getStatus() == FileDownloadStatus.retry) {
                helper.setText(R.id.tv_download_speed, "重试中");
            } else if (item.getStatus() == FileDownloadStatus.warn) {
                helper.setText(R.id.tv_download_speed, "警告");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            }

        } else {
            helper.setText(R.id.tv_download_speed, "暂停中");
            helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
        }
    }
    helper.addOnClickListener(R.id.iv_download_control);
    helper.addOnClickListener(R.id.right_menu_delete);
}
 
Example 17
Source File: LoadMoreView.java    From demo4Fish with MIT License 4 votes vote down vote up
private void visibleLoading(BaseViewHolder holder, boolean visible) {
    holder.setVisible(getLoadingViewId(), visible);
}
 
Example 18
Source File: DownloadVideoAdapter.java    From v9porn with MIT License 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, V9PornItem item) {
    helper.setText(R.id.tv_91porn_item_title, item.getTitleWithDuration());
    ImageView simpleDraweeView = helper.getView(R.id.iv_91porn_item_img);
    Uri uri = Uri.parse(item.getImgUrl());
    GlideApp.with(helper.itemView).load(uri).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(simpleDraweeView);
    helper.setProgress(R.id.progressBar_download, item.getProgress());
    helper.setText(R.id.tv_download_progress, String.valueOf(item.getProgress()) + "%");
    helper.setText(R.id.tv_download_filesize, Formatter.formatFileSize(helper.itemView.getContext(), item.getSoFarBytes()).replace("MB", "") + "/ " + Formatter.formatFileSize(helper.itemView.getContext(), item.getTotalFarBytes()));
    if (item.getStatus() == FileDownloadStatus.completed) {
        helper.setText(R.id.tv_download_speed, "已完成");
        helper.setVisible(R.id.iv_download_control, false);
    } else {
        //未下载完成,显示控制
        helper.setVisible(R.id.iv_download_control, true);
        if (FileDownloader.getImpl().isServiceConnected()) {
            helper.setImageResource(R.id.iv_download_control, R.drawable.pause_download);
            if (item.getStatus() == FileDownloadStatus.progress) {
                helper.setText(R.id.tv_download_speed, item.getSpeed() + " KB/s");
            } else if (item.getStatus() == FileDownloadStatus.paused) {
                helper.setText(R.id.tv_download_speed, "暂停中");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            } else if (item.getStatus() == FileDownloadStatus.pending) {
                helper.setText(R.id.tv_download_speed, "准备中");
            } else if (item.getStatus() == FileDownloadStatus.started) {
                helper.setText(R.id.tv_download_speed, "开始下载");
            } else if (item.getStatus() == FileDownloadStatus.connected) {
                helper.setText(R.id.tv_download_speed, "连接中");
            } else if (item.getStatus() == FileDownloadStatus.error) {
                helper.setText(R.id.tv_download_speed, "下载错误");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            } else if (item.getStatus() == FileDownloadStatus.retry) {
                helper.setText(R.id.tv_download_speed, "重试中");
            } else if (item.getStatus() == FileDownloadStatus.warn) {
                helper.setText(R.id.tv_download_speed, "警告");
                helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
            }

        } else {
            helper.setText(R.id.tv_download_speed, "暂停中");
            helper.setImageResource(R.id.iv_download_control, R.drawable.start_download);
        }
    }
    helper.addOnClickListener(R.id.iv_download_control);
    helper.addOnClickListener(R.id.right_menu_delete);
}
 
Example 19
Source File: FileListAdapter.java    From FilePicker with MIT License 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, EssFile item) {
    TextView textView = helper.getView(R.id.tv_item_file_list_desc);
    if (item.isDirectory()) {
        helper.setVisible(R.id.iv_item_file_select_right, true);
        if(item.getChildFolderCount().equals("加载中")){
            //查找数量
            if(loadFileCountListener!=null){
                loadFileCountListener.onLoadFileCount(helper.getAdapterPosition());
            }
        }
        textView.setText(String.format(mContext.getString(R.string.folder_desc), item.getChildFileCount(),item.getChildFolderCount()));
    } else {
        helper.setVisible(R.id.iv_item_file_select_right, false);
        textView.setText(String.format(mContext.getString(R.string.file_desc), FileUtils.getDateTime(item.getAbsolutePath()), FileSizeUtil.getAutoFileOrFilesSize(item.getFile())));
    }
    helper.setText(R.id.tv_item_file_list, item.getName());
    if(item.isChecked()){
        helper.setVisible(R.id.checkbox_item_file_list,true);
    }else {
        helper.setVisible(R.id.checkbox_item_file_list,false);
    }
    ImageView imageView = helper.getView(R.id.iv_item_file_select_left);
    String fileNameExtension = FileUtils.getExtension(item.getName()).toLowerCase();
    switch (fileNameExtension) {
        case "apk":
            imageView.setImageResource(R.mipmap.apk);
            break;
        case "avi":
            imageView.setImageResource(R.mipmap.avi);
            break;
        case "doc":
        case "docx":
            imageView.setImageResource(R.mipmap.doc);
            break;
        case "exe":
            imageView.setImageResource(R.mipmap.exe);
            break;
        case "flv":
            imageView.setImageResource(R.mipmap.flv);
            break;
        case "gif":
            RequestOptions options = new RequestOptions()
                    .centerCrop()
                    .placeholder(R.mipmap.gif);
            Glide
                    .with(mContext)
                    .load(item.getAbsolutePath())
                    .apply(options)
                    .into(imageView);
            break;
        case "jpg":
        case "jpeg":
        case "png":
            RequestOptions options2 = new RequestOptions()
                    .centerCrop()
                    .placeholder(R.mipmap.png);
            Glide
                    .with(mContext)
                    .load(item.getAbsolutePath())
                    .apply(options2)
                    .into(imageView);
            break;
        case "mp3":
            imageView.setImageResource(R.mipmap.mp3);
            break;
        case "mp4":
        case "f4v":
            imageView.setImageResource(R.mipmap.movie);
            break;
        case "pdf":
            imageView.setImageResource(R.mipmap.pdf);
            break;
        case "ppt":
        case "pptx":
            imageView.setImageResource(R.mipmap.ppt);
            break;
        case "wav":
            imageView.setImageResource(R.mipmap.wav);
            break;
        case "xls":
        case "xlsx":
            imageView.setImageResource(R.mipmap.xls);
            break;
        case "zip":
            imageView.setImageResource(R.mipmap.zip);
            break;
        case "ext":
        default:
            if (item.isDirectory()) {
                imageView.setImageResource(R.mipmap.folder);
            } else {
                imageView.setImageResource(R.mipmap.documents);
            }
            break;
    }
}