com.socks.jiandan.utils.String2TimeUtil Java Examples

The following examples show how to use com.socks.jiandan.utils.String2TimeUtil. 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: FreshNewsDetailFragment.java    From JianDan_OkHttpWithVolley with Apache License 2.0 5 votes vote down vote up
private static String getHtml(FreshNews freshNews, String content) {
    final StringBuilder sb = new StringBuilder();
    sb.append("<!DOCTYPE html>");
    sb.append("<html dir=\"ltr\" lang=\"zh\">");
    sb.append("<head>");
    sb.append("<meta name=\"viewport\" content=\"width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />");
    sb.append("<link rel=\"stylesheet\" href='file:///android_asset/style.css' type=\"text/css\" media=\"screen\" />");
    sb.append("</head>");
    sb.append("<body style=\"padding:0px 8px 8px 8px;\">");
    sb.append("<div id=\"pagewrapper\">");
    sb.append("<div id=\"mainwrapper\" class=\"clearfix\">");
    sb.append("<div id=\"maincontent\">");
    sb.append("<div class=\"post\">");
    sb.append("<div class=\"posthit\">");
    sb.append("<div class=\"postinfo\">");
    sb.append("<h2 class=\"thetitle\">");
    sb.append("<a>");
    sb.append(freshNews.getTitle());
    sb.append("</a>");
    sb.append("</h2>");
    sb.append(freshNews.getAuthor().getName() + " @ " + String2TimeUtil
            .dateString2GoodExperienceFormat(freshNews.getDate()));
    sb.append("</div>");
    sb.append("<div class=\"entry\">");
    sb.append(content);
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</body>");
    sb.append("</html>");
    return sb.toString();
}
 
Example #2
Source File: FreshNewsDetailFragment.java    From JianDan with Apache License 2.0 5 votes vote down vote up
private static String getHtml(FreshNews freshNews, String content) {
    final StringBuilder sb = new StringBuilder();
    sb.append("<!DOCTYPE html>");
    sb.append("<html dir=\"ltr\" lang=\"zh\">");
    sb.append("<head>");
    sb.append("<meta name=\"viewport\" content=\"width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />");
    sb.append("<link rel=\"stylesheet\" href='file:///android_asset/style.css' type=\"text/css\" media=\"screen\" />");
    sb.append("</head>");
    sb.append("<body style=\"padding:0px 8px 8px 8px;\">");
    sb.append("<div id=\"pagewrapper\">");
    sb.append("<div id=\"mainwrapper\" class=\"clearfix\">");
    sb.append("<div id=\"maincontent\">");
    sb.append("<div class=\"post\">");
    sb.append("<div class=\"posthit\">");
    sb.append("<div class=\"postinfo\">");
    sb.append("<h2 class=\"thetitle\">");
    sb.append("<a>");
    sb.append(freshNews.getTitle());
    sb.append("</a>");
    sb.append("</h2>");
    sb.append(freshNews.getAuthor().getName() + " @ " + String2TimeUtil
            .dateString2GoodExperienceFormat(freshNews.getDate()));
    sb.append("</div>");
    sb.append("<div class=\"entry\">");
    sb.append(content);
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</body>");
    sb.append("</html>");
    return sb.toString();
}
 
Example #3
Source File: JokeAdapter.java    From JianDanRxJava with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(final JokeViewHolder holder, final int position) {

    final Joke joke = mJokes.get(position);
    holder.tv_content.setText(joke.getComment_content());
    holder.tv_author.setText(joke.getComment_author());
    holder.tv_time.setText(String2TimeUtil.dateString2GoodExperienceFormat(joke.getComment_date()));
    holder.tv_like.setText(joke.getVote_positive());
    holder.tv_comment_count.setText(joke.getComment_counts());
    holder.tv_unlike.setText(joke.getVote_negative());

    holder.img_share.setOnClickListener(v -> new MaterialDialog.Builder(mActivity)
            .items(R.array.joke_dialog)
            .backgroundColor(mActivity.getResources().getColor(JDApplication.COLOR_OF_DIALOG))
            .contentColor(JDApplication.COLOR_OF_DIALOG_CONTENT)
            .itemsCallback((dialog, view, which, text) -> {
                switch (which) {
                    case 0:
                        ShareUtil.shareText(mActivity, joke.getComment_content().trim());
                        break;
                    case 1:
                        TextUtil.copy(mActivity, joke.getComment_content());
                        break;
                }
            }).show());

    holder.ll_comment.setOnClickListener(v -> {
        Intent intent = new Intent(mActivity, CommentListActivity.class);
        intent.putExtra("thread_key", "comment-" + joke.getComment_ID());
        mActivity.startActivity(intent);
    });

    setAnimation(holder.card, position);

}
 
