mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-06-03 00:51:18 +03:00
Don't sort playlists even when Sort by Disc is activated
This commit is contained in:
parent
e729e3b063
commit
a97c6e15e9
@ -29,7 +29,8 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import org.koin.java.KoinJavaComponent.inject
|
import org.koin.core.component.KoinComponent
|
||||||
|
import org.koin.core.component.inject
|
||||||
import org.moire.ultrasonic.NavigationGraphDirections
|
import org.moire.ultrasonic.NavigationGraphDirections
|
||||||
import org.moire.ultrasonic.R
|
import org.moire.ultrasonic.R
|
||||||
import org.moire.ultrasonic.api.subsonic.ApiNotSupportedException
|
import org.moire.ultrasonic.api.subsonic.ApiNotSupportedException
|
||||||
@ -55,15 +56,13 @@ import org.moire.ultrasonic.util.Util.toast
|
|||||||
*
|
*
|
||||||
* TODO: This file has been converted from Java, but not modernized yet.
|
* TODO: This file has been converted from Java, but not modernized yet.
|
||||||
*/
|
*/
|
||||||
class PlaylistsFragment : Fragment() {
|
class PlaylistsFragment : Fragment(), KoinComponent {
|
||||||
private var refreshPlaylistsListView: SwipeRefreshLayout? = null
|
private var refreshPlaylistsListView: SwipeRefreshLayout? = null
|
||||||
private var playlistsListView: ListView? = null
|
private var playlistsListView: ListView? = null
|
||||||
private var emptyTextView: View? = null
|
private var emptyTextView: View? = null
|
||||||
private var playlistAdapter: ArrayAdapter<Playlist>? = null
|
private var playlistAdapter: ArrayAdapter<Playlist>? = null
|
||||||
|
|
||||||
private val downloadHandler = inject<DownloadHandler>(
|
private val downloadHandler by inject<DownloadHandler>()
|
||||||
DownloadHandler::class.java
|
|
||||||
)
|
|
||||||
|
|
||||||
private var cancellationToken: CancellationToken? = null
|
private var cancellationToken: CancellationToken? = null
|
||||||
|
|
||||||
@ -148,7 +147,7 @@ class PlaylistsFragment : Fragment() {
|
|||||||
val playlist = playlistsListView!!.getItemAtPosition(info.position) as Playlist
|
val playlist = playlistsListView!!.getItemAtPosition(info.position) as Playlist
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.playlist_menu_pin -> {
|
R.id.playlist_menu_pin -> {
|
||||||
downloadHandler.value.justDownload(
|
downloadHandler.justDownload(
|
||||||
DownloadAction.PIN,
|
DownloadAction.PIN,
|
||||||
fragment = this,
|
fragment = this,
|
||||||
id = playlist.id,
|
id = playlist.id,
|
||||||
@ -158,7 +157,7 @@ class PlaylistsFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.playlist_menu_unpin -> {
|
R.id.playlist_menu_unpin -> {
|
||||||
downloadHandler.value.justDownload(
|
downloadHandler.justDownload(
|
||||||
DownloadAction.UNPIN,
|
DownloadAction.UNPIN,
|
||||||
fragment = this,
|
fragment = this,
|
||||||
id = playlist.id,
|
id = playlist.id,
|
||||||
@ -168,7 +167,7 @@ class PlaylistsFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.playlist_menu_download -> {
|
R.id.playlist_menu_download -> {
|
||||||
downloadHandler.value.justDownload(
|
downloadHandler.justDownload(
|
||||||
DownloadAction.DOWNLOAD,
|
DownloadAction.DOWNLOAD,
|
||||||
fragment = this,
|
fragment = this,
|
||||||
id = playlist.id,
|
id = playlist.id,
|
||||||
|
@ -40,7 +40,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
|
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getMusicDirectory(id, name, refresh)
|
val musicDirectory = service.getMusicDirectory(id, name, refresh)
|
||||||
|
currentListIsSortable = true
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
|
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory: MusicDirectory = service.getAlbumAsDir(id, name, refresh)
|
val musicDirectory: MusicDirectory = service.getAlbumAsDir(id, name, refresh)
|
||||||
|
currentListIsSortable = true
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,6 +60,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getSongsByGenre(genre, count, offset)
|
val musicDirectory = service.getSongsByGenre(genre, count, offset)
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory, append)
|
updateList(musicDirectory, append)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +77,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
} else {
|
} else {
|
||||||
Util.getSongsFromSearchResult(service.getStarred())
|
Util.getSongsFromSearchResult(service.getStarred())
|
||||||
}
|
}
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,8 +88,8 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val videos = service.getVideos(refresh)
|
val videos = service.getVideos(refresh)
|
||||||
|
|
||||||
if (videos != null) {
|
if (videos != null) {
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(videos)
|
updateList(videos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,19 +100,16 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getRandomSongs(size)
|
val musicDirectory = service.getRandomSongs(size)
|
||||||
|
|
||||||
currentListIsSortable = false
|
currentListIsSortable = false
|
||||||
|
|
||||||
updateList(musicDirectory, append)
|
updateList(musicDirectory, append)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getPlaylist(playlistId: String, playlistName: String) {
|
suspend fun getPlaylist(playlistId: String, playlistName: String) {
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getPlaylist(playlistId, playlistName)
|
val musicDirectory = service.getPlaylist(playlistId, playlistName)
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,8 +119,8 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getPodcastEpisodes(podcastChannelId)
|
val musicDirectory = service.getPodcastEpisodes(podcastChannelId)
|
||||||
|
|
||||||
if (musicDirectory != null) {
|
if (musicDirectory != null) {
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +142,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +151,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = Util.getSongsFromBookmarks(service.getBookmarks())
|
val musicDirectory = Util.getSongsFromBookmarks(service.getBookmarks())
|
||||||
|
currentListIsSortable = false
|
||||||
updateList(musicDirectory)
|
updateList(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user