private static OrderedRealmCollection<MediaItem> getResults(Album album, String query) { switch (Media.getMediaSortType()) { case ALPHABETICAL: { return album.getMedia().where().contains("name", query).findAll().sort("name", Media.isMediaSortAscending() ? Sort.ASCENDING : Sort.DESCENDING); } case DATE: { return album.getMedia().where().contains("name", query).findAll().sort("date", Media.isMediaSortAscending() ? Sort.ASCENDING : Sort.DESCENDING); } } return null; }
@Override public void updateResults(final OrderedRealmCollection<T> realmResults) { monarchy.doWithRealm(new Monarchy.RealmBlock() { @Override public void doWithRealm(Realm realm) { List<U> list = new LinkedList<>(); for(T t: realmResults) { list.add(mapper.map(t)); } postValue(Collections.unmodifiableList(new ArrayList<U>(list))); } }); }
@Override public void updateResults(final OrderedRealmCollection<T> realmCollection) { monarchy.doWithRealm(new Monarchy.RealmBlock() { @Override public void doWithRealm(Realm realm) { postValue(realm.copyFromRealm(realmCollection)); } }); }
private void displaySearchResult() { OrderedRealmCollection<Elephant> realmResults = searchElephants(); if (!realmResults.isEmpty()) { adapter = new RealmElephantAdapter(realmResults, this, false, true); listView.setAdapter(adapter); } else { listView.setVisibility(View.GONE); noResult.setVisibility(View.VISIBLE); } }
@Nullable public static OrderedRealmCollection<Device> getAllUserDevices() { User user = repo.getCurrentUser(); if (user == null) return null; return repo.getDevices(user); }
@Override public void onDrop(int fromPosition, int toPosition) { OrderedRealmCollection list = getData(); list.add(toPosition, list.remove(fromPosition)); if (mDragListener != null) { mDragListener.onDrop(fromPosition, toPosition); } }
@Test public void setupMap_shouldCallViewPopulateMap() { //noinspection unchecked OrderedRealmCollection<Cache> caches = mock(OrderedRealmCollection.class); when(databaseInteractor.getGeocaches()).thenReturn(Single.just(caches)); mapPresenter.setupMap(); verify(view, times(1)).addMapMarkers(caches); }
@Test public void setupMap_errorDoesNothing() { when(databaseInteractor.getGeocaches()). thenReturn(Single.<OrderedRealmCollection<Cache>>error(new Throwable("Error"))); mapPresenter.setupMap(); verify(view, never()).addMapMarkers(anyListOf(Cache.class)); }
MyRecyclerViewAdapter(OrderedRealmCollection<Item> data) { super(data, true); // Only set this if the model class has a primary key that is also a integer or long. // In that case, {@code getItemId(int)} must also be overridden to return the key. // See https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#hasStableIds() // See https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#getItemId(int) setHasStableIds(true); }
public KRealmRecyclerViewAdapter(@NonNull Context context, @Nullable OrderedRealmCollection<T> data, boolean autoUpdate) { super(context, data, autoUpdate); }
public CatAdapter(@Nullable OrderedRealmCollection<Cat> data) { super(data, true); }
public MoviesWatchLaterAdapter(@Nullable OrderedRealmCollection<Movie> data, boolean autoUpdate, OnClickMovieItemListener onClickItemListener) { super(data, autoUpdate); this.onClickMovieItemListener = onClickItemListener; }
public TvSeriesWatchLaterAdapter(@Nullable OrderedRealmCollection<TvSeries> data, boolean autoUpdate, OnClickTvSeriesItemListener onClickTvSeriesItemListener) { super(data, autoUpdate); this.onClickTvSeriesItemListener = onClickTvSeriesItemListener; }
CommonAdapter(Context context, OrderedRealmCollection<T> items) { super(context, items, true); }
public TaskListAdapter(Context context, OrderedRealmCollection<TaskList> items) { super(context, items); }
public TaskAdapter(Context context, OrderedRealmCollection<Task> items) { super(context, items); }
public RealmElephantAdapter(OrderedRealmCollection<Elephant> realmResults, Context context, boolean remove, boolean favorite) { super(realmResults); this.context = context; this.favorite = favorite; this.remove = remove; }
LogRecyclerViewAdapter(LogFragment fragment, OrderedRealmCollection<ReadingData> data) { super(data, true); this.fragment = fragment; PreferenceManager.getDefaultSharedPreferences(fragment.getContext()).registerOnSharedPreferenceChangeListener(this); }
public NoteAdapter(@Nullable OrderedRealmCollection<Note> data) { super(data, true); // Realm always auto-updates setHasStableIds(true); }
public DevicesRVAdapter(Context context, OrderedRealmCollection<Device> data) { super(context, data, true); this.mContext = context; }
public DragRealmAdapter(Context context, OrderedRealmCollection data, boolean autoUpdate) { super(data, autoUpdate); this.context = context; }
RealmExamAdapter(Context context, OrderedRealmCollection data, boolean autoUpdate) { super(context, data, autoUpdate); }
public DevicesAdapter(Context context, OrderedRealmCollection<Device> data) { super(context, data); }
public FavoriteAdapter(Context context, OrderedRealmCollection<PageDetailInfo> data) { this.mContext = context; this.mDataset = data; }
public CacheAdapter(Context context, OrderedRealmCollection<Cache> data, boolean autoUpdate) { super(context, data, autoUpdate); }
public OrderedRealmCollection<Item> getItems() { return items; }
public FolderSpinnerAdapter(Context context, OrderedRealmCollection<Folder> folders) { this.rootFolder = context.getString(R.string.root_folder); this.folders = folders; }
public MyAdapter(Context context, OrderedRealmCollection<Cat> cats) { super(context, cats); this.mContext = context; }
public StarAdapter(AnimeListFragment activity, OrderedRealmCollection<Anime> animeList) { super(activity, animeList); }
public AnimeAdapter(AnimeListFragment fragment, OrderedRealmCollection<Anime> animeList) { super(fragment.getContext(), animeList, true); this.fragment = fragment; this.ctx = fragment.getContext(); this.animeList = animeList; }
public HorizontalAdapter(HomeFragment fragment, OrderedRealmCollection<Anime> animeList) { super(fragment.getContext(), animeList, true); this.fragment = fragment; this.ctx = fragment.getContext(); this.animeList = animeList; }
public FullSearchAdapter(@NonNull Context context, @Nullable OrderedRealmCollection<Anime> data, FullSearchAdapter.OnClickListener onClickListener) { super(context, data, true); this.list = data; this.listener = onClickListener; }
public AvailableNetworksAdapter(@NonNull Context context, @Nullable OrderedRealmCollection<NetworkItem> data) { super(context, data); }
public ScannedNetworksAdapter(@NonNull Context context, @Nullable OrderedRealmCollection<NetworkItem> data) { super(context, data); }
MyListAdapter(OrderedRealmCollection<Item> realmResults) { super(realmResults); }
public ListViewTestAdapter(Context context, OrderedRealmCollection<AllJavaTypes> realmResults) { super(realmResults); inflater = LayoutInflater.from(context); }
public RecyclerViewTestAdapter(final Context context, final OrderedRealmCollection<AllJavaTypes> realmResults, final boolean automaticUpdate) { super(realmResults, automaticUpdate); inflater = LayoutInflater.from(context); setHasStableIds(true); }
protected RealmBindingAdapter(@LayoutRes int layoutId, @Nullable OrderedRealmCollection<E> data) { super(data, true); mLayoutId = layoutId; }
public RoomTimetableAdapter(@NonNull final Realm realm, @Nullable final OrderedRealmCollection<LessonRoom> data) { super(data); this.realm = realm; }