|
|
@@ -31,6 +31,8 @@ class MainViewModel(private val api: MapAPI) : BaseViewModel() {
|
|
|
val isOilEnabled = ObservableBoolean(false)
|
|
|
// 새로고침 버튼 활성화 여부
|
|
|
val isRefreshEnabled = ObservableBoolean(false)
|
|
|
+ // 로딩바 노출 여부
|
|
|
+ val isLoading = ObservableBoolean(false)
|
|
|
private val locationList = mutableListOf<Document>()
|
|
|
|
|
|
var currentHospitalPage = 1
|
|
|
@@ -52,16 +54,18 @@ class MainViewModel(private val api: MapAPI) : BaseViewModel() {
|
|
|
if (requests.isNotEmpty()) {
|
|
|
addToDisposable(
|
|
|
Observable.mergeDelayError(getMergeRequest(mapPoint))
|
|
|
+ .doOnSubscribe { isLoading.set(true) }
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe({
|
|
|
-// responseCount++
|
|
|
if (it.documents.isNotEmpty()) {
|
|
|
locationList.addAll(it.documents)
|
|
|
checkEnd(it)
|
|
|
}
|
|
|
}, {
|
|
|
+ isLoading.set(false)
|
|
|
it.printStackTrace()
|
|
|
}, {
|
|
|
+ isLoading.set(false)
|
|
|
if (locationList.isNotEmpty()) {
|
|
|
getCategories(locationList, isMore)
|
|
|
}
|