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)
|
||||
true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(currentAlbum.songs)
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,10 @@ class ArtistDetailFragment :
|
|||
musicModel.addToPlaylist(currentArtist)
|
||||
true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(currentArtist.songs)
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,10 @@ class GenreDetailFragment :
|
|||
musicModel.addToPlaylist(currentGenre)
|
||||
true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(currentGenre.songs)
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,10 @@ class PlaylistDetailFragment :
|
|||
musicModel.deletePlaylist(currentPlaylist)
|
||||
true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(currentPlaylist.songs)
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.oxycblt.auxio.navigation.MainNavigationAction
|
|||
import org.oxycblt.auxio.navigation.NavigationViewModel
|
||||
import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.shareSong
|
||||
import org.oxycblt.auxio.util.shareSongs
|
||||
import org.oxycblt.auxio.util.showToast
|
||||
|
||||
/**
|
||||
|
@ -100,7 +101,7 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
|||
R.id.action_go_album -> {
|
||||
navModel.exploreNavigateTo(song.album)
|
||||
}
|
||||
R.id.action_song_share -> {
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSong(song)
|
||||
}
|
||||
R.id.action_playlist_add -> {
|
||||
|
@ -151,6 +152,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
|||
R.id.action_playlist_add -> {
|
||||
musicModel.addToPlaylist(album)
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(album.songs)
|
||||
}
|
||||
else -> {
|
||||
error("Unexpected menu item selected")
|
||||
}
|
||||
|
@ -188,6 +192,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
|||
R.id.action_playlist_add -> {
|
||||
musicModel.addToPlaylist(artist)
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(artist.songs)
|
||||
}
|
||||
else -> {
|
||||
error("Unexpected menu item selected")
|
||||
}
|
||||
|
@ -225,6 +232,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
|||
R.id.action_playlist_add -> {
|
||||
musicModel.addToPlaylist(genre)
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(genre.songs)
|
||||
}
|
||||
else -> {
|
||||
error("Unexpected menu item selected")
|
||||
}
|
||||
|
@ -262,6 +272,9 @@ abstract class ListFragment<in T : Music, VB : ViewBinding> :
|
|||
R.id.action_delete -> {
|
||||
musicModel.deletePlaylist(playlist)
|
||||
}
|
||||
R.id.action_share -> {
|
||||
requireContext().shareSongs(playlist.songs)
|
||||
}
|
||||
else -> {
|
||||
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 raw mime-type string. Will first try [fromFormat], then falling
|
||||
* back to [fromExtension], and then null if that fails.
|
||||
* @return A raw mime-type string. Will first try [fromFormat], then falling back to
|
||||
* [fromExtension], and then null if that fails.
|
||||
*/
|
||||
fun getRawType(): String {
|
||||
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.ui.ViewBindingFragment
|
||||
import org.oxycblt.auxio.util.collectImmediately
|
||||
import org.oxycblt.auxio.util.shareSong
|
||||
import org.oxycblt.auxio.util.showToast
|
||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||
|
||||
|
@ -172,6 +173,10 @@ class PlaybackPanelFragment :
|
|||
}
|
||||
true
|
||||
}
|
||||
R.id.action_share -> {
|
||||
playbackModel.song.value?.let { requireContext().shareSong(it) }
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
|
|
@ -18,4 +18,7 @@
|
|||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
</menu>
|
|
@ -9,4 +9,7 @@
|
|||
<item
|
||||
android:id="@+id/action_go_artist"
|
||||
android:title="@string/lbl_go_artist" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
</menu>
|
|
@ -12,6 +12,9 @@
|
|||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_song_detail"
|
||||
android:title="@string/lbl_song_detail" />
|
||||
|
|
|
@ -18,4 +18,7 @@
|
|||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
</menu>
|
|
@ -12,6 +12,9 @@
|
|||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_song_detail"
|
||||
android:title="@string/lbl_song_detail" />
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<item
|
||||
android:id="@+id/action_queue_add"
|
||||
android:title="@string/lbl_queue_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
|
|
|
@ -9,4 +9,7 @@
|
|||
<item
|
||||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
</menu>
|
|
@ -14,6 +14,9 @@
|
|||
android:id="@+id/action_go_album"
|
||||
android:title="@string/lbl_go_album"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_song_detail"
|
||||
android:title="@string/lbl_song_detail"
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<item
|
||||
android:id="@+id/action_queue_add"
|
||||
android:title="@string/lbl_queue_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/lbl_delete" />
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<item
|
||||
android:id="@+id/action_queue_add"
|
||||
android:title="@string/lbl_queue_add" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/lbl_delete" />
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
android:id="@+id/action_playlist_add"
|
||||
android:title="@string/lbl_playlist_add" />
|
||||
<item
|
||||
android:id="@+id/action_song_share"
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/lbl_share" />
|
||||
<item
|
||||
android:id="@+id/action_song_detail"
|
||||
|
|
Loading…
Reference in a new issue