Search in sources :

Example 1 with CounterEvent

use of org.fossasia.openevent.common.events.CounterEvent in project open-event-android by fossasia.

the class MainActivity method downloadFromAssets.

public void downloadFromAssets() {
    fromServer = false;
    if (!SharedPreferencesUtil.getBoolean(ConstantStrings.DATABASE_RECORDS_EXIST, false)) {
        // TODO: Add and Take counter value from to config.json
        SharedPreferencesUtil.putBoolean(ConstantStrings.DATABASE_RECORDS_EXIST, true);
        startDownloadListener();
        Timber.d("JSON parsing started");
        // Bump if increased
        StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(new CounterEvent(7));
        readJsonAsset(Urls.EVENT);
        readJsonAsset(Urls.SESSIONS);
        readJsonAsset(Urls.SPEAKERS);
        readJsonAsset(Urls.TRACKS);
        readJsonAsset(Urls.SPONSORS);
        readJsonAsset(Urls.MICROLOCATIONS);
        readJsonAsset(Urls.SESSION_TYPES);
    // readJsonAsset(Urls.FAQS);
    } else {
        completeHandler.hide();
    }
    SharedPreferencesUtil.putBoolean(ConstantStrings.IS_DOWNLOAD_DONE, true);
}
Also used : CounterEvent(org.fossasia.openevent.common.events.CounterEvent)

Example 2 with CounterEvent

use of org.fossasia.openevent.common.events.CounterEvent in project open-event-android by fossasia.

the class EventListResponseProcessor method onSuccess.

@Override
protected void onSuccess(Event event) {
    int counterRequests = 7;
    final DataDownloadManager download = DataDownloadManager.getInstance();
    StrategyRegistry.getInstance().getEventBusStrategy().postEventOnUIThread(new CounterEvent(counterRequests));
    save(event);
    download.downloadSession();
    download.downloadSpeakers();
    download.downloadTracks();
    download.downloadMicrolocations();
    download.downloadSponsors();
    download.downloadSessionTypes();
}
Also used : DataDownloadManager(org.fossasia.openevent.common.api.DataDownloadManager) CounterEvent(org.fossasia.openevent.common.events.CounterEvent)

Aggregations

CounterEvent (org.fossasia.openevent.common.events.CounterEvent)2 DataDownloadManager (org.fossasia.openevent.common.api.DataDownloadManager)1