修改离线地图下载的按钮状态

修改详细信息面板快捷进入新增数据界面
This commit is contained in:
squallzhjch
2023-07-27 17:15:51 +08:00
parent b9e3e4766e
commit 485c2b4b79
13 changed files with 243 additions and 162 deletions

View File

@@ -79,7 +79,6 @@ class OfflineMapDownloadManager(
}
launchNext(id)
}
}
/**

View File

@@ -34,7 +34,7 @@ class OfflineMapDownloadScope(
/**
* 管理观察者,同时只有一个就行了
*/
private val observer = Observer<Any> {}
// private val observer = Observer<Any> {}
// private var lifecycleOwner: LifecycleOwner? = null
/**
@@ -58,7 +58,13 @@ class OfflineMapDownloadScope(
*/
fun pause() {
downloadJob?.cancel("pause")
change(FileDownloadStatus.PAUSE)
launch {
if (cityBean.fileSize == 0L) {
change(FileDownloadStatus.NONE)
} else {
change(FileDownloadStatus.PAUSE)
}
}
}
/**
@@ -99,7 +105,6 @@ class OfflineMapDownloadScope(
* 添加下载任务观察者
*/
fun observer(owner: LifecycleOwner, ob: Observer<OfflineMapCityBean>) {
removeObserver()
// this.lifecycleOwner = owner
downloadData.observe(owner, ob)
}
@@ -167,11 +172,15 @@ class OfflineMapDownloadScope(
}
}
fun removeObserver() {
downloadData.observeForever(observer)
// lifecycleOwner?.let {
downloadData.removeObserver(observer)
// null
// downloadData.observeForever(observer)
//// lifecycleOwner?.let {
// downloadData.removeObserver(observer)
//// null
//// }
// if (lifecycleOwner != null) {
// downloadData.removeObservers(lifecycleOwner!!)
// }
}
}

View File

@@ -248,10 +248,6 @@ class TaskDownloadScope(
//// null
//// }
if (lifecycleOwner != null) {
Log.e(
"jingo",
"移除的上一个监听者 ${lifecycleOwner.hashCode()} ${(lifecycleOwner as BaseViewHolder).tag}"
)
downloadData.removeObservers(lifecycleOwner!!)
}
}