feat: 优化代码

pull/133/head
kunfei 5 years ago
parent 0983e43eaf
commit fa4ba277e2
  1. 10
      app/src/main/java/io/legado/app/service/CheckSourceService.kt

@ -64,7 +64,9 @@ class CheckSourceService : BaseService() {
private fun check() { private fun check() {
processIndex++ synchronized(this) {
processIndex++
}
if (processIndex < allIds.size) { if (processIndex < allIds.size) {
val sourceUrl = allIds[processIndex] val sourceUrl = allIds[processIndex]
@ -81,8 +83,10 @@ class CheckSourceService : BaseService() {
checkedIds.size, checkedIds.size,
getString(R.string.progress_show, checkedIds.size, allIds.size) getString(R.string.progress_show, checkedIds.size, allIds.size)
) )
if (processIndex >= allIds.size + threadCount - 1) { synchronized(this) {
stopSelf() if (processIndex >= allIds.size + threadCount - 1) {
stopSelf()
}
} }
} }
} }

Loading…
Cancel
Save