catch and show errors thrown at playing a recording

This commit is contained in:
tibbi
2020-05-20 22:56:50 +02:00
parent f32a28c1a1
commit 8c58532e62
2 changed files with 10 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.27.6' implementation 'com.simplemobiletools:commons:5.28.14'
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.github.Armen101:AudioRecordView:1.0.2' implementation 'com.github.Armen101:AudioRecordView:1.0.2'
} }

View File

@@ -42,7 +42,7 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
override fun onResume() { override fun onResume() {
setupColors() setupColors()
if (!prevSavePath.isEmpty() && context!!.config.saveRecordingsFolder != prevSavePath) { if (prevSavePath.isNotEmpty() && context!!.config.saveRecordingsFolder != prevSavePath) {
setupAdapter() setupAdapter()
} else { } else {
getRecordingsAdapter()?.updateTextColor(context.config.textColor) getRecordingsAdapter()?.updateTextColor(context.config.textColor)
@@ -269,11 +269,15 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
player!!.apply { player!!.apply {
reset() reset()
try {
if (isQPlus()) { if (isQPlus()) {
setDataSource(context, getAudioFileContentUri(recording.id.toLong())) setDataSource(context, getAudioFileContentUri(recording.id.toLong()))
} else { } else {
setDataSource(recording.path) setDataSource(recording.path)
} }
} catch (e: Exception) {
context?.showErrorToast(e)
}
prepareAsync() prepareAsync()
} }