moving a function at the top

This commit is contained in:
tibbi 2022-11-04 23:10:44 +01:00
parent 6f427b6ca1
commit 835559403a

View file

@ -189,6 +189,18 @@ class TracksActivity : SimpleActivity() {
bus?.unregister(this)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
try {
val outputStream = contentResolver.openOutputStream(resultData.data!!)
exportPlaylistTo(outputStream)
} catch (e: Exception) {
showErrorToast(e)
}
}
}
private fun refreshMenuItems() {
tracks_toolbar.menu.apply {
findItem(R.id.search).isVisible = tracksType != TYPE_ALBUM
@ -395,18 +407,6 @@ class TracksActivity : SimpleActivity() {
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
try {
val outputStream = contentResolver.openOutputStream(resultData.data!!)
exportPlaylistTo(outputStream)
} catch (e: Exception) {
showErrorToast(e)
}
}
}
private fun exportPlaylistTo(outputStream: OutputStream?) {
val tracks = (tracks_list.adapter as TracksAdapter).tracks