Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Created August 25, 2019 14:10
Show Gist options
  • Save SeongUgJung/6821b1ed88ced81f93bd0932b4e60d6a to your computer and use it in GitHub Desktop.
Save SeongUgJung/6821b1ed88ced81f93bd0932b4e60d6a to your computer and use it in GitHub Desktop.
class GoogleMapProvider: MapProvider {
private val mapCache: BehaviorSubject<Map> = BehaviorSubject.createDefault(DEFAULT)
override fun initMap(): Observable<Map> {
return Observable.create(this::addMapFragment)
.switchMapSingle(this::waitingForLoading)
.doOnNext(mapCache::onNext)
}
override fun getMap(): Observable<Map> = mapCache.hide()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment