当前位置: 首页>>代码示例>>Java>>正文


Java RealmList类代码示例

本文整理汇总了Java中io.realm.RealmList的典型用法代码示例。如果您正苦于以下问题:Java RealmList类的具体用法?Java RealmList怎么用?Java RealmList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RealmList类属于io.realm包,在下文中一共展示了RealmList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ChatListFragment

import io.realm.RealmList; //导入依赖的package包/类
public ChatListFragment() {
    contactUpdatedListener = new ResultListener() {
        @Override
        public void onResult(boolean success) {
            if (success) {
                if (getActivity() != null) {
                    getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (chatInfoList != null) {
                                if (chatInfoList.size() > 0) {
                                    RealmList<RealmContact> phoneContacts = AppManager.getContacts(getActivity());
                                    adapter.setPhoneContacts(phoneContacts);
                                    adapter.notifyDataSetChanged();
                                }
                            }
                        }
                    });
                }
            }
        }
    };
}
 
开发者ID:AppHero2,项目名称:Raffler-Android,代码行数:24,代码来源:ChatListFragment.java

示例2: getFieldStringListNull

import io.realm.RealmList; //导入依赖的package包/类
public RealmList<String> getFieldStringListNull() {
    return fieldStringListNull;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:NullTypes.java

示例3: deserialize

import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList<T> deserialize(JsonElement json, Type typeOfT,
                                        JsonDeserializationContext context) throws JsonParseException {
    RealmList<T> items = new RealmList<>();
    JsonArray ja = json.getAsJsonArray();
    for (JsonElement je : ja) {
        items.add((T) context.deserialize(je, getObjectType()));
    }
    return items;
}
 
开发者ID:Commit451,项目名称:Regalia,代码行数:11,代码来源:RealmListGsonConverter.java

示例4: initList

import io.realm.RealmList; //导入依赖的package包/类
private void initList() {
    mList = new RealmList<>();
    mList.add(new GoldManagerItemBean(0, true));
    mList.add(new GoldManagerItemBean(1, true));
    mList.add(new GoldManagerItemBean(2, true));
    mList.add(new GoldManagerItemBean(3, true));
    mList.add(new GoldManagerItemBean(4, false));
    mList.add(new GoldManagerItemBean(5, false));
    mList.add(new GoldManagerItemBean(6, false));
    mList.add(new GoldManagerItemBean(7, false));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:GoldMainPresenter.java

示例5: Season

import io.realm.RealmList; //导入依赖的package包/类
public Season(String id, String name, boolean hasFullSeasonDownloadUrl, RealmList<Episode> episodes, TvShow tvShow) {
    mId = id;
    mName = name;
    mHasFullSeasonDownloadUrl = hasFullSeasonDownloadUrl;
    mEpisodes = episodes;
    mTvShow = tvShow;
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:8,代码来源:Season.java

示例6: parse

import io.realm.RealmList; //导入依赖的package包/类
@Test
public void parse() throws Exception {
    String json = TestUtil.getCatWithListOfFriendsJson();
    Type catRealmListType = new TypeToken<RealmList<Cat>>(){}.getType();
    CatListConverter catRealmListConverter = new CatListConverter();
    Gson gson = new GsonBuilder()
            .registerTypeAdapter(catRealmListType, catRealmListConverter)
            .create();
    Cat cat = gson.fromJson(json, Cat.class);
    Assert.assertNotNull(cat);
    Assert.assertNotNull(cat.friends);
}
 
开发者ID:Commit451,项目名称:Regalia,代码行数:13,代码来源:GsonRealmListTest.java

示例7: from

import io.realm.RealmList; //导入依赖的package包/类
@Override
public <E> Flowable<RealmList<E>> from(Realm realm, final RealmList<E> list) {
    final RealmConfiguration realmConfig = realm.getConfiguration();
    return Flowable.create(new FlowableOnSubscribe<RealmList<E>>() {
        @Override
        public void subscribe(final FlowableEmitter<RealmList<E>> emitter) throws Exception {
            // Gets instance to make sure that the Realm is open for as long as the
            // Observable is subscribed to it.
            final Realm observableRealm = Realm.getInstance(realmConfig);
            listRefs.get().acquireReference(list);
            final RealmChangeListener<RealmList<E>> listener = new RealmChangeListener<RealmList<E>>() {
                @Override
                public void onChange(RealmList<E> results) {
                    if (!emitter.isCancelled()) {
                        emitter.onNext(list);
                    }
                }
            };
            list.addChangeListener(listener);

            // Cleanup when stream is disposed
            emitter.setDisposable(Disposables.fromRunnable(new Runnable() {
                @Override
                public void run() {
                    list.removeChangeListener(listener);
                    observableRealm.close();
                    listRefs.get().releaseReference(list);
                }
            }));

            // Emit current value immediately
            emitter.onNext(list);

        }
    }, BACK_PRESSURE_STRATEGY);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:RealmObservableFactory.java

示例8: changesetsFrom

import io.realm.RealmList; //导入依赖的package包/类
@Override
public <E> Observable<CollectionChange<RealmList<E>>> changesetsFrom(DynamicRealm realm, final RealmList<E> list) {
    final RealmConfiguration realmConfig = realm.getConfiguration();
    return Observable.create(new ObservableOnSubscribe<CollectionChange<RealmList<E>>>() {
        @Override
        public void subscribe(final ObservableEmitter<CollectionChange<RealmList<E>>> emitter) throws Exception {
            // Gets instance to make sure that the Realm is open for as long as the
            // Observable is subscribed to it.
            final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig);
            listRefs.get().acquireReference(list);
            final OrderedRealmCollectionChangeListener<RealmList<E>> listener = new OrderedRealmCollectionChangeListener<RealmList<E>>() {
                @Override
                public void onChange(RealmList<E> results, OrderedCollectionChangeSet changeSet) {
                    if (!emitter.isDisposed()) {
                        emitter.onNext(new CollectionChange<>(results, changeSet));
                    }
                }
            };
            list.addChangeListener(listener);

            // Cleanup when stream is disposed
            emitter.setDisposable(Disposables.fromRunnable(new Runnable() {
                @Override
                public void run() {
                    list.removeChangeListener(listener);
                    observableRealm.close();
                    listRefs.get().releaseReference(list);
                }
            }));

            // Emit current value immediately
            emitter.onNext(new CollectionChange<>(list, null));
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:RealmObservableFactory.java

示例9: parse

import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList<T> parse(JsonParser jsonParser) throws IOException {
    init();
    RealmList<T> list = new RealmList<>();
    if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
        while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
            T object = typeConverter != null ? typeConverter.parse(jsonParser) : mapper.parse(jsonParser);
            if (object != null) {
                list.add(object);
            }
        }
    }
    return list;
}
 
开发者ID:Commit451,项目名称:Regalia,代码行数:15,代码来源:RealmListLoganSquareConverter.java

示例10: makeDefaultGsonBuilder

import io.realm.RealmList; //导入依赖的package包/类
public static GsonBuilder makeDefaultGsonBuilder() {
    return new GsonBuilder()
            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
            .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC)
            .disableHtmlEscaping()
            .setPrettyPrinting()
            .registerTypeAdapter(Date.class, new DateDeserializer())
            .registerTypeAdapter(new TypeToken<RealmList<RealmString>>() {}.getType(), new RealmStringDeserializer());
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:10,代码来源:GsonProvider.java

示例11: saveContacts

import io.realm.RealmList; //导入依赖的package包/类
/**
 * save contacts data into local storage
 * @param contacts
 */
public static void saveContacts(final RealmList<RealmContact> contacts ){
    Realm realm = Realm.getDefaultInstance();
    realm.beginTransaction();
    final RealmResults<RealmContact> results = realm.where(RealmContact.class).findAll();
    results.deleteAllFromRealm();
    realm.copyToRealmOrUpdate(contacts);
    realm.commitTransaction();
}
 
开发者ID:AppHero2,项目名称:Raffler-Android,代码行数:13,代码来源:AppManager.java

示例12: fromParcel

import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList fromParcel(Parcel parcel) {
    int size = parcel.readInt();
    if (size != -1) {
        RealmList list = new RealmList();
        for (int i = 0; i < size; i++) {
            Parcelable parcelable = parcel.readParcelable(getClass().getClassLoader());
            list.add((RealmObject) Parcels.unwrap(parcelable));
        }
        return list;
    }
    return null;
}
 
开发者ID:Commit451,项目名称:Regalia,代码行数:14,代码来源:RealmListParcelConverter.java

示例13: setFieldLongListNull

import io.realm.RealmList; //导入依赖的package包/类
public void setFieldLongListNull(RealmList<Long> fieldLongListNull) {
    this.fieldLongListNull = fieldLongListNull;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:NullTypes.java

示例14: setFieldShortListNull

import io.realm.RealmList; //导入依赖的package包/类
public void setFieldShortListNull(RealmList<Short> fieldShortListNull) {
    this.fieldShortListNull = fieldShortListNull;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:NullTypes.java

示例15: setRoles

import io.realm.RealmList; //导入依赖的package包/类
public void setRoles(RealmList<Role> roles) {
    this.roles = roles;
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:4,代码来源:User.java


注:本文中的io.realm.RealmList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。