catch all exceptions thrown at renaming files

This commit is contained in:
tibbi
2022-06-24 21:33:37 +02:00
parent d76a6ea6a7
commit edfbe52caa
2 changed files with 3 additions and 3 deletions

View File

@@ -133,8 +133,6 @@ class MainActivity : SimpleActivity() {
main_tabs_holder.getTabAt(config.lastUsedViewPagerPage)?.select() main_tabs_holder.getTabAt(config.lastUsedViewPagerPage)?.select()
} }
private fun getPagerAdapter() = (view_pager.adapter as? ViewPagerAdapter)
private fun setupTabColors() { private fun setupTabColors() {
val activeView = main_tabs_holder.getTabAt(view_pager.currentItem)?.customView val activeView = main_tabs_holder.getTabAt(view_pager.currentItem)?.customView
val inactiveView = main_tabs_holder.getTabAt(getInactiveTabIndex())?.customView val inactiveView = main_tabs_holder.getTabAt(getInactiveTabIndex())?.customView
@@ -149,6 +147,8 @@ class MainActivity : SimpleActivity() {
private fun getInactiveTabIndex() = if (view_pager.currentItem == 0) 1 else 0 private fun getInactiveTabIndex() = if (view_pager.currentItem == 0) 1 else 0
private fun getPagerAdapter() = (view_pager.adapter as? ViewPagerAdapter)
private fun launchSettings() { private fun launchSettings() {
hideKeyboard() hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java)) startActivity(Intent(applicationContext, SettingsActivity::class.java))

View File

@@ -69,7 +69,7 @@ class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Rec
// if the old way of renaming fails, try the new SDK 30 one on Android 11+ // if the old way of renaming fails, try the new SDK 30 one on Android 11+
try { try {
activity.contentResolver.update(getAudioFileContentUri(recording.id.toLong()), values, null, null) activity.contentResolver.update(getAudioFileContentUri(recording.id.toLong()), values, null, null)
} catch (e: SecurityException) { } catch (e: Exception) {
try { try {
val path = "${activity.config.saveRecordingsFolder}/${recording.title}" val path = "${activity.config.saveRecordingsFolder}/${recording.title}"
val newPath = "${path.getParentPath()}/$newDisplayName" val newPath = "${path.getParentPath()}/$newDisplayName"