Use single instead of fromCallable
This commit is contained in:
parent
3e10e50741
commit
fd13603be6
@ -21,7 +21,7 @@ import java.nio.charset.Charset;
|
|||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import rx.Observable;
|
import rx.Single;
|
||||||
import rx.Subscription;
|
import rx.Subscription;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.schedulers.Schedulers;
|
import rx.schedulers.Schedulers;
|
||||||
@ -69,7 +69,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadAsset(String filename) {
|
private void loadAsset(String filename) {
|
||||||
subscription = Observable.fromCallable(()-> {
|
subscription = Single.create(subscriber -> {
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
try {
|
try {
|
||||||
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
|
TypedArray res = AboutActivity.this.getTheme().obtainStyledAttributes(
|
||||||
@ -101,10 +101,10 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
webViewData = webViewData.replace("\n", "<br/>");
|
webViewData = webViewData.replace("\n", "<br/>");
|
||||||
}
|
}
|
||||||
webViewData = String.format(webViewData, colorString);
|
webViewData = String.format(webViewData, colorString);
|
||||||
return webViewData;
|
subscriber.onSuccess(webViewData);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
throw e;
|
subscriber.onError(e);
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(input);
|
IOUtils.closeQuietly(input);
|
||||||
}
|
}
|
||||||
@ -112,8 +112,8 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
webviewData ->
|
webViewData ->
|
||||||
webView.loadDataWithBaseURL("file:///android_asset/", webviewData, "text/html", "utf-8", "about:blank"),
|
webView.loadDataWithBaseURL("file:///android_asset/", webViewData.toString(), "text/html", "utf-8", "about:blank"),
|
||||||
error -> Log.e(TAG, Log.getStackTraceString(error))
|
error -> Log.e(TAG, Log.getStackTraceString(error))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user