當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。