From 30bc951dd52eb342b58dd85f4a301237695a7d67 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 20 Nov 2019 20:18:35 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/base/BaseViewModel.kt | 8 ++++---- .../main/java/io/legado/app/service/AudioPlayService.kt | 2 +- app/src/main/java/io/legado/app/web/utils/ReturnData.kt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/BaseViewModel.kt b/app/src/main/java/io/legado/app/base/BaseViewModel.kt index 3610a00a5..c8332e0cc 100644 --- a/app/src/main/java/io/legado/app/base/BaseViewModel.kt +++ b/app/src/main/java/io/legado/app/base/BaseViewModel.kt @@ -45,9 +45,9 @@ open class BaseViewModel(application: Application) : AndroidViewModel(applicatio } } - open fun toast(message: CharSequence) { + open fun toast(message: CharSequence?) { launch { - context.toast(message) + context.toast(message ?: toString()) } } @@ -57,9 +57,9 @@ open class BaseViewModel(application: Application) : AndroidViewModel(applicatio } } - open fun longToast(message: CharSequence) { + open fun longToast(message: CharSequence?) { launch { - context.toast(message) + context.toast(message ?: toString()) } } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 1572dfc99..0b611dd82 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -266,7 +266,7 @@ class AudioPlayService : BaseService(), removeLoading(chapter.index) } }?.onError { - contentLoadFinish(chapter, it.localizedMessage) + contentLoadFinish(chapter, it.localizedMessage ?: toString()) removeLoading(chapter.index) } } diff --git a/app/src/main/java/io/legado/app/web/utils/ReturnData.kt b/app/src/main/java/io/legado/app/web/utils/ReturnData.kt index 5ea07243f..682c4be15 100644 --- a/app/src/main/java/io/legado/app/web/utils/ReturnData.kt +++ b/app/src/main/java/io/legado/app/web/utils/ReturnData.kt @@ -20,7 +20,7 @@ class ReturnData { return errorMsg } - fun setErrorMsg(errorMsg: String): ReturnData { + fun setErrorMsg(errorMsg: String?): ReturnData { this.isSuccess = false this.errorMsg = errorMsg return this