mirror of
https://github.com/SimpleMobileTools/Simple-Voice-Recorder.git
synced 2025-06-05 21:59:31 +02:00
catch all exceptions thrown at renaming files
This commit is contained in:
@@ -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))
|
||||||
|
@@ -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"
|
||||||
|
Reference in New Issue
Block a user