Merge pull request #4318 from johnjohndoe/htmlcompat-fromhtml
Replace deprecated Html#fromHtml with HtmlCompat#fromHtml.
This commit is contained in:
commit
18fd908e6b
|
@ -3,9 +3,11 @@ package de.danoeh.antennapod.fragment.preferences;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import androidx.core.text.HtmlCompat;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import android.text.Html;
|
|
||||||
|
import android.text.Spanned;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
@ -115,7 +117,8 @@ public class GpodderPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
String format = getActivity().getString(R.string.pref_gpodnet_login_status);
|
String format = getActivity().getString(R.string.pref_gpodnet_login_status);
|
||||||
String summary = String.format(format, GpodnetPreferences.getUsername(),
|
String summary = String.format(format, GpodnetPreferences.getUsername(),
|
||||||
GpodnetPreferences.getDeviceID());
|
GpodnetPreferences.getDeviceID());
|
||||||
findPreference(PREF_GPODNET_LOGOUT).setSummary(Html.fromHtml(summary));
|
Spanned formattedSummary = HtmlCompat.fromHtml(summary, HtmlCompat.FROM_HTML_MODE_LEGACY);
|
||||||
|
findPreference(PREF_GPODNET_LOGOUT).setSummary(formattedSummary);
|
||||||
updateLastGpodnetSyncReport(SyncService.isLastSyncSuccessful(getContext()),
|
updateLastGpodnetSyncReport(SyncService.isLastSyncSuccessful(getContext()),
|
||||||
SyncService.getLastSyncAttempt(getContext()));
|
SyncService.getLastSyncAttempt(getContext()));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.danoeh.antennapod.core.syndication.namespace.atom;
|
package de.danoeh.antennapod.core.syndication.namespace.atom;
|
||||||
|
|
||||||
import android.os.Build;
|
import androidx.core.text.HtmlCompat;
|
||||||
import android.text.Html;
|
|
||||||
import de.danoeh.antennapod.core.syndication.namespace.Namespace;
|
import de.danoeh.antennapod.core.syndication.namespace.Namespace;
|
||||||
import de.danoeh.antennapod.core.syndication.namespace.SyndElement;
|
import de.danoeh.antennapod.core.syndication.namespace.SyndElement;
|
||||||
|
|
||||||
|
@ -24,11 +24,7 @@ public class AtomText extends SyndElement {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return content;
|
return content;
|
||||||
} else if (type.equals(TYPE_HTML)) {
|
} else if (type.equals(TYPE_HTML)) {
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
return HtmlCompat.fromHtml(content, HtmlCompat.FROM_HTML_MODE_LEGACY).toString();
|
||||||
return Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY).toString();
|
|
||||||
} else {
|
|
||||||
return Html.fromHtml(content).toString();
|
|
||||||
}
|
|
||||||
} else if (type.equals(TYPE_XHTML)) {
|
} else if (type.equals(TYPE_XHTML)) {
|
||||||
return content;
|
return content;
|
||||||
} else { // Handle as text by default
|
} else { // Handle as text by default
|
||||||
|
|
Loading…
Reference in New Issue