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


Java AndDown类代码示例

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


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

示例1: onBindViewHolder

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
@Override
    public void onBindViewHolder(final ProjectHolder holder, int position) {
        holder.linearLayoutExpanded.setVisibility(GONE);
        Project currProject = getItem(position);
        holder.studentName.setText(currProject.getStudent().getDisplayName());
        holder.projectName.setText(currProject.getTitle());
        holder.orgName.setText(currProject.getOrganization().getName());
        holder.projectMentor.setText("");

        AndDown andDown = new AndDown();
        holder.projectDesc.setText(Html.fromHtml(andDown.markdownToHtml(currProject.get_abstract())));
//        holder.projectDesc.setText(currProject.get_abstract());
        for (int i = 0; i < currProject.getAssigneeDisplayNames().size(); i++) {
            if (i == currProject.getAssigneeDisplayNames().size() - 1)
                holder.projectMentor.append(currProject.getAssigneeDisplayNames().get(i));
            else
                holder.projectMentor.append(currProject.getAssigneeDisplayNames().get(i) + ", ");
        }
    }
 
开发者ID:coding-blocks,项目名称:GSoC-Info-Android,代码行数:20,代码来源:ProjectAdapter.java

示例2: performLoad

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
@SuppressWarnings("StringBufferReplaceableByString")
@Override protected String performLoad() {
  return new StringBuilder().append("<html>")
      .append("<head>")
      .append("<style type=\"text/css\">")
      .append("a:link, a:visited, a:active { color: #4A90E2; font-weight: normal; }")
      .append("h3.top { font-weight: normal; }")
      .append("h4.bottom { font-size: 14px; }")
      .append(".bottom .date { color: #b7c2cc; font-weight: normal; }")
      .append(".thumbnail { width: 200px; display: block; margin: 0 auto; }")
      .append("</style>")
      .append("</head>")
      .append("<body>")
      .append(getThumbnailHtml())
      .append("<h3 class=\"top\">").append(postTitle).append("</h3>")
      .append("<h4 class=\"bottom\">")
      .append(getDateHtml())
      .append(getAuthorHtml())
      .append("</h4>")
      .append(new AndDown().markdownToHtml(postBody))
      .append("</body></html>")
      .toString();
}
 
开发者ID:contentful,项目名称:blog-app-android,代码行数:24,代码来源:PostLoader.java

示例3: setMarkdownText

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
public static void setMarkdownText(final TextView target, final String markdownText) {
    if (target == null) {
        return;
    }

    // Converting this to markdown could take an unknown amount of time, so let's load the text in first and then load the markdown in after it is processed.
    target.setText(markdownText);

    // No need to process it if there isn't anything.
    if (Strings.notEmpty(markdownText)) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                AndDown markdownProcessor = new AndDown();
                final String processedText = markdownProcessor.markdownToHtml(markdownText);
                target.setText(Html.fromHtml(processedText));
            }
        }) {}.start();
    }
}
 
开发者ID:antew,项目名称:RedditInPictures,代码行数:21,代码来源:MarkdownUtil.java

示例4: onCreateView

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
@Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_org_details,container,false);
        Intent i = getActivity().getIntent();
        Organization organization = (Organization) i.getSerializableExtra(ORG_TAG);

        TextView orgDetails = view.findViewById(R.id.org_detail_details);
        TextView orgTitle = view.findViewById(R.id.org_detail_title);

        AndDown andDown=new AndDown();

        String orgDesc = organization.getDescription();
//                .replaceAll("(\\? )|(\\! )|(\\. )", "$0\n"); //Replace every period with newline

        orgDesc = andDown.markdownToHtml(orgDesc);  //Todo : do this while inserting to db

        orgDetails.setText(Html.fromHtml(orgDesc));
        orgTitle.setText(organization.getTagline());
        RecyclerView techRv = view.findViewById(R.id.techTagRecyclerView);
        TagAdapter techAdapter;
        List<String> tags = new ArrayList<>();

        tags.addAll(organization.getTechnologyTags());
        tags.addAll(organization.getTopicTags());
        tags.addAll(organization.getProposalTags());
        techAdapter = new TagAdapter(tags);

        techRv.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.HORIZONTAL));
        techRv.setAdapter(techAdapter);

        return view;
    }
 
开发者ID:coding-blocks,项目名称:GSoC-Info-Android,代码行数:34,代码来源:OrgDetailFragment.java

示例5: bindEvent

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
public void bindEvent(Event event) {
    eventTitle.setText(event.getTitle());
    eventDate.setText(event.getStartDate().toString("E, MMM dd"));
    eventTime.setText(DateHelper.getEventTimeString(event));
    bottomArea.setVisibility(View.VISIBLE);
    if (event.getVenue() != null) {
        venueSection.setVisibility(View.VISIBLE);
        venueName.setText(event.getVenue().getTitle());
        venueAddress.setText(event.getVenue().getStreetAddress());

        if (event.getVenue().getStaticMapURL() != null) {
            Glide.with(view.getContext()).load(event.getVenue().getStaticMapURL()).into(map);
        } else {
            map.setVisibility(View.GONE);
        }

        if (event.getVenue().getAccessNotes() != null
                && event.getVenue().getAccessNotes().length() > 0) {
            venueAccessSection.setVisibility(View.VISIBLE);
            venueAccessInfo.setText(event.getVenue().getAccessNotes());
        } else {
            venueAccessSection.setVisibility(View.GONE);
        }
    } else {
        venueSection.setVisibility(View.GONE);
    }
    AndDown result = new AndDown();
    String html = result.markdownToHtml(event.getDescription());
    eventDetails.setText(Html.fromHtml(html));
}
 
开发者ID:polymerwitch,项目名称:Calagator-Android,代码行数:31,代码来源:EventDetailsView.java

示例6: generateHTML

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
@Override
public String generateHTML(String markdown) {
    AndDown andDown = new AndDown();
    return andDown.markdownToHtml(markdown, HOEDOWN_FLAGS, 0);
}
 
开发者ID:wbrawner,项目名称:SimpleMarkdown,代码行数:6,代码来源:MarkdownPresenterImpl.java

示例7: getCardView

import com.commonsware.cwac.anddown.AndDown; //导入依赖的package包/类
@Override
public View getCardView(Context context) {
    if (mCardModel == null) {
        return null;
    }

    /*
    View view = LayoutInflater.from(context).inflate(R.layout.card_markdown, null);
    WebView webview = (WebView) view.findViewById(R.id.webView);

    AndDown andDown = new AndDown();
    String[] splits = "Line 1\n* bullet 1\n* bullet 2".split("\n");
    String html = "";
    for (String s: splits) {
        html += andDown.markdownToHtml(s);
    }
    webview.loadData(html, "text/html", "UTF-8");
    webview.invalidate();
    */


    View view = LayoutInflater.from(context).inflate(R.layout.card_markdown, null);
    TextView tvText = ((TextView) view.findViewById(R.id.tv_text));
    AndDown andDown = new AndDown();
    String html = andDown.markdownToHtml(mCardModel.getText());

    /*
    String[] splits = "Line 1\n## header 1\n### header 2".split("\n");
    String html = "";
    for (String s: splits) {
        html += andDown.markdownToHtml(s);
        Spanned htmlSpanned = Html.fromHtml(html);
        tvText.append(htmlSpanned);
    }
    */

    tvText.setLinksClickable(true);
    tvText.setMovementMethod(LinkMovementMethod.getInstance());
    Spanned htmlSpanned = Html.fromHtml(html, new Html.ImageGetter() {
        @Override
        public Drawable getDrawable(final String source) {
            String absPath = mCardModel.getStoryPath().buildZipPath(source);
            Bitmap myBitmap = BitmapFactory.decodeStream(ZipHelper.getFileInputStream(absPath, mContext));
            Drawable d = new BitmapDrawable(mContext.getResources(), myBitmap);
            d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
            return d;
        }
    }, null);
    tvText.setText(Utility.trimTrailingWhitespace(htmlSpanned));

    // supports automated testing
    view.setTag(mCardModel.getId());

    return view;
}
 
开发者ID:StoryMaker,项目名称:storypath,代码行数:56,代码来源:MarkdownCardView.java


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