mirror of https://github.com/readrops/Readrops.git
Fiw webview not displaying item content when using api 29
This commit is contained in:
parent
0897126117
commit
2f5a140988
|
@ -3,9 +3,12 @@ package com.readrops.app.utils;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Base64;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.readrops.app.R;
|
import com.readrops.app.R;
|
||||||
import com.readrops.app.database.pojo.ItemWithFeed;
|
import com.readrops.app.database.pojo.ItemWithFeed;
|
||||||
|
|
||||||
|
@ -27,7 +30,14 @@ public class ReadropsWebView extends WebView {
|
||||||
|
|
||||||
public void setItem(ItemWithFeed itemWithFeed) {
|
public void setItem(ItemWithFeed itemWithFeed) {
|
||||||
this.itemWithFeed = itemWithFeed;
|
this.itemWithFeed = itemWithFeed;
|
||||||
loadData(getText(), "text/html; charset=utf-8", "UTF-8");
|
|
||||||
|
String text = getText();
|
||||||
|
String base64Content = null;
|
||||||
|
|
||||||
|
if (text != null)
|
||||||
|
base64Content = Base64.encodeToString(text.getBytes(), Base64.NO_PADDING);
|
||||||
|
|
||||||
|
loadData(base64Content, "text/html; charset=utf-8", "base64");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
@ -44,6 +54,7 @@ public class ReadropsWebView extends WebView {
|
||||||
setBackgroundColor(getResources().getColor(R.color.colorBackground));
|
setBackgroundColor(getResources().getColor(R.color.colorBackground));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private String getText() {
|
private String getText() {
|
||||||
if (itemWithFeed.getItem().getText() != null) {
|
if (itemWithFeed.getItem().getText() != null) {
|
||||||
Document document = Jsoup.parse(Parser.unescapeEntities(itemWithFeed.getItem().getText(), false), itemWithFeed.getWebsiteUrl());
|
Document document = Jsoup.parse(Parser.unescapeEntities(itemWithFeed.getItem().getText(), false), itemWithFeed.getWebsiteUrl());
|
||||||
|
|
Loading…
Reference in New Issue