當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。