Replace deprecated method
This commit is contained in:
parent
5bacbff10b
commit
74b2d439c3
|
@ -314,35 +314,33 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
}
|
||||
Log.d(TAG, "Parsing feed");
|
||||
|
||||
parser = Observable.create(new Observable.OnSubscribe<FeedHandlerResult>() {
|
||||
@Override
|
||||
public void call(Subscriber<? super FeedHandlerResult> subscriber) {
|
||||
parser = Observable.fromCallable(() -> {
|
||||
FeedHandler handler = new FeedHandler();
|
||||
try {
|
||||
FeedHandlerResult result = handler.parseFeed(feed);
|
||||
subscriber.onNext(result);
|
||||
return handler.parseFeed(feed);
|
||||
} catch (UnsupportedFeedtypeException e) {
|
||||
Log.d(TAG, "Unsupported feed type detected");
|
||||
if (TextUtils.equals("html", e.getRootElement().toLowerCase())) {
|
||||
showFeedDiscoveryDialog(new File(feed.getFile_url()), feed.getDownload_url());
|
||||
return null;
|
||||
} else {
|
||||
subscriber.onError(e);
|
||||
throw e;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, Log.getStackTraceString(e));
|
||||
subscriber.onError(e);
|
||||
throw e;
|
||||
} finally {
|
||||
boolean rc = new File(feed.getFile_url()).delete();
|
||||
Log.d(TAG, "Deleted feed source file. Result: " + rc);
|
||||
subscriber.onCompleted();
|
||||
}
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
if(result != null) {
|
||||
beforeShowFeedInformation(result.feed);
|
||||
showFeedInformation(result.feed, result.alternateFeedUrls);
|
||||
}
|
||||
}, error -> {
|
||||
String errorMsg = DownloadError.ERROR_PARSER_EXCEPTION.getErrorString(
|
||||
OnlineFeedViewActivity.this) + " (" + error.getMessage() + ")";
|
||||
|
|
Loading…
Reference in New Issue