use of org.fossasia.openevent.common.events.DownloadEvent in project open-event-android by fossasia.
the class ResponseProcessor method onFailure.
@Override
public void onFailure(Call<T> call, Throwable throwable) {
Timber.e(throwable);
StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(new RetrofitError(throwable));
DownloadEvent downloadEvent = getDownloadEvent(false);
if (downloadEvent != null)
StrategyRegistry.getInstance().getEventBusStrategy().getEventBus().post(downloadEvent);
}
use of org.fossasia.openevent.common.events.DownloadEvent in project open-event-android by fossasia.
the class ResponseProcessor method complete.
protected void complete(Completable completable) {
DownloadEvent downloadEvent = getDownloadEvent(true);
if (downloadEvent == null)
return;
completable.subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread()).subscribe(() -> StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(downloadEvent), Timber::e);
}
use of org.fossasia.openevent.common.events.DownloadEvent in project open-event-android by fossasia.
the class MainActivity method downloadFailed.
private void downloadFailed(final DownloadEvent event) {
Snackbar.make(mainFrame, getString(R.string.download_failed), Snackbar.LENGTH_LONG).setAction(R.string.retry_download, view -> {
if (event == null)
StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(new DataDownloadEvent());
else
StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(event);
}).show();
SharedPreferencesUtil.putBoolean(ConstantStrings.IS_DOWNLOAD_DONE, false);
}
Aggregations