update the recordings in case the save folder changes

This commit is contained in:
tibbi
2020-04-02 19:06:52 +02:00
parent a97731ee86
commit f009b32c2b
2 changed files with 11 additions and 1 deletions

View File

@ -38,9 +38,14 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
private var progressTimer = Timer() private var progressTimer = Timer()
private var playedRecordingIDs = Stack<Int>() private var playedRecordingIDs = Stack<Int>()
private var bus: EventBus? = null private var bus: EventBus? = null
private var prevSavePath = ""
override fun onResume() { override fun onResume() {
setupColors() setupColors()
if (!prevSavePath.isEmpty() && context!!.config.saveRecordingsFolder != prevSavePath) {
setupAdapter()
}
storePrevPath()
} }
override fun onDestroy() { override fun onDestroy() {
@ -61,6 +66,7 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
setupAdapter() setupAdapter()
initMediaPlayer() initMediaPlayer()
setupViews() setupViews()
storePrevPath()
} }
private fun setupViews() { private fun setupViews() {
@ -361,6 +367,10 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
private fun getRecordingsAdapter() = recordings_list.adapter as? RecordingsAdapter private fun getRecordingsAdapter() = recordings_list.adapter as? RecordingsAdapter
private fun storePrevPath() {
prevSavePath = context!!.config.saveRecordingsFolder
}
private fun setupColors() { private fun setupColors() {
recordings_fastscroller.updatePrimaryColor() recordings_fastscroller.updatePrimaryColor()
recordings_fastscroller.updateBubbleColors() recordings_fastscroller.updateBubbleColors()

View File

@ -4,7 +4,7 @@
<string name="recording_saved_successfully">Nahrávka bola uložená ako \n\"%s\"</string> <string name="recording_saved_successfully">Nahrávka bola uložená ako \n\"%s\"</string>
<string name="recording">Nahráva sa</string> <string name="recording">Nahráva sa</string>
<string name="no_recordings_found">Nenašli sa žiadne nahrávky\nvytvorené touto aplikáciou</string> <string name="no_recordings_found">Nenašli sa žiadne nahrávky\nvytvorené touto aplikáciou</string>
<string name="no_recordings_in_folder_found">V zvolenom priečinku sa nenašli\nžiadne nahrávky</string> <string name="no_recordings_in_folder_found">Vo zvolenom priečinku sa nenašli\nžiadne nahrávky</string>
<!-- Confirmation dialog --> <!-- Confirmation dialog -->
<string name="delete_recordings_confirmation">Ste si istý, že chcete odstrániť %s?</string> <!-- Are you sure you want to delete 5 recordings? --> <string name="delete_recordings_confirmation">Ste si istý, že chcete odstrániť %s?</string> <!-- Are you sure you want to delete 5 recordings? -->