Merge branch 'develop' into fix-debug-file-size2
This commit is contained in:
commit
e8c31db90f
|
@ -13,7 +13,7 @@ fun APISearchResult.toDomainEntity(): SearchResult = SearchResult(
|
||||||
)
|
)
|
||||||
|
|
||||||
fun SearchTwoResult.toDomainEntity(): SearchResult = SearchResult(
|
fun SearchTwoResult.toDomainEntity(): SearchResult = SearchResult(
|
||||||
this.artistList.map { it.toDomainEntity() },
|
this.artistList.map { it.toIndexEntity() },
|
||||||
this.albumList.map { it.toDomainEntity() },
|
this.albumList.map { it.toDomainEntity() },
|
||||||
this.songList.map { it.toTrackEntity() }
|
this.songList.map { it.toTrackEntity() }
|
||||||
)
|
)
|
||||||
|
|
|
@ -46,6 +46,7 @@ import org.moire.ultrasonic.util.Constants
|
||||||
import org.moire.ultrasonic.util.EntryByDiscAndTrackComparator
|
import org.moire.ultrasonic.util.EntryByDiscAndTrackComparator
|
||||||
import org.moire.ultrasonic.util.Settings
|
import org.moire.ultrasonic.util.Settings
|
||||||
import org.moire.ultrasonic.util.Util
|
import org.moire.ultrasonic.util.Util
|
||||||
|
import org.moire.ultrasonic.util.Util.toast
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a group of tracks, eg. the songs of an album, of a playlist etc.
|
* Displays a group of tracks, eg. the songs of an album, of a playlist etc.
|
||||||
|
@ -246,9 +247,10 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun playNow(append: Boolean) {
|
private fun playNow(
|
||||||
val selectedSongs = getSelectedSongs()
|
append: Boolean,
|
||||||
|
selectedSongs: List<MusicDirectory.Entry> = getSelectedSongs()
|
||||||
|
) {
|
||||||
if (selectedSongs.isNotEmpty()) {
|
if (selectedSongs.isNotEmpty()) {
|
||||||
downloadHandler.download(
|
downloadHandler.download(
|
||||||
this, append, false, !append, playNext = false,
|
this, append, false, !append, playNext = false,
|
||||||
|
@ -374,7 +376,10 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
downloadBackground(save, songs)
|
downloadBackground(save, songs)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun downloadBackground(save: Boolean, songs: List<MusicDirectory.Entry?>) {
|
private fun downloadBackground(
|
||||||
|
save: Boolean,
|
||||||
|
songs: List<MusicDirectory.Entry?>
|
||||||
|
) {
|
||||||
val onValid = Runnable {
|
val onValid = Runnable {
|
||||||
networkAndStorageChecker.warnIfNetworkOrStorageUnavailable()
|
networkAndStorageChecker.warnIfNetworkOrStorageUnavailable()
|
||||||
mediaPlayerController.downloadBackground(songs, save)
|
mediaPlayerController.downloadBackground(songs, save)
|
||||||
|
@ -398,9 +403,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
onValid.run()
|
onValid.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun delete() {
|
internal fun delete(songs: List<MusicDirectory.Entry> = getSelectedSongs()) {
|
||||||
val songs = getSelectedSongs()
|
|
||||||
|
|
||||||
Util.toast(
|
Util.toast(
|
||||||
context,
|
context,
|
||||||
resources.getQuantityString(
|
resources.getQuantityString(
|
||||||
|
@ -411,8 +414,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
mediaPlayerController.delete(songs)
|
mediaPlayerController.delete(songs)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun unpin() {
|
internal fun unpin(songs: List<MusicDirectory.Entry> = getSelectedSongs()) {
|
||||||
val songs = getSelectedSongs()
|
|
||||||
Util.toast(
|
Util.toast(
|
||||||
context,
|
context,
|
||||||
resources.getQuantityString(
|
resources.getQuantityString(
|
||||||
|
@ -619,56 +621,40 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
menuItem: MenuItem,
|
menuItem: MenuItem,
|
||||||
item: MusicDirectory.Child
|
item: MusicDirectory.Child
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val entryId = item.id
|
val songs = getClickedSong(item)
|
||||||
|
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.menu_play_now -> {
|
R.id.song_menu_play_now -> {
|
||||||
downloadHandler.downloadRecursively(
|
playNow(false, songs)
|
||||||
this, entryId, save = false, append = false,
|
}
|
||||||
autoPlay = true, shuffle = false, background = false,
|
R.id.song_menu_play_next -> {
|
||||||
playNext = false, unpin = false, isArtist = false
|
downloadHandler.download(
|
||||||
|
fragment = this@TrackCollectionFragment,
|
||||||
|
append = true,
|
||||||
|
save = false,
|
||||||
|
autoPlay = false,
|
||||||
|
playNext = true,
|
||||||
|
shuffle = false,
|
||||||
|
songs = songs
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
R.id.menu_play_next -> {
|
R.id.song_menu_play_last -> {
|
||||||
downloadHandler.downloadRecursively(
|
playNow(true, songs)
|
||||||
this, entryId, save = false, append = false,
|
|
||||||
autoPlay = false, shuffle = false, background = false,
|
|
||||||
playNext = true, unpin = false, isArtist = false
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.menu_play_last -> {
|
R.id.song_menu_pin -> {
|
||||||
downloadHandler.downloadRecursively(
|
downloadBackground(true, songs)
|
||||||
this, entryId, save = false, append = true,
|
|
||||||
autoPlay = false, shuffle = false, background = false,
|
|
||||||
playNext = false, unpin = false, isArtist = false
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.menu_pin -> {
|
R.id.song_menu_unpin -> {
|
||||||
downloadHandler.downloadRecursively(
|
unpin(songs)
|
||||||
this, entryId, save = true, append = true,
|
|
||||||
autoPlay = false, shuffle = false, background = false,
|
|
||||||
playNext = false, unpin = false, isArtist = false
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.menu_unpin -> {
|
R.id.song_menu_download -> {
|
||||||
downloadHandler.downloadRecursively(
|
downloadBackground(false, songs)
|
||||||
this, entryId, save = false, append = false,
|
|
||||||
autoPlay = false, shuffle = false, background = false,
|
|
||||||
playNext = false, unpin = true, isArtist = false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
R.id.menu_download -> {
|
|
||||||
downloadHandler.downloadRecursively(
|
|
||||||
this, entryId, save = false, append = false,
|
|
||||||
autoPlay = false, shuffle = false, background = true,
|
|
||||||
playNext = false, unpin = false, isArtist = false
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.select_album_play_all -> {
|
R.id.select_album_play_all -> {
|
||||||
// TODO: Why is this being handled here?!
|
// TODO: Why is this being handled here?!
|
||||||
playAll()
|
playAll()
|
||||||
}
|
}
|
||||||
R.id.menu_item_share -> {
|
R.id.song_menu_share -> {
|
||||||
if (item is MusicDirectory.Entry) {
|
if (item is MusicDirectory.Entry) {
|
||||||
shareHandler.createShare(
|
shareHandler.createShare(
|
||||||
this, listOf(item), refreshListView,
|
this, listOf(item), refreshListView,
|
||||||
|
@ -683,6 +669,16 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun getClickedSong(item: MusicDirectory.Child): List<MusicDirectory.Entry> {
|
||||||
|
// This can probably be done better
|
||||||
|
return viewAdapter.getCurrentList().mapNotNull {
|
||||||
|
if (it is MusicDirectory.Entry && (it.id == item.id))
|
||||||
|
it
|
||||||
|
else
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onItemClick(item: MusicDirectory.Child) {
|
override fun onItemClick(item: MusicDirectory.Child) {
|
||||||
when {
|
when {
|
||||||
item.isDirectory -> {
|
item.isDirectory -> {
|
||||||
|
|
|
@ -217,8 +217,8 @@
|
||||||
<string name="settings.disc_sort_summary">Sort song list by disc number and track number</string>
|
<string name="settings.disc_sort_summary">Sort song list by disc number and track number</string>
|
||||||
<string name="settings.display_bitrate">Display Bitrate and File Suffix</string>
|
<string name="settings.display_bitrate">Display Bitrate and File Suffix</string>
|
||||||
<string name="settings.display_bitrate_summary">Append artist name with bitrate and file suffix</string>
|
<string name="settings.display_bitrate_summary">Append artist name with bitrate and file suffix</string>
|
||||||
<string name="settings.download_transition">Show Downloads on Play</string>
|
<string name="settings.download_transition">Stay in Downloads on Play</string>
|
||||||
<string name="settings.download_transition_summary">Transition to download activity when starting playback</string>
|
<string name="settings.download_transition_summary">Stay in media view when starting playback (do not switch to player view)</string>
|
||||||
<string name="settings.gapless_playback">Gapless Playback</string>
|
<string name="settings.gapless_playback">Gapless Playback</string>
|
||||||
<string name="settings.gapless_playback_summary">Enable gapless playback</string>
|
<string name="settings.gapless_playback_summary">Enable gapless playback</string>
|
||||||
<string name="settings.hide_media_summary">Hide music files from other apps.</string>
|
<string name="settings.hide_media_summary">Hide music files from other apps.</string>
|
||||||
|
@ -285,12 +285,12 @@
|
||||||
<string name="settings.search_75">75</string>
|
<string name="settings.search_75">75</string>
|
||||||
<string name="settings.search_history_cleared">Search history cleared</string>
|
<string name="settings.search_history_cleared">Search history cleared</string>
|
||||||
<string name="settings.search_title">Search Settings</string>
|
<string name="settings.search_title">Search Settings</string>
|
||||||
|
<string name="settings.send_bluetooth_notification_summary">Send playback notifications via Bluetooth</string>
|
||||||
|
<string name="settings.send_bluetooth_notification">Send Bluetooth Notification</string>
|
||||||
<string name="settings.send_bluetooth_album_art_summary">Send album art over Bluetooth (May cause Bluetooth notifications to fail)</string>
|
<string name="settings.send_bluetooth_album_art_summary">Send album art over Bluetooth (May cause Bluetooth notifications to fail)</string>
|
||||||
<string name="settings.send_bluetooth_album_art">Album Art Over Bluetooth</string>
|
<string name="settings.send_bluetooth_album_art">Album Art Over Bluetooth</string>
|
||||||
<string name="settings.disable_send_now_playing_list_summary">Now Playing List won\'t be sent to connected devices. This may restore compatibility with AVRCP 1.3 devices, when current track display is not updated</string>
|
<string name="settings.disable_send_now_playing_list_summary">Now Playing List won\'t be sent to connected devices. This may restore compatibility with AVRCP 1.3 devices, when current track display is not updated</string>
|
||||||
<string name="settings.disable_send_now_playing_list">Disable sending of Now Playing List</string>
|
<string name="settings.disable_send_now_playing_list">Disable sending of Now Playing List</string>
|
||||||
<string name="settings.send_bluetooth_notification_summary">Send playback notifications via Bluetooth</string>
|
|
||||||
<string name="settings.send_bluetooth_notification">Send Bluetooth Notification</string>
|
|
||||||
<string name="settings.server_manage_servers">Manage Servers</string>
|
<string name="settings.server_manage_servers">Manage Servers</string>
|
||||||
<string name="settings.server_address">Server Address</string>
|
<string name="settings.server_address">Server Address</string>
|
||||||
<string name="settings.server_name">Name</string>
|
<string name="settings.server_name">Name</string>
|
||||||
|
@ -320,8 +320,7 @@
|
||||||
<string name="settings.theme_title">Theme</string>
|
<string name="settings.theme_title">Theme</string>
|
||||||
<string name="settings.title.allow_self_signed_certificate">Allow self-signed HTTPS certificate</string>
|
<string name="settings.title.allow_self_signed_certificate">Allow self-signed HTTPS certificate</string>
|
||||||
<string name="settings.title.enable_ldap_users_support">Force plain password authentication</string>
|
<string name="settings.title.enable_ldap_users_support">Force plain password authentication</string>
|
||||||
<string name="settings.summary.enable_ldap_users_support">This forces the app to always send the password unencrypted.
|
<string name="settings.summary.enable_ldap_users_support">This forces the app to always send the password unencrypted. Useful if the Subsonic server does not support the new authentication API for the users.</string>
|
||||||
Useful if the Subsonic server does not support the new authentication API for the users.</string>
|
|
||||||
<string name="settings.use_folder_for_album_artist">Use Folders For Artist Name</string>
|
<string name="settings.use_folder_for_album_artist">Use Folders For Artist Name</string>
|
||||||
<string name="settings.use_folder_for_album_artist_summary">Assume top-level folder is the name of the album artist</string>
|
<string name="settings.use_folder_for_album_artist_summary">Assume top-level folder is the name of the album artist</string>
|
||||||
<string name="settings.use_id3">Browse Using ID3 Tags</string>
|
<string name="settings.use_id3">Browse Using ID3 Tags</string>
|
||||||
|
@ -389,7 +388,7 @@
|
||||||
<string name="settings.playback.bluetooth_all">All Bluetooth devices</string>
|
<string name="settings.playback.bluetooth_all">All Bluetooth devices</string>
|
||||||
<string name="settings.playback.bluetooth_a2dp">Only audio (A2DP) devices</string>
|
<string name="settings.playback.bluetooth_a2dp">Only audio (A2DP) devices</string>
|
||||||
<string name="settings.playback.bluetooth_disabled">Disabled</string>
|
<string name="settings.playback.bluetooth_disabled">Disabled</string>
|
||||||
<string name="settings.playback.single_button_bluetooth_device">Bluetooth device with only a single Play/Pause button</string>
|
<string name="settings.playback.single_button_bluetooth_device">Bluetooth device with a single Play/Pause button</string>
|
||||||
<string name="settings.playback.single_button_bluetooth_device_summary">Enabling this may help with older Bluetooth devices when Play/Pause doesn\'t work correctly</string>
|
<string name="settings.playback.single_button_bluetooth_device_summary">Enabling this may help with older Bluetooth devices when Play/Pause doesn\'t work correctly</string>
|
||||||
<string name="settings.debug.title">Debug options</string>
|
<string name="settings.debug.title">Debug options</string>
|
||||||
<string name="settings.debug.log_to_file">Write debug log to file</string>
|
<string name="settings.debug.log_to_file">Write debug log to file</string>
|
||||||
|
@ -469,8 +468,7 @@
|
||||||
<!-- Subsonic features -->
|
<!-- Subsonic features -->
|
||||||
<string name="settings.features_title">Features</string>
|
<string name="settings.features_title">Features</string>
|
||||||
<string name="settings.five_star_rating_title">Use five star rating for songs</string>
|
<string name="settings.five_star_rating_title">Use five star rating for songs</string>
|
||||||
<string name="settings.five_star_rating_description">Use five star rating system for songs
|
<string name="settings.five_star_rating_description">Use five star rating system for songs instead of simply starring/unstarring items.
|
||||||
instead of simply starring/unstarring items.
|
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -50,7 +50,7 @@ class APISearchConverterTest {
|
||||||
|
|
||||||
with(convertedEntity) {
|
with(convertedEntity) {
|
||||||
artists.size `should be equal to` entity.artistList.size
|
artists.size `should be equal to` entity.artistList.size
|
||||||
artists[0] `should be equal to` entity.artistList[0].toDomainEntity()
|
artists[0] `should be equal to` entity.artistList[0].toIndexEntity()
|
||||||
albums.size `should be equal to` entity.albumList.size
|
albums.size `should be equal to` entity.albumList.size
|
||||||
albums[0] `should be equal to` entity.albumList[0].toDomainEntity()
|
albums[0] `should be equal to` entity.albumList[0].toDomainEntity()
|
||||||
songs.size `should be equal to` entity.songList.size
|
songs.size `should be equal to` entity.songList.size
|
||||||
|
|
Loading…
Reference in New Issue