|
|
@ -4,7 +4,6 @@ import android.app.Application |
|
|
|
import android.net.Uri |
|
|
|
import android.net.Uri |
|
|
|
import androidx.documentfile.provider.DocumentFile |
|
|
|
import androidx.documentfile.provider.DocumentFile |
|
|
|
import androidx.lifecycle.MutableLiveData |
|
|
|
import androidx.lifecycle.MutableLiveData |
|
|
|
import io.legado.app.constant.AppPattern.bookFileRegex |
|
|
|
|
|
|
|
import io.legado.app.exception.NoStackTraceException |
|
|
|
import io.legado.app.exception.NoStackTraceException |
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
import io.legado.app.utils.isJson |
|
|
|
import io.legado.app.utils.isJson |
|
|
@ -47,12 +46,7 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo |
|
|
|
importHttpTTS(content, finally) |
|
|
|
importHttpTTS(content, finally) |
|
|
|
else -> errorLiveData.postValue("格式不对") |
|
|
|
else -> errorLiveData.postValue("格式不对") |
|
|
|
} |
|
|
|
} |
|
|
|
(uri.path ?: uri.toString()).matches(bookFileRegex) -> { |
|
|
|
else -> importBookLiveData.postValue(uri) |
|
|
|
importBookLiveData.postValue(uri) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
|
|
|
|
throw NoStackTraceException("暂未支持的本地书籍格式(TXT/UMD/EPUB)") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
onLineImportLive.postValue(uri) |
|
|
|
onLineImportLive.postValue(uri) |
|
|
|