当前位置: 首页>>代码示例>>Java>>正文


Java FormatUtils类代码示例

本文整理汇总了Java中com.justwayward.reader.utils.FormatUtils的典型用法代码示例。如果您正苦于以下问题:Java FormatUtils类的具体用法?Java FormatUtils怎么用?Java FormatUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FormatUtils类属于com.justwayward.reader.utils包,在下文中一共展示了FormatUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRecentReadingTime

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
/**
 * 设置最近阅读时间
 *
 * @param bookId
 */
public void setRecentReadingTime(String bookId) {
    List<Recommend.RecommendBooks> list = getCollectionList();
    if (list == null) {
        return;
    }
    for (Recommend.RecommendBooks bean : list) {
        if (TextUtils.equals(bean._id, bookId)) {
            bean.recentReadingTime = FormatUtils.getCurrentTimeString(FormatUtils.FORMAT_DATE_TIME);
            list.remove(bean);
            list.add(bean);
            putCollectionList(list);
            break;
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CollectionsManager.java

示例2: OnCreateViewHolder

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
    return new BaseViewHolder<HotReview.Reviews>(parent, R.layout.item_book_detai_hot_review_list) {
        @Override
        public void setData(HotReview.Reviews item) {
            if (!SettingManager.getInstance().isNoneCover()) {
                holder.setCircleImageUrl(R.id.ivBookCover, Constant.IMG_BASE_URL + item.author.avatar,
                        R.drawable.avatar_default);
            } else {
                holder.setImageResource(R.id.ivBookCover, R.drawable.avatar_default);
            }

            holder.setText(R.id.tvBookTitle, item.author.nickname)
                    .setText(R.id.tvBookType, String.format(mContext.getString(R.string
                            .book_detail_user_lv), item.author.lv))
                    .setText(R.id.tvTime, FormatUtils.getDescriptionTimeFromDateString(item.created))
                    .setText(R.id.tvTitle, item.title)
                    .setText(R.id.tvContent, String.valueOf(item.content))
                    .setText(R.id.tvHelpfulYes, String.valueOf(item.helpful.yes));
            holder.setVisible(R.id.tvTime, true);
            XLHRatingBar ratingBar = holder.getView(R.id.rating);
            ratingBar.setCountSelected(item.rating);
        }
    };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:BookDetailReviewAdapter.java

示例3: OnCreateViewHolder

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
    return new BaseViewHolder<CommentList.CommentsBean>(parent, R.layout.item_comment_list) {
        @Override
        public void setData(CommentList.CommentsBean item) {
            if (!SettingManager.getInstance().isNoneCover()) {
                holder.setCircleImageUrl(R.id.ivBookCover, Constant.IMG_BASE_URL + item.author.avatar,
                        R.drawable.avatar_default);
            } else {
                holder.setImageResource(R.id.ivBookCover, R.drawable.avatar_default);
            }

            holder.setText(R.id.tvBookTitle, item.author.nickname)
                    .setText(R.id.tvContent, item.content)
                    .setText(R.id.tvBookType, String.format(mContext.getString(R.string.book_detail_user_lv), item.author.lv))
                    .setText(R.id.tvFloor, String.format(mContext.getString(R.string.comment_floor), item.floor))
                    .setText(R.id.tvTime, FormatUtils.getDescriptionTimeFromDateString(item.created));

            if (item.replyTo == null) {
                holder.setVisible(R.id.tvReplyNickName, false);
                holder.setVisible(R.id.tvReplyFloor, false);
            } else {
                holder.setText(R.id.tvReplyNickName, String.format(mContext.getString(R.string.comment_reply_nickname), item.replyTo.author.nickname))
                        .setText(R.id.tvReplyFloor, String.format(mContext.getString(R.string.comment_reply_floor), item.replyTo.floor));
                holder.setVisible(R.id.tvReplyNickName, true);
                holder.setVisible(R.id.tvReplyFloor, true);
            }
        }
    };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:CommentListAdapter.java

示例4: OnCreateViewHolder

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
    return new BaseViewHolder<BookReviewList.ReviewsBean>(parent, R.layout.item_community_book_review_list) {
        @Override
        public void setData(BookReviewList.ReviewsBean item) {
            if (!SettingManager.getInstance().isNoneCover()) {
                holder.setRoundImageUrl(R.id.ivBookCover, Constant.IMG_BASE_URL + item.book.cover,
                        R.drawable.cover_default);
            } else {
                holder.setImageResource(R.id.ivBookCover, R.drawable.cover_default);
            }

            holder.setText(R.id.tvBookTitle, item.book.title)
                    .setText(R.id.tvBookType, String.format(mContext.getString(R.string.book_review_book_type), Constant.bookType.get(item.book.type)))
                    .setText(R.id.tvTitle, item.title)
                    .setText(R.id.tvHelpfulYes, String.format(mContext.getString(R.string.book_review_helpful_yes), item.helpful.yes));

            if (TextUtils.equals(item.state, "hot")) {
                holder.setVisible(R.id.tvHot, true);
                holder.setVisible(R.id.tvTime, false);
                holder.setVisible(R.id.tvDistillate, false);
            } else if (TextUtils.equals(item.state, "distillate")) {
                holder.setVisible(R.id.tvDistillate, true);
                holder.setVisible(R.id.tvHot, false);
                holder.setVisible(R.id.tvTime, false);
            } else {
                holder.setVisible(R.id.tvTime, true);
                holder.setVisible(R.id.tvHot, false);
                holder.setVisible(R.id.tvDistillate, false);
                holder.setText(R.id.tvTime, FormatUtils.getDescriptionTimeFromDateString(item.created));
            }
        }
    };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:BookReviewAdapter.java

示例5: OnCreateViewHolder

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
    return new BaseViewHolder<BookHelpList.HelpsBean>(parent, R.layout.item_community_book_help_list) {
        @Override
        public void setData(BookHelpList.HelpsBean item) {
            if (!SettingManager.getInstance().isNoneCover()) {
                holder.setCircleImageUrl(R.id.ivBookCover, Constant.IMG_BASE_URL + item.author.avatar,
                        R.drawable.avatar_default);
            } else {
                holder.setImageResource(R.id.ivBookCover, R.drawable.avatar_default);
            }

            holder.setText(R.id.tvBookType, String.format(mContext.getString(R.string
                    .book_detail_user_lv), item.author.lv))
                    .setText(R.id.tvTitle, item.title)
                    .setText(R.id.tvHelpfulYes, item.commentCount + "");

            if (TextUtils.equals(item.state, "hot")) {
                holder.setVisible(R.id.tvHot, true);
                holder.setVisible(R.id.tvTime, false);
                holder.setVisible(R.id.tvDistillate, false);
            } else if (TextUtils.equals(item.state, "distillate")) {
                holder.setVisible(R.id.tvDistillate, true);
                holder.setVisible(R.id.tvHot, false);
                holder.setVisible(R.id.tvTime, false);
            } else {
                holder.setVisible(R.id.tvTime, true);
                holder.setVisible(R.id.tvHot, false);
                holder.setVisible(R.id.tvDistillate, false);
                holder.setText(R.id.tvTime, FormatUtils.getDescriptionTimeFromDateString(item.created));
            }
        }
    };
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:BookHelpAdapter.java

示例6: showBookDetail

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public void showBookDetail(BookDetail data) {
    Glide.with(mContext)
            .load(Constant.IMG_BASE_URL + data.cover)
            .placeholder(R.drawable.cover_default)
            .transform(new GlideRoundTransform(mContext))
            .into(mIvBookCover);

    mTvBookTitle.setText(data.title);
    mTvAuthor.setText(String.format(getString(R.string.book_detail_author), data.author));
    mTvCatgory.setText(String.format(getString(R.string.book_detail_category), data.cat));
    mTvWordCount.setText(FormatUtils.formatWordCount(data.wordCount));
    mTvLatelyUpdate.setText(FormatUtils.getDescriptionTimeFromDateString(data.updated));
    mTvLatelyFollower.setText(String.valueOf(data.latelyFollower));
    mTvRetentionRatio.setText(TextUtils.isEmpty(data.retentionRatio) ?
            "-" : String.format(getString(R.string.book_detail_retention_ratio),
            data.retentionRatio));
    mTvSerializeWordCount.setText(data.serializeWordCount < 0 ? "-" :
            String.valueOf(data.serializeWordCount));

    tagList.clear();
    tagList.addAll(data.tags);
    times = 0;
    showHotWord();

    mTvlongIntro.setText(data.longIntro);
    mTvCommunity.setText(String.format(getString(R.string.book_detail_community), data.title));
    mTvPostCount.setText(String.format(getString(R.string.book_detail_post_count), data.postCount));

    recommendBooks = new Recommend.RecommendBooks();
    recommendBooks.title = data.title;
    recommendBooks._id = data._id;
    recommendBooks.cover = data.cover;
    recommendBooks.lastChapter = data.lastChapter;
    recommendBooks.updated = data.updated;

    refreshCollectionIcon();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:BookDetailActivity.java

示例7: showBookHelpDetail

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public void showBookHelpDetail(BookHelp data) {
    Glide.with(mContext).load(Constant.IMG_BASE_URL + data.help.author.avatar)
            .placeholder(R.drawable.avatar_default)
            .transform(new GlideCircleTransform(mContext))
            .into(headerViewHolder.ivAvatar);

    headerViewHolder.tvNickName.setText(data.help.author.nickname);
    headerViewHolder.tvTime.setText(FormatUtils.getDescriptionTimeFromDateString(data.help.created));
    headerViewHolder.tvTitle.setText(data.help.title);
    headerViewHolder.tvContent.setText(data.help.content);
    headerViewHolder.tvCommentCount.setText(String.format(mContext.getString(R.string.comment_comment_count), data.help.commentCount));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:BookHelpDetailActivity.java

示例8: showBookDisscussionDetail

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public void showBookDisscussionDetail(Disscussion disscussion) {
    Glide.with(mContext)
            .load(Constant.IMG_BASE_URL + disscussion.post.author.avatar)
            .placeholder(R.drawable.avatar_default)
            .transform(new GlideCircleTransform(mContext))
            .into(headerViewHolder.ivAvatar);

    headerViewHolder.tvNickName.setText(disscussion.post.author.nickname);
    headerViewHolder.tvTime.setText(FormatUtils.getDescriptionTimeFromDateString(disscussion.post.created));
    headerViewHolder.tvTitle.setText(disscussion.post.title);
    headerViewHolder.tvContent.setText(disscussion.post.content);
    headerViewHolder.tvCommentCount.setText(String.format(mContext.getString(R.string.comment_comment_count), disscussion.post.commentCount));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:BookDiscussionDetailActivity.java

示例9: showBookReviewDetail

import com.justwayward.reader.utils.FormatUtils; //导入依赖的package包/类
@Override
public void showBookReviewDetail(final BookReview data) {
    Glide.with(mContext)
            .load(Constant.IMG_BASE_URL + data.review.author.avatar)
            .placeholder(R.drawable.avatar_default)
            .transform(new GlideCircleTransform(mContext))
            .into(headerViewHolder.ivAuthorAvatar);

    headerViewHolder.tvBookAuthor.setText(data.review.author.nickname);
    headerViewHolder.tvTime.setText(FormatUtils.getDescriptionTimeFromDateString(data.review.created));
    headerViewHolder.tvTitle.setText(data.review.title);
    headerViewHolder.tvContent.setText(data.review.content);

    Glide.with(mContext)
            .load(Constant.IMG_BASE_URL + data.review.book.cover)
            .placeholder(R.drawable.cover_default)
            .transform(new GlideRoundTransform(mContext))
            .into(headerViewHolder.ivBookCover);
    headerViewHolder.tvBookTitle.setText(data.review.book.title);

    headerViewHolder.tvHelpfullYesCount.setText(String.valueOf(data.review.helpful.yes));
    headerViewHolder.tvHelpfullNoCount.setText(String.valueOf(data.review.helpful.no));

    headerViewHolder.tvCommentCount.setText(String.format(mContext.getString(R.string.comment_comment_count), data.review.commentCount));

    headerViewHolder.rlBookInfo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            BookDetailActivity.startActivity(BookReviewDetailActivity.this, data.review.book._id);
        }
    });

    headerViewHolder.ratingBar.setCountSelected(data.review.rating);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:BookReviewDetailActivity.java


注:本文中的com.justwayward.reader.utils.FormatUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。