Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt
pull/1866/head
kunfei 3 years ago
commit 67aa4eb085
  1. 12
      app/src/main/java/io/legado/app/ui/association/FileAssociationViewModel.kt
  2. 1
      app/src/main/res/values-es-rES/strings.xml
  3. 1
      app/src/main/res/values-ja-rJP/strings.xml
  4. 1
      app/src/main/res/values-pt-rBR/strings.xml
  5. 1
      app/src/main/res/values-zh-rHK/strings.xml
  6. 1
      app/src/main/res/values-zh-rTW/strings.xml
  7. 1
      app/src/main/res/values-zh/strings.xml
  8. 3
      app/src/main/res/values/strings.xml

@ -4,13 +4,16 @@ import android.app.Application
import android.net.Uri
import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.MutableLiveData
import io.legado.app.R
import io.legado.app.constant.AppPattern.bookFileRegex
import io.legado.app.exception.NoStackTraceException
import io.legado.app.lib.dialogs.alert
import io.legado.app.model.localBook.LocalBook
import io.legado.app.utils.isJson
import io.legado.app.utils.printOnDebug
import io.legado.app.utils.readText
import java.io.File
import splitties.init.appCtx
class FileAssociationViewModel(application: Application) : BaseAssociationViewModel(application) {
val importBookLiveData = MutableLiveData<Uri>()
@ -37,11 +40,16 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
content.isJson() -> {
importJson(content)
}
fileName.matches(bookFileRegex) -> {
!fileName.matches(bookFileRegex) -> {
appCtx.alert(title = appCtx.getString(R.string.draw), message = appCtx.getString(R.string.file_not_supported, fileName)) {
okButton {
importBookLiveData.postValue(uri)
}
cancelButton()
}
}
else -> {
throw NoStackTraceException("$fileName 暂未支持的本地书籍格式(TXT/UMD/EPUB)")
importBookLiveData.postValue(uri)
}
}
} else {

@ -974,5 +974,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">Continue to open although %1$s is not supported ?</string>
<!-- string end -->
</resources>

@ -977,5 +977,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">Continue to open although %1$s is not supported ?</string>
<!-- string end -->
</resources>

@ -977,5 +977,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">Continue to open although %1$s is not supported ?</string>
<!-- string end -->
</resources>

@ -974,5 +974,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">文件%1$s 不受支持,是否继续打开?</string>
<!-- string end -->
</resources>

@ -976,5 +976,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">文件%1$s 不受支持,是否继续打开?</string>
<!-- string end -->
</resources>

@ -976,5 +976,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">文件%1$s 不受支持,是否继续打开?</string>
<!-- string end -->
</resources>

@ -977,7 +977,6 @@
<string name="input_verification_code">输入验证码</string>
<string name="verification_code">验证码</string>
<string name="timeout_millisecond">超时毫秒数</string>
<string name="file_not_supported">Continue to open although %1$s is not supported ?</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save