Replace deprecated create((Observable.OnSubscribe<T>)
This commit is contained in:
parent
c82dce79eb
commit
00ace172fc
@ -75,7 +75,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadAsset(String filename) {
|
private void loadAsset(String filename) {
|
||||||
subscription = Observable.create((Observable.OnSubscribe<String>) subscriber -> {
|
subscription = Observable.fromCallable(()-> {
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
try {
|
try {
|
||||||
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
|
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
|
||||||
@ -86,7 +86,6 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
input = getAssets().open(filename);
|
input = getAssets().open(filename);
|
||||||
String webViewData = IOUtils.toString(input, Charset.defaultCharset());
|
String webViewData = IOUtils.toString(input, Charset.defaultCharset());
|
||||||
if (!webViewData.startsWith("<!DOCTYPE html>")) {
|
if (!webViewData.startsWith("<!DOCTYPE html>")) {
|
||||||
//webViewData = webViewData.replace("\n\n", "</p><p>");
|
|
||||||
webViewData = webViewData.replace("%", "%");
|
webViewData = webViewData.replace("%", "%");
|
||||||
webViewData =
|
webViewData =
|
||||||
"<!DOCTYPE html>" +
|
"<!DOCTYPE html>" +
|
||||||
@ -111,13 +110,13 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
depth = 0;
|
depth = 0;
|
||||||
}
|
}
|
||||||
webViewData = String.format(webViewData, colorString);
|
webViewData = String.format(webViewData, colorString);
|
||||||
subscriber.onNext(webViewData);
|
return webViewData;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
subscriber.onError(e);
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(input);
|
IOUtils.closeQuietly(input);
|
||||||
}
|
}
|
||||||
subscriber.onCompleted();
|
|
||||||
})
|
})
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user