This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface EndlessObserver<T> { | |
void onNext(T t); | |
void onNextError(Throwable t); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends ActionBarActivity { | |
//... | |
@Override protected void onStart() { | |
super.onStart(); | |
subscriptions.add(repoService.getRepoListObservable().subscribe(new Action1<Observable<List<Repo>>>() { | |
@Override public void call(Observable<List<Repo>> listObservable) { | |
showProgress(); | |
subscriptions.add(listObservable.subscribe(new Action1<List<Repo>>() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WeatherUseCase( | |
private val locationManager: LocationManager, | |
private val repository: TemperatureRepository) { | |
suspend fun getCityData(): String = coroutineScope { | |
try { | |
val location = locationManager.getLastLocation() | |
val cities = async { locationManager.getCities(location) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(modules = [WeatherModule::class]) | |
@WeatherSingleton | |
interface WeatherComponent { | |
val temperatureRepository: TemperatureRepository | |
} | |
//... | |
@Component(modules = [LocationModule::class]) | |
@LocationSingleton | |
interface LocationComponent { | |
val locationManager: LocationManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DomainSingleton | |
@Component(dependencies = [ | |
LocationComponent::class, WeatherComponent::class]) | |
interface DomainComponent { | |
val weatherUseCase: WeatherUseCase | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DomainSingleton | |
class WeatherUseCase @Inject constructor( | |
private val locationManager: LocationManager, | |
private val repository: TemperatureRepository) { | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DomainSingleton | |
@Component(dependencies = [DomainDependencies::class]) | |
interface DomainComponent { | |
val weatherUseCase: WeatherUseCase | |
} | |
interface DomainDependencies { | |
val locationManager: LocationManager | |
val temperatureRepository: TemperatureRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DomainDependenciesImpl( | |
private val locationComponent: LocationComponent, | |
private val weatherComponent: WeatherComponent | |
) : DomainDependencies { | |
override val locationManager: LocationManager | |
get() = locationComponent.locationManager | |
override val temperatureRepository: TemperatureRepository | |
get() = weatherComponent.temperatureRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DomainDependenciesSingleton | |
@Component(dependencies = [ | |
LocationComponent::class, WeatherComponent::class | |
]) | |
interface DomainDependenciesImpl : DomainDependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface WeatherComponent { | |
val temperatureRepository: TemperatureRepository | |
} | |
@Component( | |
modules = [WeatherModule::class] | |
) | |
@WeatherSingleton | |
interface WeatherComponentImpl : WeatherComponent |
OlderNewer