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

The following examples show how to use com.chad.library.adapter.base.BaseViewHolder#setImageResource() . 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: FeedCategoryRightAdapter.java    From Focus with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(final BaseViewHolder helper, Website item) {
    helper.setText(R.id.name,item.getName());
    if (StringUtil.trim(item.getDesc()).equals("")){
        helper.setGone(R.id.desc,false);
    }else {
        helper.setGone(R.id.desc,true);
        helper.setText(R.id.desc,item.getDesc());
    }

    if (StringUtil.trim(item.getIcon()).equals("")){
        helper.setImageResource(R.id.icon,R.drawable.ic_rss_feed_grey_24dp);
    }else {
        ALog.d("ico图片地址"+item.getIcon());

        ImageLoader.getInstance().displayImage(StringUtil.trim(String.valueOf(item.getIcon())), (ImageView) helper.getView(R.id.icon),ImageLoaderManager.getSubsciptionIconOptions(activity));


    }


}
 
Example 2
Source File: FeedCategoryRightAdapter.java    From Focus with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void convert(final BaseViewHolder helper, Website item) {
    helper.setText(R.id.name,item.getName());
    if (StringUtil.trim(item.getDesc()).equals("")){
        helper.setGone(R.id.desc,false);
    }else {
        helper.setGone(R.id.desc,true);
        helper.setText(R.id.desc,item.getDesc());
    }

    if (StringUtil.trim(item.getIcon()).equals("")){
        helper.setImageResource(R.id.icon,R.drawable.ic_rss_feed_grey_24dp);
    }else {
        ALog.d("ico图片地址"+item.getIcon());

        ImageLoader.getInstance().displayImage(StringUtil.trim(String.valueOf(item.getIcon())), (ImageView) helper.getView(R.id.icon),ImageLoaderManager.getSubsciptionIconOptions(activity));


    }


}
 
Example 3
Source File: ProjectsAdapter.java    From WanAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, Article article) {
    if(article == null) return;

        holder.setText(R.id.tv_title, Html.fromHtml(article.getTitle()))
                .setText(R.id.tv_details, article.getDesc())
                .setText(R.id.tv_author, "作者:" + article.getAuthor())
                .setText(R.id.tv_publish_time, article.getNiceDate())
                .addOnClickListener(R.id.iv_collection);

    ImageUtil.loadImage(mContext, (ImageView)holder.getView(R.id.iv_image), article.getEnvelopePic());

    if(article.isCollect()){
        holder.setImageDrawable(
                R.id.iv_collection,
                CommonUtil.getTintDrawable(
                        Objects.requireNonNull(ContextCompat.getDrawable(mContext, R.drawable.ic_home_collection)),
                        ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.colorCollected))
                )
        );
    }
    else{
        holder.setImageResource(R.id.iv_collection, R.drawable.ic_home_collection);
    }
}
 
Example 4
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 5
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 6
Source File: FeedListManageAdapter.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Feed item) {
    helper.setText(R.id.title,item.getName());
    //TODO:如果有自己ico图标,则显示ico图标
    helper.setImageResource(R.id.main_logo,R.drawable.ic_rss_feed_grey_24dp);

    helper.setText(R.id.not_read_num,item.getUnreadNum() + "");

    initListener(helper,item);

}
 
Example 7
Source File: FeedListAdapter.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Feed item) {
    helper.setText(R.id.name,item.getName());
    helper.setText(R.id.desc,item.getDesc());
    if (!StringUtil.trim(item.getIcon()).equals("")){//显示图标
        ImageLoader.getInstance().displayImage(StringUtil.trim(String.valueOf(item.getIcon())), (ImageView) helper.getView(R.id.account_avatar),ImageLoaderManager.getSubsciptionIconOptions(activity));
    }else {
        helper.setImageResource(R.id.account_avatar,R.drawable.ic_rss_feed_grey_24dp);
    }
}
 
Example 8
Source File: FirstHomeAdapter.java    From MeiBaseModule with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Article item) {
    // 把每个图片视图设置不同的Transition名称, 防止在一个视图内有多个相同的名称, 在变换的时候造成混乱
    // Fragment支持多个View进行变换, 使用适配器时, 需要加以区分
    ViewCompat.setTransitionName(helper.getView(R.id.img), String.valueOf(helper
            .getAdapterPosition()) + "_image");
    ViewCompat.setTransitionName(helper.getView(R.id.tv_title), String.valueOf(helper
            .getAdapterPosition()) + "_tv");

    helper.setImageResource(R.id.img, item.getImgRes());
    helper.setText(R.id.tv_title, item.getTitle());
}
 
Example 9
Source File: FeedListAdapter.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Feed item) {
    helper.setText(R.id.name,item.getName());
    helper.setText(R.id.desc,item.getDesc());
    if (!StringUtil.trim(item.getIcon()).equals("")){//显示图标
        ImageLoader.getInstance().displayImage(StringUtil.trim(String.valueOf(item.getIcon())), (ImageView) helper.getView(R.id.account_avatar),ImageLoaderManager.getSubsciptionIconOptions(activity));
    }else {
        helper.setImageResource(R.id.account_avatar,R.drawable.ic_rss_feed_grey_24dp);
    }
}
 
