59 lines
1.6 KiB
Kotlin
59 lines
1.6 KiB
Kotlin
package org.moire.ultrasonic.fragment
|
|
|
|
import android.os.Bundle
|
|
import android.view.View
|
|
import androidx.core.view.isVisible
|
|
import androidx.lifecycle.LiveData
|
|
import androidx.lifecycle.viewModelScope
|
|
import kotlinx.coroutines.launch
|
|
import org.moire.ultrasonic.R
|
|
import org.moire.ultrasonic.adapters.BaseAdapter
|
|
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
|
import org.moire.ultrasonic.domain.MusicDirectory
|
|
import org.moire.ultrasonic.fragment.FragmentTitle.Companion.setTitle
|
|
|
|
/**
|
|
* Lists the Bookmarks available on the server
|
|
*
|
|
* Bookmarks allows to save the play position of tracks, especially useful for longer tracks like
|
|
* audio books etc.
|
|
*
|
|
* Therefore this fragment allows only for singular selection and playback.
|
|
*
|
|
* // FIXME: use restore for playback
|
|
*/
|
|
class BookmarksFragment : TrackCollectionFragment() {
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
setTitle(this, R.string.button_bar_bookmarks)
|
|
|
|
viewAdapter.selectionType = BaseAdapter.SelectionType.SINGLE
|
|
}
|
|
|
|
override fun setupButtons(view: View) {
|
|
super.setupButtons(view)
|
|
|
|
// Hide select all button
|
|
//selectButton?.visibility = View.GONE
|
|
//moreButton?.visibility = View.GONE
|
|
}
|
|
|
|
override fun getLiveData(args: Bundle?): LiveData<List<MusicDirectory.Entry>> {
|
|
listModel.viewModelScope.launch(handler) {
|
|
refreshListView?.isRefreshing = true
|
|
listModel.getBookmarks()
|
|
refreshListView?.isRefreshing = false
|
|
}
|
|
return listModel.currentList
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|