Search in sources :

Example 1 with IGSingleObserver

use of net.iGap.observers.rx.IGSingleObserver in project iGap-Android by KianIranian-STDG.

the class StickerRepository method getUserStickersGroup.

public void getUserStickersGroup() {
    CompositeDisposable compositeDisposable = new CompositeDisposable();
    stickerApi.getUserStickersGroup().subscribeOn(Schedulers.newThread()).map(dataModel -> {
        List<StructIGStickerGroup> groups = new ArrayList<>();
        for (int i = 0; i < dataModel.getData().size(); i++) {
            StructIGStickerGroup stickerGroup = new StructIGStickerGroup(dataModel.getData().get(i));
            groups.add(stickerGroup);
        }
        return groups;
    }).subscribe(new IGSingleObserver<List<StructIGStickerGroup>>(compositeDisposable) {

        @Override
        public void onSuccess(List<StructIGStickerGroup> structIGStickerGroups) {
            updateStickers(structIGStickerGroups);
            if (!compositeDisposable.isDisposed())
                compositeDisposable.dispose();
        }

        @Override
        public void onError(Throwable e) {
            e.printStackTrace();
            if (!compositeDisposable.isDisposed())
                compositeDisposable.dispose();
        }
    });
}
Also used : JsonObject(com.google.gson.JsonObject) SingleSource(io.reactivex.SingleSource) StickerCategoryGroupDataModel(net.iGap.fragments.emoji.apiModels.StickerCategoryGroupDataModel) FileLog(net.iGap.helper.FileLog) Completable(io.reactivex.Completable) AESCrypt(net.iGap.module.AESCrypt) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) StructIGStickerCategory(net.iGap.fragments.emoji.struct.StructIGStickerCategory) RealmStickerItem(net.iGap.realm.RealmStickerItem) G(net.iGap.G) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) SliderDataModel(net.iGap.fragments.emoji.apiModels.SliderDataModel) Flowable(io.reactivex.Flowable) Gson(com.google.gson.Gson) Schedulers(io.reactivex.schedulers.Schedulers) RsaDataModel(net.iGap.fragments.emoji.apiModels.RsaDataModel) IGSingleObserver(net.iGap.observers.rx.IGSingleObserver) CardStatusDataModel(net.iGap.fragments.emoji.apiModels.CardStatusDataModel) HelperNumerical(net.iGap.helper.HelperNumerical) Ids(net.iGap.fragments.emoji.apiModels.Ids) CompletableObserver(io.reactivex.CompletableObserver) RealmResults(io.realm.RealmResults) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) StickerApi(net.iGap.api.StickerApi) UserGiftStickersDataModel(net.iGap.fragments.emoji.apiModels.UserGiftStickersDataModel) File(java.io.File) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) RetrofitFactory(net.iGap.api.apiService.RetrofitFactory) StructIGSticker(net.iGap.fragments.emoji.struct.StructIGSticker) Sort(io.realm.Sort) Base64(android.util.Base64) CardDetailDataModel(net.iGap.fragments.emoji.apiModels.CardDetailDataModel) IssueDataModel(net.iGap.fragments.emoji.apiModels.IssueDataModel) R(net.iGap.R) RealmStickerGroup(net.iGap.realm.RealmStickerGroup) ResponseCallback(net.iGap.observers.interfaces.ResponseCallback) NotNull(org.jetbrains.annotations.NotNull) DbManager(net.iGap.module.accountManager.DbManager) ArrayList(java.util.ArrayList) List(java.util.List) StructIGStickerGroup(net.iGap.fragments.emoji.struct.StructIGStickerGroup) CompositeDisposable(io.reactivex.disposables.CompositeDisposable)

Aggregations

Base64 (android.util.Base64)1 Gson (com.google.gson.Gson)1 JsonObject (com.google.gson.JsonObject)1 Completable (io.reactivex.Completable)1 CompletableObserver (io.reactivex.CompletableObserver)1 Flowable (io.reactivex.Flowable)1 Single (io.reactivex.Single)1 SingleSource (io.reactivex.SingleSource)1 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Disposable (io.reactivex.disposables.Disposable)1 Schedulers (io.reactivex.schedulers.Schedulers)1 RealmResults (io.realm.RealmResults)1 Sort (io.realm.Sort)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 G (net.iGap.G)1 R (net.iGap.R)1