Skip to content

Instantly share code, notes, and snippets.

View ZherebtsovAlexandr's full-sized avatar

mansonheart ZherebtsovAlexandr

View GitHub Profile
@ZherebtsovAlexandr
ZherebtsovAlexandr / getData.kt
Last active September 14, 2018 14:57
Integration Realm DataBase и kotlinx.coroutines
fun getData() = produce<List<Data>>(LooperThread) {
var results = realm.where(Data::class.java).findAll()
send(map(results))
results.addChangeListener { results ->
run {
launch(LooperThread) {
send(map(results))
}
}
}
public interface RedditRepository {
Single<List<Reddit>> getPosts(String query, String restrict, String sort, String nsfw, int limit, String date);
Single<List<Reddit>> getPostsAfter(String query, String restrict, String sort, String nsfw, int limit, String date, String after);
Single<List<Reddit>> getHistory();
Single<List<Reddit>> getHistoryAfter(int date);
Single<List<Reddit>> getFavorite();
Single<List<Reddit>> getFavoriteAfter(int date);
}
public class SearchPlaceInteractorImpl extends SearchOffsetLimitIneractor {
private final PlaceDataProvider placeDataProvider;
public SearchPlaceInteractorImpl(ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread,
PlaceDataProvider placeDataProvider) {
super(threadExecutor, postExecutionThread);
this.placeDataProvider = placeDataProvider;
@ZherebtsovAlexandr
ZherebtsovAlexandr / GetEventDetailsInteractorImpl
Created May 9, 2017 18:04
GetEventDetailsInteractorImpl
public class GetEventDetailsInteractorImpl extends GetEventDetailsInteractor {
private final EventDataProvider eventDataProvider;
public GetEventDetailsInteractorImpl(int eventId,
ThreadExecutor threadExecutor,
PostExecutionThread postExecutionThread,
EventDataProvider eventDataProvider) {
super(threadExecutor, postExecutionThread);
/**
* Copyright (C) 2015 Fernando Cejas Open Source Project
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
public class MediumCardDelegate extends AdapterDelegate<List<EntityViewModel>> {
private final Context context;
private final ImageManager imageManager;
private final DeviceManager deviceManager;
public class Main {
public static void main(String[] args) {
final Emitter<String>[] emitter = new Emitter[]{null};
Observable<Integer> integerObservable = Observable.just(0, 1, 2, 3, 4)
.concatMap(integer -> {
if (emitter[0] != null) {
emitter[0].onCompleted();