Skip to content

Commit

Permalink
Merge pull request #260 from iFixit/fix-html-injection
Browse files Browse the repository at this point in the history
Fix html injection
  • Loading branch information
timothyasp committed Feb 18, 2016
2 parents 3985019 + 836e41f commit 4a7627c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions App/build.gradle
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand Down Expand Up @@ -48,8 +48,8 @@ android {
buildToolsVersion "21.1.2"

defaultConfig {
versionCode 59
versionName "2.9.1"
versionCode 60
versionName "2.9.2"
minSdkVersion 9
targetSdkVersion 21
applicationId "com.dozuki.ifixit"
Expand Down
Expand Up @@ -45,7 +45,7 @@ public void onClick(View v) {
}
});

((TextView)v.findViewById(R.id.guide_title)).setText(Html.fromHtml(mGuideInfo.mTitle));
((TextView)v.findViewById(R.id.guide_title)).setText(mGuideInfo.mTitle);
((TextView)v.findViewById(R.id.guide_author)).setText(
App.get().getString(R.string.by_author, mGuideInfo.mAuthorName));

Expand Down
3 changes: 1 addition & 2 deletions App/src/com/dozuki/ifixit/ui/GuideItemView.java
Expand Up @@ -34,8 +34,7 @@ public GuideItemView(Context context, boolean shortTitle) {
}

public void setGuideItem(GuideInfo guide) {
mTitleView.setText(mShortTitle && guide.hasSubject() ?
guide.mSubject : Html.fromHtml(guide.mTitle));
mTitleView.setText(mShortTitle && guide.hasSubject() ? guide.mSubject : guide.mTitle);

Transformation transform = new RoundedTransformation(4, 0);

Expand Down
Expand Up @@ -173,7 +173,7 @@ public void setRowData(GuideInfo guideInfo) {
mGuideInfo = guideInfo;
setTag(mGuideInfo.mGuideid);

mTitleView.setText(Html.fromHtml(mGuideInfo.mTitle));
mTitleView.setText(mGuideInfo.mTitle);

if (mThumbnail != null) {
Picasso picasso = PicassoUtils.with(mContext);
Expand Down
Expand Up @@ -89,7 +89,7 @@ public void setRowData(GuideMediaProgress guideMedia, boolean displayLiveImages,
boolean isSyncing) {
mGuideMedia = guideMedia;

mTitleView.setText(Html.fromHtml(mGuideMedia.mGuideInfo.mTitle));
mTitleView.setText(mGuideMedia.mGuideInfo.mTitle);
mProgressButton.setPinned(true);
mProgressButton.setCircleColor(getResources().getColor(
R.color.progress_button_background));
Expand Down
Expand Up @@ -76,7 +76,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mIntro.setMovementMethod(method);

if (mGuide != null) {
mTitle.setText(Html.fromHtml(mGuide.getTitle()));
mTitle.setText(mGuide.getTitle());

String introductionText = mGuide.getIntroductionRendered();

Expand Down Expand Up @@ -159,7 +159,11 @@ public void onGlobalLayout() {
}
}

mIntro.setText(Utils.correctLinkPaths(Html.fromHtml(introductionText, null, new WikiHtmlTagHandler())));
if (introductionText.length() > 0) {
mIntro.setText(Utils.correctLinkPaths(Html.fromHtml(introductionText, null, new WikiHtmlTagHandler())));
} else {
mIntro.setText(introductionText);
}

// Authors and Difficulty are not relevant on teardowns.
if (mGuide.getType().equalsIgnoreCase("teardown")) {
Expand Down

0 comments on commit 4a7627c

Please sign in to comment.