Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Markdown in Descriptions #129

Merged
merged 5 commits into from
Aug 24, 2017
Merged

Markdown in Descriptions #129

merged 5 commits into from
Aug 24, 2017

Conversation

bobheadxi
Copy link
Collaborator

@bobheadxi bobheadxi commented Aug 20, 2017

Issues

#8 - Deal with markdown in descriptions

Changes

  • Convert bold and link markdown to HTML equivalents (handled by EncodingFixer)
  • Subreddit mentions ("/r/Android") are converted to HTML links
  • Support for HTML app descriptions in App Details view and App List view
  • Links are clickable in App Details view
  • Unit tests and Mockito additions for changes

image
image

@bobheadxi
Copy link
Collaborator Author

Need to update descriptionColumnParser tests

Copy link
Member

@d4rken d4rken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


public String fixHtmlEscapes(String input) {
//noinspection deprecation
return Html.fromHtml(input).toString();
}

public String convertStringToHtml(String string) {
// Converts link markdown to HTML
String output = string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure actually, I thought it would help with clarity to make it obvious that the string coming out was different, though I guess it's not really necessary


public String convertSubredditsToLinks(String string) {
// Converts subreddit mentions to links in HTML
String output = string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why the extra variable

description.setText(appInfo.getDescription());

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
description.setText(Html.fromHtml(appInfo.getDescription(), Html.FROM_HTML_MODE_COMPACT));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IF without brackets -> all one the same.

I don't always do it myself but it is a good practice for code reviews.

AppInfo app3 = new AppInfo();
app3.setAppName("Markdown Test");
app3.setDescription(
encodingFixer.convertStringToHtml("Tutorial **screencast** for [Propellerheads Reason](https://www.propellerheads.se/products/reason/)"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a call is this long, and a line break is necessary maybe make it:

app3.setDescription(
   encodingFixer.convertStringToHtml("Tutorial **screencast** for [Propellerheads Reason](https://www.propellerheads.se/products/reason/)")
);

@bobheadxi bobheadxi merged commit c1b972b into d4rken-org:dev Aug 24, 2017
@bobheadxi bobheadxi deleted the pr/markdown-in-descriptions branch September 2, 2017 15:22
bobheadxi added a commit that referenced this pull request Sep 6, 2017
* Convert bold and link markdown to HTML equivalents (handled by EncodingFixer)

* Subreddit mentions (eg "/r/Android") are converted to HTML links

* Support for HTML app descriptions in App Details view and App List view

* Clickable links in app details view

* Unit tests for changes, updates to other tests and mocks
bobheadxi added a commit that referenced this pull request Sep 6, 2017
bobheadxi added a commit that referenced this pull request Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants