Java 类io.realm.RealmList 实例源码

项目:Raffler-Android    文件:ChatListFragment.java   
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();
                                }
                            }
                        }
                    });
                }
            }
        }
    };
}
项目:GitHub    文件:NullTypes.java   
public RealmList<String> getFieldStringListNull() {
    return fieldStringListNull;
}
项目:Regalia    文件:RealmListGsonConverter.java   
@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;
}
项目:GitHub    文件:GoldMainPresenter.java   
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));
}
项目:lostfilm-android-client    文件:Season.java   
public Season(String id, String name, boolean hasFullSeasonDownloadUrl, RealmList<Episode> episodes, TvShow tvShow) {
    mId = id;
    mName = name;
    mHasFullSeasonDownloadUrl = hasFullSeasonDownloadUrl;
    mEpisodes = episodes;
    mTvShow = tvShow;
}
项目:Regalia    文件:GsonRealmListTest.java   
@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);
}
项目:GitHub    文件:RealmObservableFactory.java   
@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);
}
项目:GitHub    文件:RealmObservableFactory.java   
@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));
        }
    });
}
项目:Regalia    文件:RealmListLoganSquareConverter.java   
@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;
}
项目:mvvm-template    文件:GsonProvider.java   
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());
}
项目:Raffler-Android    文件:AppManager.java   
/**
 * 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();
}
项目:Regalia    文件:RealmListParcelConverter.java   
@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;
}
项目:GitHub    文件:NullTypes.java   
public void setFieldLongListNull(RealmList<Long> fieldLongListNull) {
    this.fieldLongListNull = fieldLongListNull;
}
项目:GitHub    文件:NullTypes.java   
public void setFieldShortListNull(RealmList<Short> fieldShortListNull) {
    this.fieldShortListNull = fieldShortListNull;
}
项目:Ghost-Android    文件:User.java   
public void setRoles(RealmList<Role> roles) {
    this.roles = roles;
}
项目:GitHub    文件:NullTypes.java   
public RealmList<Short> getFieldShortListNotNull() {
    return fieldShortListNotNull;
}
项目:GitHub    文件:GoldManagerBean.java   
public void setManagerList(RealmList<GoldManagerItemBean> managerList) {
    this.managerList = managerList;
}
项目:GitHub    文件:NullTypes.java   
public void setFieldIntegerListNotNull(RealmList<Integer> fieldIntegerListNotNull) {
    this.fieldIntegerListNotNull = fieldIntegerListNotNull;
}
项目:GitHub    文件:AllTypesPrimaryKey.java   
public RealmList<DogPrimaryKey> getColumnRealmList() {
    return columnRealmList;
}
项目:Kutuk    文件:GameObject.java   
public RealmList<Link> getLinks() {
    return links;
}
项目:GitHub    文件:AllJavaTypes.java   
public void setFieldShortList(RealmList<Short> fieldShortList) {
    this.fieldShortList = fieldShortList;
}
项目:TrackIt-Android    文件:RealmShow.java   
public RealmList<RealmEpisode> getEpisodes() {
    return episodes;
}
项目:TodoRealm    文件:TodoList.java   
public void setTasks(RealmList<Task> tasks) {
    this.tasks = tasks;
}
项目:lostfilm-android-client    文件:TvShow.java   
public RealmList<Season> getSeasons() {
    return mSeasons;
}
项目:GitHub    文件:Person.java   
public void setCats(RealmList<Cat> cats) {
    this.cats = cats;
}
项目:GitHub    文件:AllJavaTypes.java   
public RealmList<Integer> getFieldIntegerList() {
    return fieldIntegerList;
}
项目:GitHub    文件:AllJavaTypes.java   
public void setFieldByteList(RealmList<Byte> fieldByteList) {
    this.fieldByteList = fieldByteList;
}
项目:Guanajoven    文件:Empresa.java   
public void setPromociones(RealmList<Promocion> promociones) {
    this.promociones = promociones;
}
项目:ElephantAsia    文件:ElephantPreviewAdapter.java   
public ElephantPreviewAdapter(Context context, RealmList<Elephant> elephants, boolean remove, boolean favorite) {
  super(context, R.layout.elephant_preview, elephants);
  this.favorite = favorite;
  this.remove = remove;
}
项目:GitHub    文件:NullTypes.java   
public RealmList<Double> getFieldDoubleListNull() {
    return fieldDoubleListNull;
}
项目:GitHub    文件:Person.java   
public void setCats(RealmList<Cat> cats) {
    this.cats = cats;
}
项目:GitHub    文件:AllTypes.java   
public RealmList<AllTypes> getColumnRealmList() {
    return realmGet$columnRealmList();
}
项目:GitHub    文件:AllTypes.java   
public RealmList<AllTypes> realmGet$columnRealmList() {
    return columnRealmList;
}
项目:GitHub    文件:AllTypes.java   
public void realmSet$columnRealmList(RealmList<AllTypes> columnRealmList) {
    this.columnRealmList = columnRealmList;
}
项目:GitHub    文件:NullTypes.java   
public void setFieldListNull(RealmList<NullTypes> fieldListNull) {
    this.fieldListNull = fieldListNull;
}
项目:GitHub    文件:MissingGenericType.java   
public void setList(RealmList list) {
    this.list = list;
}
项目:GitHub    文件:AllJavaTypes.java   
public RealmList<byte[]> getFieldBinaryList() {
    return fieldBinaryList;
}
项目:GitHub    文件:RealmObservableFactory.java   
@Override
protected StrongReferenceCounter<RealmList> initialValue() {
    return new StrongReferenceCounter<>();
}
项目:TrackIt-Android    文件:RealmShow.java   
public void setEpisodes(RealmList<RealmEpisode> episodes) {
    this.episodes = episodes;
}
项目:GitHub    文件:AllTypesPrimaryKey.java   
public RealmList<byte[]> getColumnBinaryList() {
    return columnBinaryList;
}