From 532d2b0e8d6547db84f59c44634d73e86f8ec9d5 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 22 Nov 2019 17:23:30 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/data/entities/BookSource.kt | 2 +- app/src/main/java/io/legado/app/service/AudioPlayService.kt | 4 +--- .../main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index d5c5a0f2c..bb0c5fbbb 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -152,7 +152,7 @@ data class BookSource( exploreKinds.add(ExploreKind(d[0], d[1])) } } catch (e: Exception) { - exploreKinds.add(ExploreKind(e.localizedMessage)) + exploreKinds.add(ExploreKind(e.localizedMessage ?: "")) } } } 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 0b611dd82..bd2cc2d75 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -27,7 +27,6 @@ import io.legado.app.help.MediaHelp import io.legado.app.receiver.MediaButtonReceiver import io.legado.app.service.help.AudioPlay import io.legado.app.ui.audio.AudioPlayActivity -import io.legado.app.utils.LogUtils import io.legado.app.utils.postEvent import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch @@ -121,9 +120,8 @@ class AudioPlayService : BaseService(), mediaPlayer.setDataSource(url) mediaPlayer.prepareAsync() } catch (e: Exception) { - LogUtils.d("AudioPlayService", e.localizedMessage + " " + url) launch { - toast(e.localizedMessage + " " + url) + toast("$url ${e.localizedMessage}") stopSelf() } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 81d1858b5..5d44e867e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -204,7 +204,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { removeLoading(chapter.index) } }?.onError { - contentLoadFinish(chapter, it.localizedMessage) + contentLoadFinish(chapter, it.localizedMessage ?: "未知错误") removeLoading(chapter.index) } }