From 00ace172fc7e3c36381a4b6766dde94b2f9c8606 Mon Sep 17 00:00:00 2001
From: heckler01
Date: Wed, 11 Apr 2018 19:16:08 -0400
Subject: Replace deprecated create((Observable.OnSubscribe)
---
.../java/de/danoeh/antennapod/activity/AboutActivity.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
index 041053a25..e29f4f525 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
@@ -75,7 +75,7 @@ public class AboutActivity extends AppCompatActivity {
}
private void loadAsset(String filename) {
- subscription = Observable.create((Observable.OnSubscribe) subscriber -> {
+ subscription = Observable.fromCallable(()-> {
InputStream input = null;
try {
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
@@ -85,8 +85,7 @@ public class AboutActivity extends AppCompatActivity {
res.recycle();
input = getAssets().open(filename);
String webViewData = IOUtils.toString(input, Charset.defaultCharset());
- if(!webViewData.startsWith("")) {
- //webViewData = webViewData.replace("\n\n", "
");
+ if (!webViewData.startsWith("")) {
webViewData = webViewData.replace("%", "%");
webViewData =
"" +
@@ -111,13 +110,13 @@ public class AboutActivity extends AppCompatActivity {
depth = 0;
}
webViewData = String.format(webViewData, colorString);
- subscriber.onNext(webViewData);
+ return webViewData;
} catch (IOException e) {
- subscriber.onError(e);
+ Log.e(TAG, Log.getStackTraceString(e));
+ throw e;
} finally {
IOUtils.closeQuietly(input);
}
- subscriber.onCompleted();
})
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
--
cgit v1.2.3
From b3d8a4c69f93b20ee0500695e5f9006f8ae3cbf0 Mon Sep 17 00:00:00 2001
From: heckler01
Date: Wed, 11 Apr 2018 20:49:21 -0400
Subject: Let webview handle if it can go back. When navigating the links,
depth would increment, but never return to 0, and then get stuck on the about
page.
---
.../de/danoeh/antennapod/activity/AboutActivity.java | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
index e29f4f525..c97463155 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java
@@ -36,8 +36,6 @@ public class AboutActivity extends AppCompatActivity {
private WebView webview;
private LinearLayout webviewContainer;
- private int depth = 0;
-
private Subscription subscription;
@Override
@@ -60,14 +58,12 @@ public class AboutActivity extends AppCompatActivity {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- if(url.startsWith("http")) {
- depth++;
- return false;
- } else {
+ if (!url.startsWith("http")) {
url = url.replace("file:///android_asset/", "");
loadAsset(url);
return true;
}
+ return false;
}
});
@@ -105,9 +101,6 @@ public class AboutActivity extends AppCompatActivity {
" " +
"" + webViewData + "