mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
Merge pull request #3358 from kiwix/Issue#3341
Fixed deprecated constructor of `FileObserver`
This commit is contained in:
commit
2e749b41cd
@ -18,6 +18,7 @@
|
||||
package org.kiwix.kiwixmobile.zimManager
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.os.FileObserver
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.functions.BiFunction
|
||||
@ -62,12 +63,20 @@ class Fat32Checker constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun fileObserver(it: String?): FileObserver {
|
||||
return object : FileObserver(it, MOVED_FROM or DELETE) {
|
||||
override fun onEvent(event: Int, path: String?) {
|
||||
requestCheckSystemFileType.onNext(Unit)
|
||||
}
|
||||
}.apply { startWatching() }
|
||||
private fun fileObserver(it: String): FileObserver {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
return object : FileObserver(File(it), MOVED_FROM or DELETE) {
|
||||
override fun onEvent(event: Int, path: String?) {
|
||||
requestCheckSystemFileType.onNext(Unit)
|
||||
}
|
||||
}.apply { startWatching() }
|
||||
} else {
|
||||
object : FileObserver(it, FileObserver.MOVED_FROM or FileObserver.DELETE) {
|
||||
override fun onEvent(event: Int, path: String?) {
|
||||
requestCheckSystemFileType.onNext(Unit)
|
||||
}
|
||||
}.apply { startWatching() }
|
||||
}
|
||||
}
|
||||
|
||||
private fun toFileSystemState(it: String) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user