Sharing albums, artists, genres and playlists
This commit is contained in:
parent
7915655c78
commit
7f11e886f7
19 changed files with 69 additions and 5 deletions
|
@ -142,6 +142,10 @@ class AlbumDetailFragment :
|
||||||
musicModel.addToPlaylist(currentAlbum)
|
musicModel.addToPlaylist(currentAlbum)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(currentAlbum.songs)
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,10 @@ class ArtistDetailFragment :
|
||||||
musicModel.addToPlaylist(currentArtist)
|
musicModel.addToPlaylist(currentArtist)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(currentArtist.songs)
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,10 @@ class GenreDetailFragment :
|
||||||
musicModel.addToPlaylist(currentGenre)
|
musicModel.addToPlaylist(currentGenre)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(currentGenre.songs)
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,10 @@ class PlaylistDetailFragment :
|
||||||
musicModel.deletePlaylist(currentPlaylist)
|
musicModel.deletePlaylist(currentPlaylist)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(currentPlaylist.songs)
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.oxycblt.auxio.navigation.MainNavigationAction
|
||||||
import org.oxycblt.auxio.navigation.NavigationViewModel
|
import org.oxycblt.auxio.navigation.NavigationViewModel
|
||||||
import org.oxycblt.auxio.util.logD
|
import org.oxycblt.auxio.util.logD
|
||||||
import org.oxycblt.auxio.util.shareSong
|
import org.oxycblt.auxio.util.shareSong
|
||||||
|
import org.oxycblt.auxio.util.shareSongs
|
||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +101,7 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
||||||
R.id.action_go_album -> {
|
R.id.action_go_album -> {
|
||||||
navModel.exploreNavigateTo(song.album)
|
navModel.exploreNavigateTo(song.album)
|
||||||
}
|
}
|
||||||
R.id.action_song_share -> {
|
R.id.action_share -> {
|
||||||
requireContext().shareSong(song)
|
requireContext().shareSong(song)
|
||||||
}
|
}
|
||||||
R.id.action_playlist_add -> {
|
R.id.action_playlist_add -> {
|
||||||
|
@ -151,6 +152,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
||||||
R.id.action_playlist_add -> {
|
R.id.action_playlist_add -> {
|
||||||
musicModel.addToPlaylist(album)
|
musicModel.addToPlaylist(album)
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(album.songs)
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
error("Unexpected menu item selected")
|
error("Unexpected menu item selected")
|
||||||
}
|
}
|
||||||
|
@ -188,6 +192,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
||||||
R.id.action_playlist_add -> {
|
R.id.action_playlist_add -> {
|
||||||
musicModel.addToPlaylist(artist)
|
musicModel.addToPlaylist(artist)
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(artist.songs)
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
error("Unexpected menu item selected")
|
error("Unexpected menu item selected")
|
||||||
}
|
}
|
||||||
|
@ -225,6 +232,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
||||||
R.id.action_playlist_add -> {
|
R.id.action_playlist_add -> {
|
||||||
musicModel.addToPlaylist(genre)
|
musicModel.addToPlaylist(genre)
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(genre.songs)
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
error("Unexpected menu item selected")
|
error("Unexpected menu item selected")
|
||||||
}
|
}
|
||||||
|
@ -262,6 +272,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
||||||
R.id.action_delete -> {
|
R.id.action_delete -> {
|
||||||
musicModel.deletePlaylist(playlist)
|
musicModel.deletePlaylist(playlist)
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
requireContext().shareSongs(playlist.songs)
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
error("Unexpected menu item selected")
|
error("Unexpected menu item selected")
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,8 +216,8 @@ data class MimeType(val fromExtension: String, val fromFormat: String?) {
|
||||||
/**
|
/**
|
||||||
* Return a mime-type such as "audio/ogg"
|
* Return a mime-type such as "audio/ogg"
|
||||||
*
|
*
|
||||||
* @return A raw mime-type string. Will first try [fromFormat], then falling
|
* @return A raw mime-type string. Will first try [fromFormat], then falling back to
|
||||||
* back to [fromExtension], and then null if that fails.
|
* [fromExtension], and then null if that fails.
|
||||||
*/
|
*/
|
||||||
fun getRawType(): String {
|
fun getRawType(): String {
|
||||||
return fromFormat ?: fromExtension
|
return fromFormat ?: fromExtension
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.oxycblt.auxio.playback.state.RepeatMode
|
||||||
import org.oxycblt.auxio.playback.ui.StyledSeekBar
|
import org.oxycblt.auxio.playback.ui.StyledSeekBar
|
||||||
import org.oxycblt.auxio.ui.ViewBindingFragment
|
import org.oxycblt.auxio.ui.ViewBindingFragment
|
||||||
import org.oxycblt.auxio.util.collectImmediately
|
import org.oxycblt.auxio.util.collectImmediately
|
||||||
|
import org.oxycblt.auxio.util.shareSong
|
||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||||
|
|
||||||
|
@ -172,6 +173,10 @@ class PlaybackPanelFragment :
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.action_share -> {
|
||||||
|
playbackModel.song.value?.let { requireContext().shareSong(it) }
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
</menu>
|
</menu>
|
|
@ -9,4 +9,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_go_artist"
|
android:id="@+id/action_go_artist"
|
||||||
android:title="@string/lbl_go_artist" />
|
android:title="@string/lbl_go_artist" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
</menu>
|
</menu>
|
|
@ -12,6 +12,9 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_song_detail"
|
android:id="@+id/action_song_detail"
|
||||||
android:title="@string/lbl_song_detail" />
|
android:title="@string/lbl_song_detail" />
|
||||||
|
|
|
@ -18,4 +18,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
</menu>
|
</menu>
|
|
@ -12,6 +12,9 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_song_detail"
|
android:id="@+id/action_song_detail"
|
||||||
android:title="@string/lbl_song_detail" />
|
android:title="@string/lbl_song_detail" />
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_queue_add"
|
android:id="@+id/action_queue_add"
|
||||||
android:title="@string/lbl_queue_add" />
|
android:title="@string/lbl_queue_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
|
|
@ -9,4 +9,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
</menu>
|
</menu>
|
|
@ -14,6 +14,9 @@
|
||||||
android:id="@+id/action_go_album"
|
android:id="@+id/action_go_album"
|
||||||
android:title="@string/lbl_go_album"
|
android:title="@string/lbl_go_album"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_song_detail"
|
android:id="@+id/action_song_detail"
|
||||||
android:title="@string/lbl_song_detail"
|
android:title="@string/lbl_song_detail"
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_queue_add"
|
android:id="@+id/action_queue_add"
|
||||||
android:title="@string/lbl_queue_add" />
|
android:title="@string/lbl_queue_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_delete"
|
android:id="@+id/action_delete"
|
||||||
android:title="@string/lbl_delete" />
|
android:title="@string/lbl_delete" />
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_queue_add"
|
android:id="@+id/action_queue_add"
|
||||||
android:title="@string/lbl_queue_add" />
|
android:title="@string/lbl_queue_add" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share"
|
||||||
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_delete"
|
android:id="@+id/action_delete"
|
||||||
android:title="@string/lbl_delete" />
|
android:title="@string/lbl_delete" />
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
android:id="@+id/action_playlist_add"
|
android:id="@+id/action_playlist_add"
|
||||||
android:title="@string/lbl_playlist_add" />
|
android:title="@string/lbl_playlist_add" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_song_share"
|
android:id="@+id/action_share"
|
||||||
android:title="@string/lbl_share" />
|
android:title="@string/lbl_share" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_song_detail"
|
android:id="@+id/action_song_detail"
|
||||||
|
|
Loading…
Reference in a new issue