Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
Fix the rendering of a podcast detail (#64) (#68)
Browse files Browse the repository at this point in the history
Use a WebView instead of a TextView for rendering
the podcast information.
  • Loading branch information
Amokrane authored and TheHollidayInn committed Nov 20, 2017
1 parent be92971 commit 26598b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import android.support.v4.media.MediaMetadataCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.koalatea.thehollidayinn.softwareengineeringdaily.PlaybackControllerActivity;
import com.koalatea.thehollidayinn.softwareengineeringdaily.R;
Expand All @@ -30,18 +30,13 @@
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.models.Title;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.remote.APIInterface;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.remote.ApiUtils;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.repositories.FilterRepository;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.repositories.PodcastDownloadsRepository;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.repositories.PostRepository;
import com.koalatea.thehollidayinn.softwareengineeringdaily.data.repositories.UserRepository;

import com.koalatea.thehollidayinn.softwareengineeringdaily.downloads.DownloadTask;
import com.koalatea.thehollidayinn.softwareengineeringdaily.downloads.MP3FileManager;
import java.io.File;
import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
Expand Down Expand Up @@ -142,15 +137,8 @@ private void loadPost (final String postId) {
TextView secondaryTextView = (TextView) findViewById(R.id.secondaryTextView);
secondaryTextView.setText(dayString);

TextView descriptionTextView = (TextView) findViewById(R.id.description);
if (Build.VERSION.SDK_INT > 24) {
descriptionTextView.setText(Html.fromHtml(postContent.getRendered(), Html.FROM_HTML_MODE_COMPACT));
} else {
//noinspection deprecation
descriptionTextView.setText(Html.fromHtml(postContent.getRendered()));
}

descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance());
WebView descriptionWebView = findViewById(R.id.description);
descriptionWebView.loadData(postContent.getRendered(), "text/html", "UTF-8");


scoreText.setText(String.valueOf(post.getScore()));
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_podcast_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
android:paddingRight="24dp"
android:paddingTop="@dimen/md_keylines">

<TextView
<WebView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down

0 comments on commit 26598b2

Please sign in to comment.