Example 10
Source File: ArticlesAdapter.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder holder, Article article) {
    if(article == null) return;

    holder.setText(R.id.tv_title, Html.fromHtml(article.getTitle()))
            .setText(R.id.tv_author, "作者:" + article.getAuthor())
            .setText(R.id.tv_classify, "分类:" + article.getChapterName())
            .setText(R.id.tv_publish_time, article.getNiceDate())
            .addOnClickListener(R.id.iv_collection);

    if(article.isCollect()){
        holder.setImageDrawable(
                R.id.iv_collection,
                CommonUtil.getTintDrawable(
                        Objects.requireNonNull(ContextCompat.getDrawable(mContext, R.drawable.ic_home_collection)),
                        ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.colorCollected))
                )
        );
    } else{
        holder.setImageResource(R.id.iv_collection, R.drawable.ic_home_collection);
    }

    TextView textView = holder.getView(R.id.tv_tags);
    textView.setVisibility(View.VISIBLE);
    if(article.isFresh()){
        Drawable freshDrawable = ContextCompat.getDrawable(mContext, R.drawable.bg_tag_tv1);
        ViewCompat.setBackground(textView, freshDrawable);
        textView.setText("最新");
        textView.setTextColor(ContextCompat.getColor(mContext, R.color.colorTag1));
    }else if(!CommonUtil.isEmptyList(article.getTags())){
        Drawable tagDrawable = ContextCompat.getDrawable(mContext, R.drawable.bg_tag_tv2);
        ViewCompat.setBackground(textView, tagDrawable);
        textView.setText(article.getTags().get(0).getName());
        textView.setTextColor(ContextCompat.getColor(mContext, R.color.colorTag2));
    }else {
        textView.setVisibility(View.INVISIBLE);
    }
}
 
Example 11
Source File: CategoriesAdapter.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Category category) {
    final int categoryColor = category.getColor();

    if (isDarkTheme) helper.itemView.setBackgroundResource(R.color.dark_theme_background);

    helper.setText(R.id.tv_title, category.getName());
    helper.setText(R.id.tv_sub_title, context.getResources().getQuantityString(R.plurals.assignments_number, category.getCount(), category.getCount()));

    ((CircleImageView) helper.getView(R.id.iv_folder_background)).setFillingCircleColor(categoryColor);

    helper.addOnClickListener(R.id.iv_more);
    helper.setImageResource(R.id.iv_folder_portrait, category.getPortrait().iconRes);
}
 
Example 12
Source File: TimeLinesAdapter.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, TimeLine timeLine) {
    helper.setText(R.id.tv, getOperation(timeLine));
    helper.setImageResource(R.id.iv_operation, timeLine.getModelType().drawableRes);
    ((CircleImageView) helper.getView(R.id.civ)).setFillingCircleColor(
            UserPreferences.getInstance().getTimeLineColor(timeLine.getOperation()));
    helper.setText(R.id.tv_date, TimeUtils.getShortDate(context, timeLine.getAddedTime()));
    helper.setText(R.id.tv_time, TimeUtils.shortTime(timeLine.getAddedTime()));
    helper.setText(R.id.tv_sub, timeLine.getModelName());
    helper.setTextColor(R.id.tv_sub, ColorUtils.accentColor());
    ((Timeline) helper.getView(R.id.timeLine)).setAtomDrawable(atomDrawable());
}
 
Example 13
Source File: GankIoDayAdapter.java    From YiZhi with Apache License 2.0 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, GankIoDayItemBean item) {
    helper.setText(R.id.tv_type_item_title, item.getType());
    helper.setText(R.id.tv_item_title, item.getDesc());

    switch (item.getType()) {
        case "福利":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable
                    .ic_vector_title_welfare);
            Glide.with(mContext).load(item.getUrl()).crossFade().into((ImageView) helper
                    .getView(R.id.iv_item_title));
            break;
        case "Android":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable
                    .ic_vector_title_android);
            helper.setImageResource(R.id.iv_item_title, mResAndroid[mAndroidIndex % 6]);
            break;
        case "iOS":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_ios);
            helper.setImageResource(R.id.iv_item_title, mResIOS[mIOSIndex % 3]);
            break;
        case "前端":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_front);
            helper.setImageResource(R.id.iv_item_title, R.mipmap.gank_io_day_item_web);
            break;
        case "休息视频":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_video);
            helper.setImageResource(R.id.iv_item_title, R.mipmap.gank_io_day_item_video);
            break;
        case "瞎推荐":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuijian);
            break;
        case "拓展资源":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuozhan);
            break;
        case "App":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_app);
            break;
    }

    switch (helper.getItemViewType()) {
        case GankIoDayItemBean.GANK_IO_DAY_ITEM_DAY_NORMAL:
            helper.addOnClickListener(R.id.ll_more);
            break;
        case GankIoDayItemBean.GANK_IO_DAY_ITEM_DAY_REFESH:
            helper.addOnClickListener(R.id.ll_more).addOnClickListener(R.id.ll_refesh);
            break;
        default:
            break;
    }

    //GankIo 返回数据中,很多没有images,这里不用GankIo的图,直接写死
    //        if(item.getImages() == null)
    //            return;
    //
    //        Glide.with(mContext).load(item.getImages().get(0)).crossFade().into((ImageView)
    // helper.getView(R.id.iv_item_title));
}
 
Example 14
Source File: TextImgItemProvider.java    From AndroidQuick with MIT License 4 votes vote down vote up
@Override
public void convert(BaseViewHolder helper, CBean data, int position) {
    helper.setText(R.id.tv_text, data.getText());
    helper.setImageResource(R.id.iv_img, R.mipmap.ic_launcher);
}
 
Example 15
Source File: ImgItemProvider.java    From AndroidQuick with MIT License 4 votes vote down vote up
@Override
public void convert(BaseViewHolder helper, CBean data, int position) {
    helper.addOnClickListener(R.id.iv_img);
    helper.setImageResource(R.id.iv_img, R.mipmap.ic_launcher);
}
 
Example 16
Source File: TodayAdapter.java    From OmniList with GNU Affero General Public License v3.0 4 votes vote down vote up
private void convertAssignment(BaseViewHolder helper, Assignment assignment) {
    helper.itemView.setBackgroundColor(PalmApp.getColorCompact(ColorUtils.isDarkTheme() ?
            R.color.dark_theme_background : R.color.light_theme_background));

    helper.setText(R.id.tv_title, assignment.getName());

    updateUIByCompletedState(helper, assignment);

    helper.addOnClickListener(R.id.iv_completed);
    helper.addOnClickListener(R.id.rl_item);

    helper.setImageResource(R.id.iv_priority, assignment.getPriority().iconRes);

    String strCreatedTime = mContext.getString(R.string.text_last_modified_time) + ": " + TimeUtils.getPrettyTime(assignment.getLastModifiedTime());
    helper.setText(R.id.tv_time_info, strCreatedTime);

    helper.getView(R.id.iv_files).setVisibility(assignment.getAttachments() != 0 ? View.VISIBLE : View.GONE);
    helper.getView(R.id.iv_alarm).setVisibility(assignment.getAlarms() != 0 ? View.VISIBLE : View.GONE);
}
 
Example 17
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 18
Source File: PupList.java    From HaiNaBaiChuan with Apache License 2.0 4 votes vote down vote up
@Override
        protected void convert(BaseViewHolder baseViewHolder, PopupItem popupItem) {
//            MaterialRippleHelper.ripple(baseViewHolder.getConvertView());
            baseViewHolder.setImageResource(R.id.imgMark, popupItem.getImgRes());
            baseViewHolder.setText(R.id.tvItem, popupItem.getName());
        }
 
Example 19
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 20
Source File: TransactionsAdapter.java    From Upchain-wallet with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Transaction transaction) {
    LogUtils.d(TAG, "convert: helper:" + helper + ", transaction:" + transaction);

    boolean isSent = transaction.from.toLowerCase().equals(defaultAddress.toLowerCase());
    boolean isCreateContract = TextUtils.isEmpty(transaction.to);

    if (isSent) {
        if (isCreateContract) {
            helper.setText(R.id.type, R.string.create);
        } else {
            helper.setText(R.id.type, R.string.sent);
        }
    }
    else {
        helper.setText(R.id.type, R.string.received);
    }


    if (!TextUtils.isEmpty(transaction.error)) {
        helper.setImageResource(R.id.type_icon, R.drawable.ic_error_outline_black_24dp);
    } else if (isSent) {
        helper.setImageResource(R.id.type_icon, R.drawable.ic_arrow_upward_black_24dp);
    } else {
        helper.setImageResource(R.id.type_icon, R.drawable.ic_arrow_downward_black_24dp);
    }

    if (isCreateContract) {
        helper.setText(R.id.address, transaction.contract);
    } else {
        helper.setText(R.id.address, isSent ? transaction.to : transaction.from);
    }


    helper.setTextColor(R.id.value, ContextCompat.getColor(mContext, isSent ? R.color.red : R.color.green));


    String valueStr = "";


    // If operations include token transfer, display token transfer instead
    TransactionOperation operation = transaction.operations == null
            || transaction.operations.length == 0 ? null : transaction.operations[0];

    if (operation == null || operation.contract == null) {  // default to ether transaction
        valueStr = transaction.value;

        if (valueStr.equals("0")) {
            valueStr = "0 " + symbol;
        } else {
            valueStr = (isSent ? "-" : "+") +  getScaledValue(valueStr, ETHER_DECIMALS) + " " + symbol;
        }

    } else {
        valueStr = operation.value;

        if (valueStr.equals("0")) {
            valueStr = "0 " + symbol;
        } else {
            valueStr = (isSent ? "-" : "+") +  getScaledValue(valueStr, operation.contract.decimals) + " " + symbol;
        }
    }


    helper.setText(R.id.value, valueStr);


}