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

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

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

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

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

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

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

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

Loading…
Cancel
Save