Example #4
Source File: FreshNewsDetailFragment.java    From JianDan_OkHttp with Apache License 2.0 5 votes vote down vote up
private static String getHtml(FreshNews freshNews, String content) {
    final StringBuilder sb = new StringBuilder();
    sb.append("<!DOCTYPE html>");
    sb.append("<html dir=\"ltr\" lang=\"zh\">");
    sb.append("<head>");
    sb.append("<meta name=\"viewport\" content=\"width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" />");
    sb.append("<link rel=\"stylesheet\" href='file:///android_asset/style.css' type=\"text/css\" media=\"screen\" />");
    sb.append("</head>");
    sb.append("<body style=\"padding:0px 8px 8px 8px;\">");
    sb.append("<div id=\"pagewrapper\">");
    sb.append("<div id=\"mainwrapper\" class=\"clearfix\">");
    sb.append("<div id=\"maincontent\">");
    sb.append("<div class=\"post\">");
    sb.append("<div class=\"posthit\">");
    sb.append("<div class=\"postinfo\">");
    sb.append("<h2 class=\"thetitle\">");
    sb.append("<a>");
    sb.append(freshNews.getTitle());
    sb.append("</a>");
    sb.append("</h2>");
    sb.append(freshNews.getAuthor().getName() + " @ " + String2TimeUtil
            .dateString2GoodExperienceFormat(freshNews.getDate()));
    sb.append("</div>");
    sb.append("<div class=\"entry\">");
    sb.append(content);
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</div>");
    sb.append("</body>");
    sb.append("</html>");
    return sb.toString();
}
 
Example #5
Source File: PictureAdapter.java    From JianDanRxJava with Apache License 2.0 4 votes vote down vote up
@Override
public void onBindViewHolder(final PictureViewHolder holder, final int position) {

    final Picture picture = mPictures.get(position);
    String picUrl = picture.getPics()[0];

    if (picUrl.endsWith(".gif")) {
        holder.img_gif.setVisibility(View.VISIBLE);
        //非WIFI网络情况下,GIF图只加载缩略图,详情页才加载真实图片
        if (!isWifiConnected) {
            picUrl = picUrl.replace("mw600", "small").replace("mw1200", "small").replace
                    ("large", "small");
        }
    } else {
        holder.img_gif.setVisibility(View.GONE);
    }

    holder.progress.setProgress(0);
    holder.progress.setVisibility(View.VISIBLE);

    ImageLoadProxy.displayImageList(picUrl, holder.img, R.drawable.ic_loading_large, new
                    SimpleImageLoadingListener() {
                        @Override
                        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                            super.onLoadingComplete(imageUri, view, loadedImage);
                            holder.progress.setVisibility(View.GONE);
                        }
                    },
            (imageUri, view, current, total) -> holder.progress.setProgress((int) (current * 100f / total)));

    if (TextUtil.isNull(picture.getText_content().trim())) {
        holder.tv_content.setVisibility(View.GONE);
    } else {
        holder.tv_content.setVisibility(View.VISIBLE);
        holder.tv_content.setText(picture.getText_content().trim());
    }

    holder.img.setOnClickListener(v -> IntentHelper.toImageDetailActivity(mActivity, picture));

    holder.tv_author.setText(picture.getComment_author());
    holder.tv_time.setText(String2TimeUtil.dateString2GoodExperienceFormat(picture.getComment_date()));
    holder.tv_like.setText(picture.getVote_positive());
    holder.tv_comment_count.setText(picture.getComment_counts());

    //用于恢复默认的文字
    holder.tv_like.setTypeface(Typeface.DEFAULT);
    holder.tv_like.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));
    holder.tv_support_des.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));

    holder.tv_unlike.setText(picture.getVote_negative());
    holder.tv_unlike.setTypeface(Typeface.DEFAULT);
    holder.tv_unlike.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));
    holder.tv_un_support_des.setTextColor(mActivity.getResources().getColor(
            secondary_text_default_material_light));

    holder.img_share.setOnClickListener(v -> new MaterialDialog.Builder(mActivity)
            .items(R.array.picture_dialog)
            .backgroundColor(mActivity.getResources().getColor(JDApplication.COLOR_OF_DIALOG))
            .contentColor(JDApplication.COLOR_OF_DIALOG_CONTENT)
            .itemsCallback((dialog, view, which, text) -> {

                switch (which) {
                    case 0:
                        ShareUtil.sharePicture(mActivity, picture
                                .getPics()[0]);
                        break;
                    case 1:
                        FileUtil.savePicture(picture
                                .getPics()[0], mSaveFileCallBack);
                        break;
                }
            })
            .show());

    holder.ll_comment.setOnClickListener(v -> {
        Intent intent = new Intent(mActivity, CommentListActivity.class);
        intent.putExtra(BaseActivity.DATA_THREAD_KEY, "comment-" + picture.getComment_ID());
        mActivity.startActivity(intent);
    });

    setAnimation(holder.card, position);

}