Search in sources :

Example 1 with RequestInfoWallpaper

use of net.iGap.request.RequestInfoWallpaper in project iGap-Android by KianIranian-STDG.

the class UserProfileViewModel method getProfileWallpaperFromServer.

private void getProfileWallpaperFromServer() {
    G.onGetProfileWallpaper = list -> {
        G.isNeedToCheckProfileWallpaper = false;
        DbManager.getInstance().doRealmTask(realm -> {
            RealmWallpaper realmWallpaper = realm.where(RealmWallpaper.class).equalTo("type", ProtoInfoWallpaper.InfoWallpaper.Type.PROFILE_WALLPAPER_VALUE).findFirst();
            if (realmWallpaper != null) {
                int count = realmWallpaper.getWallPaperList().size();
                assert realmWallpaper.getWallPaperList().get(count - 1) != null;
                if (!realmWallpaper.getWallPaperList().get(count - 1).getFile().getToken().equals(list.get(0).getFile().getToken())) {
                    RealmWallpaper.updateWallpaper(list);
                }
            } else {
                RealmWallpaper.updateField(list, "", ProtoInfoWallpaper.InfoWallpaper.Type.PROFILE_WALLPAPER_VALUE);
            }
            getProfileWallpaper(realm);
        });
    };
    new RequestInfoWallpaper().infoWallpaper(ProtoInfoWallpaper.InfoWallpaper.Type.PROFILE_WALLPAPER);
}
Also used : RequestInfoWallpaper(net.iGap.request.RequestInfoWallpaper) RealmWallpaper(net.iGap.realm.RealmWallpaper)

Example 2 with RequestInfoWallpaper

use of net.iGap.request.RequestInfoWallpaper in project iGap-Android by KianIranian-STDG.

the class ChatBackgroundViewModel method getImageListFromServer.

private void getImageListFromServer() {
    showLoadingView.set(View.VISIBLE);
    G.onGetWallpaper = new OnGetWallpaper() {

        @Override
        public void onGetWallpaperList(final List<ProtoGlobal.Wallpaper> list) {
            RealmWallpaper.updateField(list, "", ProtoInfoWallpaper.InfoWallpaper.Type.CHAT_BACKGROUND_VALUE);
            fillList(false);
            showLoadingView.set(View.GONE);
        }
    };
    new RequestInfoWallpaper().infoWallpaper(ProtoInfoWallpaper.InfoWallpaper.Type.CHAT_BACKGROUND);
}
Also used : RequestInfoWallpaper(net.iGap.request.RequestInfoWallpaper) OnGetWallpaper(net.iGap.observers.interfaces.OnGetWallpaper) ProtoInfoWallpaper(net.iGap.proto.ProtoInfoWallpaper) RealmWallpaper(net.iGap.realm.RealmWallpaper) RequestInfoWallpaper(net.iGap.request.RequestInfoWallpaper) OnGetWallpaper(net.iGap.observers.interfaces.OnGetWallpaper) StructWallpaper(net.iGap.module.StructWallpaper)

Aggregations

RealmWallpaper (net.iGap.realm.RealmWallpaper)2 RequestInfoWallpaper (net.iGap.request.RequestInfoWallpaper)2 StructWallpaper (net.iGap.module.StructWallpaper)1 OnGetWallpaper (net.iGap.observers.interfaces.OnGetWallpaper)1 ProtoInfoWallpaper (net.iGap.proto.ProtoInfoWallpaper)1