ui: introduce self-rolled toolbar
This commit is contained in:
@@ -43,6 +43,7 @@ import org.oxycblt.auxio.util.navigateSafe
|
|||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||||
import org.oxycblt.musikr.Album
|
import org.oxycblt.musikr.Album
|
||||||
|
import org.oxycblt.musikr.Artist
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
import org.oxycblt.musikr.MusicParent
|
import org.oxycblt.musikr.MusicParent
|
||||||
import org.oxycblt.musikr.Song
|
import org.oxycblt.musikr.Song
|
||||||
@@ -62,6 +63,8 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
|
|
||||||
override fun getDetailListAdapter() = albumListAdapter
|
override fun getDetailListAdapter() = albumListAdapter
|
||||||
|
|
||||||
|
override fun getToolbarParent() = detailModel.currentAlbum.value
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
||||||
super.onBindingCreated(binding, savedInstanceState)
|
super.onBindingCreated(binding, savedInstanceState)
|
||||||
|
|
||||||
@@ -91,6 +94,14 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
detailModel.albumSongInstructions.consume()
|
detailModel.albumSongInstructions.consume()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPlayParent(parent: Album) {
|
||||||
|
playbackModel.play(parent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShuffleParent(parent: Album) {
|
||||||
|
playbackModel.shuffle(parent)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onRealClick(item: Song) {
|
override fun onRealClick(item: Song) {
|
||||||
playbackModel.play(item, detailModel.playInAlbumWith)
|
playbackModel.play(item, detailModel.playInAlbumWith)
|
||||||
}
|
}
|
||||||
@@ -118,7 +129,7 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
val context = requireContext()
|
val context = requireContext()
|
||||||
val name = album.name.resolve(context)
|
val name = album.name.resolve(context)
|
||||||
|
|
||||||
binding.detailToolbarTitle.text = name
|
binding.detailNormalToolbar.title = name
|
||||||
binding.detailCover.bind(album)
|
binding.detailCover.bind(album)
|
||||||
// The type text depends on the release type (Album, EP, Single, etc.)
|
// The type text depends on the release type (Album, EP, Single, etc.)
|
||||||
binding.detailType.text = album.releaseType.resolve(context)
|
binding.detailType.text = album.releaseType.resolve(context)
|
||||||
@@ -146,15 +157,10 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
|
|||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener {
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentAlbum.value))
|
playbackModel.play(unlikelyToBeNull(detailModel.currentAlbum.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarPlay.setOnClickListener {
|
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentAlbum.value))
|
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
binding.detailShuffleButton?.setOnClickListener {
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
|
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarShuffle.setOnClickListener {
|
setToolbarPlaybackButtonsEnabled(true)
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
|
|
||||||
}
|
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
playbackModel.parent.value,
|
playbackModel.parent.value,
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
|
|
||||||
override fun getDetailListAdapter() = artistListAdapter
|
override fun getDetailListAdapter() = artistListAdapter
|
||||||
|
|
||||||
|
override fun getToolbarParent() = detailModel.currentArtist.value
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
||||||
super.onBindingCreated(binding, savedInstanceState)
|
super.onBindingCreated(binding, savedInstanceState)
|
||||||
|
|
||||||
@@ -91,6 +93,14 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
detailModel.artistSongInstructions.consume()
|
detailModel.artistSongInstructions.consume()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPlayParent(parent: Artist) {
|
||||||
|
playbackModel.play(parent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShuffleParent(parent: Artist) {
|
||||||
|
playbackModel.shuffle(parent)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onRealClick(item: Music) {
|
override fun onRealClick(item: Music) {
|
||||||
when (item) {
|
when (item) {
|
||||||
is Album -> detailModel.showAlbum(item)
|
is Album -> detailModel.showAlbum(item)
|
||||||
@@ -124,7 +134,7 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
val binding = requireBinding()
|
val binding = requireBinding()
|
||||||
val context = requireContext()
|
val context = requireContext()
|
||||||
val name = artist.name.resolve(context)
|
val name = artist.name.resolve(context)
|
||||||
binding.detailToolbarTitle.text = name
|
binding.detailNormalToolbar.title = name
|
||||||
|
|
||||||
binding.detailCover.bind(artist)
|
binding.detailCover.bind(artist)
|
||||||
binding.detailType.text = context.getString(R.string.lbl_artist)
|
binding.detailType.text = context.getString(R.string.lbl_artist)
|
||||||
@@ -159,8 +169,7 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
// we want to reset the visibility of all information that was hidden.
|
// we want to reset the visibility of all information that was hidden.
|
||||||
binding.detailPlayButton?.isEnabled = true
|
binding.detailPlayButton?.isEnabled = true
|
||||||
binding.detailShuffleButton?.isEnabled = true
|
binding.detailShuffleButton?.isEnabled = true
|
||||||
binding.detailToolbarPlay.isEnabled = true
|
setToolbarPlaybackButtonsEnabled(true)
|
||||||
binding.detailToolbarShuffle.isEnabled = true
|
|
||||||
} else {
|
} else {
|
||||||
// The artist does not have any songs, so hide functionality that makes no sense.
|
// The artist does not have any songs, so hide functionality that makes no sense.
|
||||||
// ex. Play and Shuffle, Song Counts, and Genre Information.
|
// ex. Play and Shuffle, Song Counts, and Genre Information.
|
||||||
@@ -169,22 +178,15 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
|
|||||||
binding.detailSubhead.isVisible = false
|
binding.detailSubhead.isVisible = false
|
||||||
binding.detailPlayButton?.isEnabled = false
|
binding.detailPlayButton?.isEnabled = false
|
||||||
binding.detailShuffleButton?.isEnabled = false
|
binding.detailShuffleButton?.isEnabled = false
|
||||||
binding.detailToolbarPlay.isEnabled = false
|
setToolbarPlaybackButtonsEnabled(false)
|
||||||
binding.detailToolbarShuffle.isEnabled = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener {
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentArtist.value))
|
playbackModel.play(unlikelyToBeNull(detailModel.currentArtist.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarPlay.setOnClickListener {
|
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentArtist.value))
|
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
binding.detailShuffleButton?.setOnClickListener {
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
|
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarShuffle.setOnClickListener {
|
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
|
|
||||||
}
|
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
playbackModel.parent.value,
|
playbackModel.parent.value,
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ package org.oxycblt.auxio.detail
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.MenuItem
|
||||||
|
import android.view.View
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
@@ -38,10 +40,13 @@ import org.oxycblt.auxio.list.PlainHeader
|
|||||||
import org.oxycblt.auxio.music.MusicViewModel
|
import org.oxycblt.auxio.music.MusicViewModel
|
||||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
import org.oxycblt.auxio.util.getDimenPixels
|
import org.oxycblt.auxio.util.getDimenPixels
|
||||||
import org.oxycblt.auxio.util.overrideOnOverflowMenuClick
|
|
||||||
import org.oxycblt.auxio.util.setFullWidthLookup
|
import org.oxycblt.auxio.util.setFullWidthLookup
|
||||||
|
import org.oxycblt.musikr.Album
|
||||||
|
import org.oxycblt.musikr.Artist
|
||||||
|
import org.oxycblt.musikr.Genre
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
import org.oxycblt.musikr.MusicParent
|
import org.oxycblt.musikr.MusicParent
|
||||||
|
import org.oxycblt.musikr.Playlist
|
||||||
|
|
||||||
abstract class DetailFragment<P : MusicParent, C : Music> :
|
abstract class DetailFragment<P : MusicParent, C : Music> :
|
||||||
ListFragment<C, FragmentDetailBinding>(),
|
ListFragment<C, FragmentDetailBinding>(),
|
||||||
@@ -68,6 +73,8 @@ abstract class DetailFragment<P : MusicParent, C : Music> :
|
|||||||
|
|
||||||
abstract fun getDetailListAdapter(): DetailListAdapter
|
abstract fun getDetailListAdapter(): DetailListAdapter
|
||||||
|
|
||||||
|
abstract fun getToolbarParent(): P?
|
||||||
|
|
||||||
override fun getSelectionToolbar(binding: FragmentDetailBinding) =
|
override fun getSelectionToolbar(binding: FragmentDetailBinding) =
|
||||||
binding.detailSelectionToolbar
|
binding.detailSelectionToolbar
|
||||||
|
|
||||||
@@ -120,13 +127,73 @@ abstract class DetailFragment<P : MusicParent, C : Music> :
|
|||||||
detailHeader.alpha = 1 - outRatio
|
detailHeader.alpha = 1 - outRatio
|
||||||
|
|
||||||
val inRatio = max(ratio - 0.5f, 0f) * 2
|
val inRatio = max(ratio - 0.5f, 0f) * 2
|
||||||
val detailContent = binding.detailToolbarContent
|
animateToolbarView(binding.detailNormalToolbar.getTitleContainer(), inRatio)
|
||||||
detailContent.alpha = inRatio
|
animateToolbarActionButton(binding.detailNormalToolbar.getMenuButton(R.id.action_play), inRatio)
|
||||||
detailContent.translationY = spacingSmall * (1 - inRatio)
|
animateToolbarActionButton(
|
||||||
|
binding.detailNormalToolbar.getMenuButton(R.id.action_shuffle),
|
||||||
|
inRatio,
|
||||||
|
)
|
||||||
|
|
||||||
// Enable fast scrolling once fully collapsed
|
// Enable fast scrolling once fully collapsed
|
||||||
binding.detailRecycler.fastScrollingEnabled = ratio == 1f
|
binding.detailRecycler.fastScrollingEnabled = ratio == 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onMenuItemClick(item: MenuItem): Boolean {
|
||||||
|
if (super.onMenuItemClick(item)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
val parent = getToolbarParent() ?: return false
|
||||||
|
return when (item.itemId) {
|
||||||
|
R.id.action_play -> {
|
||||||
|
onPlayParent(parent)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
R.id.action_shuffle -> {
|
||||||
|
onShuffleParent(parent)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun setToolbarPlaybackButtonsEnabled(
|
||||||
|
playEnabled: Boolean,
|
||||||
|
shuffleEnabled: Boolean = playEnabled,
|
||||||
|
) {
|
||||||
|
binding?.detailNormalToolbar?.apply {
|
||||||
|
setMenuItemEnabled(R.id.action_play, playEnabled)
|
||||||
|
setMenuItemEnabled(R.id.action_shuffle, shuffleEnabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun animateToolbarView(view: View?, ratio: Float) {
|
||||||
|
view?.alpha = ratio
|
||||||
|
view?.translationY = spacingSmall * (1 - ratio)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun animateToolbarActionButton(view: View?, ratio: Float) {
|
||||||
|
if (view == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ratio <= 0f) {
|
||||||
|
view.alpha = 0f
|
||||||
|
view.translationY = spacingSmall.toFloat()
|
||||||
|
view.visibility = View.GONE
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (view.visibility != View.VISIBLE) {
|
||||||
|
view.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
view.alpha = ratio
|
||||||
|
view.translationY = spacingSmall * (1 - ratio)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract fun onPlayParent(parent: P)
|
||||||
|
|
||||||
|
protected abstract fun onShuffleParent(parent: P)
|
||||||
|
|
||||||
abstract fun onOpenParentMenu()
|
abstract fun onOpenParentMenu()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import org.oxycblt.auxio.util.getPlural
|
|||||||
import org.oxycblt.auxio.util.navigateSafe
|
import org.oxycblt.auxio.util.navigateSafe
|
||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||||
|
import org.oxycblt.musikr.Album
|
||||||
import org.oxycblt.musikr.Artist
|
import org.oxycblt.musikr.Artist
|
||||||
import org.oxycblt.musikr.Genre
|
import org.oxycblt.musikr.Genre
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
@@ -60,6 +61,8 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
|
|||||||
|
|
||||||
override fun getDetailListAdapter() = genreListAdapter
|
override fun getDetailListAdapter() = genreListAdapter
|
||||||
|
|
||||||
|
override fun getToolbarParent() = detailModel.currentGenre.value
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
||||||
super.onBindingCreated(binding, savedInstanceState)
|
super.onBindingCreated(binding, savedInstanceState)
|
||||||
|
|
||||||
@@ -89,6 +92,14 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
|
|||||||
detailModel.genreSongInstructions.consume()
|
detailModel.genreSongInstructions.consume()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPlayParent(parent: Genre) {
|
||||||
|
playbackModel.play(parent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShuffleParent(parent: Genre) {
|
||||||
|
playbackModel.shuffle(parent)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onRealClick(item: Music) {
|
override fun onRealClick(item: Music) {
|
||||||
when (item) {
|
when (item) {
|
||||||
is Artist -> detailModel.showArtist(item)
|
is Artist -> detailModel.showArtist(item)
|
||||||
@@ -122,7 +133,7 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
|
|||||||
val binding = requireBinding()
|
val binding = requireBinding()
|
||||||
val context = requireContext()
|
val context = requireContext()
|
||||||
val name = genre.name.resolve(context)
|
val name = genre.name.resolve(context)
|
||||||
binding.detailToolbarTitle.text = name
|
binding.detailNormalToolbar.title = name
|
||||||
binding.detailCover.bind(genre)
|
binding.detailCover.bind(genre)
|
||||||
binding.detailType.text = context.getString(R.string.lbl_genre)
|
binding.detailType.text = context.getString(R.string.lbl_genre)
|
||||||
binding.detailName.text = genre.name.resolve(context)
|
binding.detailName.text = genre.name.resolve(context)
|
||||||
@@ -138,15 +149,10 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
|
|||||||
binding.detailPlayButton?.setOnClickListener {
|
binding.detailPlayButton?.setOnClickListener {
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentGenre.value))
|
playbackModel.play(unlikelyToBeNull(detailModel.currentGenre.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarPlay.setOnClickListener {
|
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentGenre.value))
|
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.setOnClickListener {
|
binding.detailShuffleButton?.setOnClickListener {
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
|
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
|
||||||
}
|
}
|
||||||
binding.detailToolbarShuffle.setOnClickListener {
|
setToolbarPlaybackButtonsEnabled(true)
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
|
|
||||||
}
|
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
playbackModel.parent.value,
|
playbackModel.parent.value,
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.oxycblt.auxio.util.getPlural
|
|||||||
import org.oxycblt.auxio.util.navigateSafe
|
import org.oxycblt.auxio.util.navigateSafe
|
||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||||
|
import org.oxycblt.musikr.Genre
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
import org.oxycblt.musikr.MusicParent
|
import org.oxycblt.musikr.MusicParent
|
||||||
import org.oxycblt.musikr.Playlist
|
import org.oxycblt.musikr.Playlist
|
||||||
@@ -74,6 +75,8 @@ class PlaylistDetailFragment :
|
|||||||
|
|
||||||
override fun getDetailListAdapter() = playlistListAdapter
|
override fun getDetailListAdapter() = playlistListAdapter
|
||||||
|
|
||||||
|
override fun getToolbarParent() = detailModel.currentPlaylist.value
|
||||||
|
|
||||||
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: FragmentDetailBinding, savedInstanceState: Bundle?) {
|
||||||
super.onBindingCreated(binding, savedInstanceState)
|
super.onBindingCreated(binding, savedInstanceState)
|
||||||
|
|
||||||
@@ -164,6 +167,14 @@ class PlaylistDetailFragment :
|
|||||||
editNavigationListener = null
|
editNavigationListener = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPlayParent(parent: Playlist) {
|
||||||
|
playbackModel.play(parent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShuffleParent(parent: Playlist) {
|
||||||
|
playbackModel.shuffle(parent)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onRealClick(item: Song) {
|
override fun onRealClick(item: Song) {
|
||||||
playbackModel.play(item, detailModel.playInPlaylistWith)
|
playbackModel.play(item, detailModel.playInPlaylistWith)
|
||||||
}
|
}
|
||||||
@@ -198,7 +209,7 @@ class PlaylistDetailFragment :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val binding = requireBinding()
|
val binding = requireBinding()
|
||||||
binding.detailToolbarTitle.text = playlist.name.resolve(requireContext())
|
binding.detailNormalToolbar.title = playlist.name.resolve(requireContext())
|
||||||
binding.detailEditToolbar.title =
|
binding.detailEditToolbar.title =
|
||||||
getString(R.string.fmt_editing, playlist.name.resolve(requireContext()))
|
getString(R.string.fmt_editing, playlist.name.resolve(requireContext()))
|
||||||
|
|
||||||
@@ -244,24 +255,13 @@ class PlaylistDetailFragment :
|
|||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
playbackModel.play(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.detailToolbarPlay.apply {
|
|
||||||
isEnabled = playable
|
|
||||||
setOnClickListener {
|
|
||||||
playbackModel.play(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.detailShuffleButton?.apply {
|
binding.detailShuffleButton?.apply {
|
||||||
isEnabled = playable
|
isEnabled = playable
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.detailToolbarShuffle.apply {
|
setToolbarPlaybackButtonsEnabled(playable)
|
||||||
isEnabled = playable
|
|
||||||
setOnClickListener {
|
|
||||||
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updatePlayback(
|
updatePlayback(
|
||||||
playbackModel.song.value,
|
playbackModel.song.value,
|
||||||
playbackModel.parent.value,
|
playbackModel.parent.value,
|
||||||
@@ -279,9 +279,10 @@ class PlaylistDetailFragment :
|
|||||||
|
|
||||||
if (editedPlaylist != null) {
|
if (editedPlaylist != null) {
|
||||||
L.d("Updating save button state")
|
L.d("Updating save button state")
|
||||||
requireBinding().detailEditToolbar.menu.findItem(R.id.action_save).apply {
|
requireBinding().detailEditToolbar.setMenuItemEnabled(
|
||||||
isEnabled = editedPlaylist != detailModel.currentPlaylist.value?.songs
|
R.id.action_save,
|
||||||
}
|
editedPlaylist != detailModel.currentPlaylist.value?.songs,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMultiToolbar()
|
updateMultiToolbar()
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import androidx.viewbinding.ViewBinding
|
|||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.music.MusicViewModel
|
import org.oxycblt.auxio.music.MusicViewModel
|
||||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
|
import org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
import org.oxycblt.auxio.ui.ViewBindingFragment
|
import org.oxycblt.auxio.ui.ViewBindingFragment
|
||||||
import org.oxycblt.auxio.util.overrideOnOverflowMenuClick
|
|
||||||
import org.oxycblt.auxio.util.showToast
|
import org.oxycblt.auxio.util.showToast
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +40,7 @@ abstract class SelectionFragment<VB : ViewBinding> :
|
|||||||
protected abstract val musicModel: MusicViewModel
|
protected abstract val musicModel: MusicViewModel
|
||||||
protected abstract val playbackModel: PlaybackViewModel
|
protected abstract val playbackModel: PlaybackViewModel
|
||||||
|
|
||||||
open fun getSelectionToolbar(binding: VB): Toolbar? = null
|
open fun getSelectionToolbar(binding: VB): AuxioToolbar? = null
|
||||||
|
|
||||||
override fun onBindingCreated(binding: VB, savedInstanceState: Bundle?) {
|
override fun onBindingCreated(binding: VB, savedInstanceState: Bundle?) {
|
||||||
super.onBindingCreated(binding, savedInstanceState)
|
super.onBindingCreated(binding, savedInstanceState)
|
||||||
|
|||||||
@@ -0,0 +1,462 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026 Auxio Project
|
||||||
|
* ButtonGroupToolbar.kt is part of Auxio.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.oxycblt.auxio.ui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.ContextThemeWrapper
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.Menu
|
||||||
|
import android.view.MenuItem
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import androidx.annotation.AttrRes
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.annotation.MenuRes
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.annotation.StyleRes
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
|
import androidx.appcompat.view.SupportMenuInflater
|
||||||
|
import androidx.appcompat.view.menu.MenuBuilder
|
||||||
|
import androidx.appcompat.view.menu.MenuItemImpl
|
||||||
|
import androidx.appcompat.widget.PopupMenu
|
||||||
|
import androidx.appcompat.widget.Toolbar
|
||||||
|
import androidx.appcompat.widget.TooltipCompat
|
||||||
|
import androidx.core.view.MenuCompat
|
||||||
|
import androidx.core.view.children
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import androidx.core.widget.TextViewCompat
|
||||||
|
import com.google.android.material.R as MR
|
||||||
|
import org.oxycblt.auxio.R
|
||||||
|
import org.oxycblt.auxio.databinding.ViewToolbarBinding
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A compound toolbar view that owns its entire layout instead of piggybacking on AppCompat's
|
||||||
|
* internal Toolbar structure. It preserves the small API surface Auxio actually uses while
|
||||||
|
* rendering action items as an M3 Expressive [com.google.android.material.button.MaterialButtonGroup].
|
||||||
|
*/
|
||||||
|
class AuxioToolbar
|
||||||
|
@JvmOverloads
|
||||||
|
constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
@AttrRes defStyleAttr: Int = androidx.appcompat.R.attr.toolbarStyle,
|
||||||
|
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||||
|
private var menuItemClickListener: Toolbar.OnMenuItemClickListener? = null
|
||||||
|
private var navigationClickListener: OnClickListener? = null
|
||||||
|
private var navigationIconDrawable: Drawable? = null
|
||||||
|
private var navigationContentDescriptionText: CharSequence? = null
|
||||||
|
private var titleText: CharSequence? = null
|
||||||
|
private var subtitleText: CharSequence? = null
|
||||||
|
private var titleCentered = false
|
||||||
|
private var subtitleCentered = false
|
||||||
|
private var overflowClickListener: ((View) -> Unit)? = null
|
||||||
|
private var isInflatingInternalLayout = true
|
||||||
|
private var _binding: ViewToolbarBinding? = null
|
||||||
|
private val binding: ViewToolbarBinding
|
||||||
|
get() = checkNotNull(_binding) { "Toolbar binding was not initialized" }
|
||||||
|
private val actionButtons = mutableMapOf<Int, RippleFixMaterialButton>()
|
||||||
|
@SuppressLint("RestrictedApi") private var menuBuilder = MenuBuilder(context)
|
||||||
|
|
||||||
|
init {
|
||||||
|
_binding = ViewToolbarBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
isInflatingInternalLayout = false
|
||||||
|
|
||||||
|
clipChildren = false
|
||||||
|
clipToPadding = false
|
||||||
|
|
||||||
|
binding.toolbarRoot.clipChildren = false
|
||||||
|
binding.toolbarRoot.clipToPadding = false
|
||||||
|
binding.toolbarContentFrame.clipChildren = false
|
||||||
|
binding.toolbarContentFrame.clipToPadding = false
|
||||||
|
binding.toolbarActionGroup.clipChildren = false
|
||||||
|
binding.toolbarActionGroup.clipToPadding = false
|
||||||
|
binding.toolbarActionGroup.spacing = 0
|
||||||
|
|
||||||
|
configureIconButton(binding.toolbarNavigationButton)
|
||||||
|
|
||||||
|
val toolbarAttrs =
|
||||||
|
context.obtainStyledAttributes(
|
||||||
|
attrs,
|
||||||
|
androidx.appcompat.R.styleable.Toolbar,
|
||||||
|
defStyleAttr,
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
val materialToolbarAttrs =
|
||||||
|
context.obtainStyledAttributes(attrs, MR.styleable.MaterialToolbar, defStyleAttr, 0)
|
||||||
|
|
||||||
|
titleText = toolbarAttrs.getText(androidx.appcompat.R.styleable.Toolbar_title)
|
||||||
|
subtitleText = toolbarAttrs.getText(androidx.appcompat.R.styleable.Toolbar_subtitle)
|
||||||
|
binding.toolbarTitle.text = titleText
|
||||||
|
binding.toolbarSubtitle.text = subtitleText
|
||||||
|
binding.toolbarSubtitle.isVisible = !subtitleText.isNullOrEmpty()
|
||||||
|
|
||||||
|
val titleTextAppearance =
|
||||||
|
toolbarAttrs.getResourceId(androidx.appcompat.R.styleable.Toolbar_titleTextAppearance, 0)
|
||||||
|
if (titleTextAppearance != 0) {
|
||||||
|
setTitleTextAppearance(titleTextAppearance)
|
||||||
|
}
|
||||||
|
|
||||||
|
val subtitleTextAppearance =
|
||||||
|
toolbarAttrs.getResourceId(
|
||||||
|
androidx.appcompat.R.styleable.Toolbar_subtitleTextAppearance,
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
if (subtitleTextAppearance != 0) {
|
||||||
|
setSubtitleTextAppearance(subtitleTextAppearance)
|
||||||
|
}
|
||||||
|
|
||||||
|
val titleTextColor =
|
||||||
|
toolbarAttrs.getColorStateList(androidx.appcompat.R.styleable.Toolbar_titleTextColor)
|
||||||
|
if (titleTextColor != null) {
|
||||||
|
setTitleTextColor(titleTextColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
val subtitleTextColor =
|
||||||
|
toolbarAttrs.getColorStateList(
|
||||||
|
androidx.appcompat.R.styleable.Toolbar_subtitleTextColor
|
||||||
|
)
|
||||||
|
if (subtitleTextColor != null) {
|
||||||
|
setSubtitleTextColor(subtitleTextColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
titleCentered =
|
||||||
|
materialToolbarAttrs.getBoolean(MR.styleable.MaterialToolbar_titleCentered, false)
|
||||||
|
subtitleCentered =
|
||||||
|
materialToolbarAttrs.getBoolean(MR.styleable.MaterialToolbar_subtitleCentered, false)
|
||||||
|
updateTextGravity()
|
||||||
|
|
||||||
|
setNavigationIcon(toolbarAttrs.getDrawable(androidx.appcompat.R.styleable.Toolbar_navigationIcon))
|
||||||
|
setNavigationContentDescription(
|
||||||
|
toolbarAttrs.getText(androidx.appcompat.R.styleable.Toolbar_navigationContentDescription)
|
||||||
|
)
|
||||||
|
|
||||||
|
val menuResId = toolbarAttrs.getResourceId(androidx.appcompat.R.styleable.Toolbar_menu, 0)
|
||||||
|
|
||||||
|
toolbarAttrs.recycle()
|
||||||
|
materialToolbarAttrs.recycle()
|
||||||
|
|
||||||
|
updateNavigationButton()
|
||||||
|
updateCenterContentVisibility()
|
||||||
|
|
||||||
|
if (menuResId != 0) {
|
||||||
|
inflateMenu(menuResId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun addView(child: View, index: Int, params: ViewGroup.LayoutParams?) {
|
||||||
|
val binding = _binding
|
||||||
|
if (isInflatingInternalLayout || binding == null || child === binding.root) {
|
||||||
|
super.addView(child, index, params)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.toolbarContentFrame.addView(child, params)
|
||||||
|
updateCenterContentVisibility()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun removeView(view: View) {
|
||||||
|
val binding = _binding
|
||||||
|
if (
|
||||||
|
binding != null &&
|
||||||
|
view.parent === binding.toolbarContentFrame &&
|
||||||
|
view !== binding.toolbarTitleContainer
|
||||||
|
) {
|
||||||
|
binding.toolbarContentFrame.removeView(view)
|
||||||
|
updateCenterContentVisibility()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
super.removeView(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
var title: CharSequence?
|
||||||
|
get() = titleText
|
||||||
|
set(value) {
|
||||||
|
titleText = value
|
||||||
|
binding.toolbarTitle.text = value
|
||||||
|
updateCenterContentVisibility()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTitle(@StringRes resId: Int) {
|
||||||
|
title = if (resId != 0) context.getText(resId) else null
|
||||||
|
}
|
||||||
|
|
||||||
|
var subtitle: CharSequence?
|
||||||
|
get() = subtitleText
|
||||||
|
set(value) {
|
||||||
|
subtitleText = value
|
||||||
|
binding.toolbarSubtitle.text = value
|
||||||
|
binding.toolbarSubtitle.isVisible = !value.isNullOrEmpty()
|
||||||
|
updateCenterContentVisibility()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSubtitle(@StringRes resId: Int) {
|
||||||
|
subtitle = if (resId != 0) context.getText(resId) else null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTitleTextAppearance(@StyleRes resId: Int) {
|
||||||
|
TextViewCompat.setTextAppearance(binding.toolbarTitle, resId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSubtitleTextAppearance(@StyleRes resId: Int) {
|
||||||
|
TextViewCompat.setTextAppearance(binding.toolbarSubtitle, resId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setTitleTextColor(color: ColorStateList) {
|
||||||
|
binding.toolbarTitle.setTextColor(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSubtitleTextColor(color: ColorStateList) {
|
||||||
|
binding.toolbarSubtitle.setTextColor(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setNavigationIcon(@DrawableRes resId: Int) {
|
||||||
|
setNavigationIcon(
|
||||||
|
if (resId != 0) AppCompatResources.getDrawable(context, resId) else null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setNavigationIcon(icon: Drawable?) {
|
||||||
|
navigationIconDrawable = icon
|
||||||
|
updateNavigationButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getNavigationIcon(): Drawable? = navigationIconDrawable
|
||||||
|
|
||||||
|
fun setNavigationContentDescription(description: CharSequence?) {
|
||||||
|
navigationContentDescriptionText = description
|
||||||
|
updateNavigationButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setNavigationContentDescription(@StringRes resId: Int) {
|
||||||
|
setNavigationContentDescription(if (resId != 0) context.getText(resId) else null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getNavigationContentDescription(): CharSequence? = navigationContentDescriptionText
|
||||||
|
|
||||||
|
fun setNavigationOnClickListener(listener: OnClickListener?) {
|
||||||
|
navigationClickListener = listener
|
||||||
|
updateNavigationButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
val menu: Menu
|
||||||
|
get() = menuBuilder
|
||||||
|
|
||||||
|
fun inflateMenu(@MenuRes resId: Int) {
|
||||||
|
val builder = MenuBuilder(context)
|
||||||
|
SupportMenuInflater(context).inflate(resId, builder)
|
||||||
|
menuBuilder = builder
|
||||||
|
rebuildActionButtons()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnMenuItemClickListener(listener: Toolbar.OnMenuItemClickListener?) {
|
||||||
|
menuItemClickListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getMenuButton(itemId: Int): RippleFixMaterialButton? = actionButtons[itemId]
|
||||||
|
|
||||||
|
fun setMenuItemEnabled(itemId: Int, enabled: Boolean) {
|
||||||
|
menuBuilder.findItem(itemId)?.isEnabled = enabled
|
||||||
|
getMenuButton(itemId)?.isEnabled = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTitleContainer(): View = binding.toolbarTitleContainer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the overflow button's click behavior. When set, the overflow button will call
|
||||||
|
* [block] instead of showing the default popup menu.
|
||||||
|
*/
|
||||||
|
fun overrideOnOverflowMenuClick(block: (View) -> Unit) {
|
||||||
|
overflowClickListener = block
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun configureIconButton(button: RippleFixMaterialButton) {
|
||||||
|
button.minimumWidth = resources.getDimensionPixelSize(R.dimen.size_touchable_small)
|
||||||
|
button.minimumHeight = resources.getDimensionPixelSize(R.dimen.size_touchable_small)
|
||||||
|
button.iconSize = resources.getDimensionPixelSize(R.dimen.size_icon_small)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateNavigationButton() {
|
||||||
|
binding.toolbarNavigationButton.apply {
|
||||||
|
icon = navigationIconDrawable
|
||||||
|
contentDescription = navigationContentDescriptionText
|
||||||
|
isVisible = navigationIconDrawable != null
|
||||||
|
setOnClickListener(navigationClickListener)
|
||||||
|
TooltipCompat.setTooltipText(this, navigationContentDescriptionText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateTextGravity() {
|
||||||
|
binding.toolbarTitle.apply {
|
||||||
|
gravity = if (titleCentered) android.view.Gravity.CENTER_HORIZONTAL else android.view.Gravity.START
|
||||||
|
textAlignment =
|
||||||
|
if (titleCentered) {
|
||||||
|
View.TEXT_ALIGNMENT_CENTER
|
||||||
|
} else {
|
||||||
|
View.TEXT_ALIGNMENT_VIEW_START
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.toolbarSubtitle.apply {
|
||||||
|
gravity =
|
||||||
|
if (subtitleCentered) android.view.Gravity.CENTER_HORIZONTAL else android.view.Gravity.START
|
||||||
|
textAlignment =
|
||||||
|
if (subtitleCentered) {
|
||||||
|
View.TEXT_ALIGNMENT_CENTER
|
||||||
|
} else {
|
||||||
|
View.TEXT_ALIGNMENT_VIEW_START
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateCenterContentVisibility() {
|
||||||
|
val hasCustomContent =
|
||||||
|
binding.toolbarContentFrame.children.any { it !== binding.toolbarTitleContainer }
|
||||||
|
val showBuiltInTitle = !hasCustomContent && (!titleText.isNullOrEmpty() || !subtitleText.isNullOrEmpty())
|
||||||
|
binding.toolbarTitleContainer.isVisible = showBuiltInTitle
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
|
private fun rebuildActionButtons() {
|
||||||
|
actionButtons.clear()
|
||||||
|
binding.toolbarActionGroup.removeAllViews()
|
||||||
|
|
||||||
|
val actionItems = mutableListOf<MenuItemImpl>()
|
||||||
|
val overflowItems = mutableListOf<MenuItemImpl>()
|
||||||
|
for (i in 0 until menuBuilder.size()) {
|
||||||
|
val item = menuBuilder.getItem(i) as MenuItemImpl
|
||||||
|
if (!item.isVisible) continue
|
||||||
|
if (item.requiresActionButton() || item.requestsActionButton()) {
|
||||||
|
actionItems.add(item)
|
||||||
|
} else {
|
||||||
|
overflowItems.add(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (item in actionItems) {
|
||||||
|
createActionButton(item)?.let { button ->
|
||||||
|
binding.toolbarActionGroup.addView(button)
|
||||||
|
actionButtons[item.itemId] = button
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overflowItems.isNotEmpty()) {
|
||||||
|
binding.toolbarActionGroup.addView(createOverflowButton(overflowItems))
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.toolbarActionGroup.isVisible = binding.toolbarActionGroup.childCount > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
|
private fun createActionButton(item: MenuItemImpl): RippleFixMaterialButton? {
|
||||||
|
val button =
|
||||||
|
RippleFixMaterialButton(
|
||||||
|
createActionButtonContext(item.itemId),
|
||||||
|
null,
|
||||||
|
MR.attr.materialIconButtonStyle,
|
||||||
|
).apply {
|
||||||
|
configureIconButton(this)
|
||||||
|
id = item.itemId
|
||||||
|
icon = item.icon
|
||||||
|
contentDescription = item.title
|
||||||
|
isEnabled = item.isEnabled
|
||||||
|
TooltipCompat.setTooltipText(this, item.title)
|
||||||
|
setOnClickListener { view ->
|
||||||
|
if (item.hasSubMenu()) {
|
||||||
|
showPopupMenu(view, item.subMenu)
|
||||||
|
} else {
|
||||||
|
menuItemClickListener?.onMenuItemClick(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return button
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
|
private fun createOverflowButton(overflowItems: List<MenuItemImpl>): RippleFixMaterialButton {
|
||||||
|
return RippleFixMaterialButton(context, null, MR.attr.materialIconButtonStyle).apply {
|
||||||
|
configureIconButton(this)
|
||||||
|
setIconResource(R.drawable.ic_more_vert_24)
|
||||||
|
contentDescription = context.getString(R.string.lbl_more)
|
||||||
|
TooltipCompat.setTooltipText(this, contentDescription)
|
||||||
|
setOnClickListener { view ->
|
||||||
|
val customListener = overflowClickListener
|
||||||
|
if (customListener != null) {
|
||||||
|
customListener(view)
|
||||||
|
} else {
|
||||||
|
showPopupMenu(view, overflowItems, menuBuilder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showPopupMenu(anchor: View, menu: Menu?) {
|
||||||
|
if (menu == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showPopupMenu(anchor, List(menu.size()) { menu.getItem(it) }.filter { it.isVisible }, menu)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showPopupMenu(anchor: View, items: List<MenuItem>, sourceMenu: Menu) {
|
||||||
|
val popup = PopupMenu(context, anchor)
|
||||||
|
MenuCompat.setGroupDividerEnabled(
|
||||||
|
popup.menu,
|
||||||
|
(sourceMenu as? MenuBuilder)?.isGroupDividerEnabled ?: false,
|
||||||
|
)
|
||||||
|
|
||||||
|
val originalItems = mutableMapOf<Int, MenuItem>()
|
||||||
|
for (item in items) {
|
||||||
|
popup.menu.add(item.groupId, item.itemId, item.order, item.title).apply {
|
||||||
|
icon = item.icon
|
||||||
|
isEnabled = item.isEnabled
|
||||||
|
isCheckable = item.isCheckable
|
||||||
|
isChecked = item.isChecked
|
||||||
|
}
|
||||||
|
originalItems[item.itemId] = item
|
||||||
|
}
|
||||||
|
|
||||||
|
popup.setOnMenuItemClickListener { clickedItem ->
|
||||||
|
val originalItem = originalItems[clickedItem.itemId] ?: return@setOnMenuItemClickListener false
|
||||||
|
if (originalItem.hasSubMenu()) {
|
||||||
|
showPopupMenu(anchor, originalItem.subMenu)
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
menuItemClickListener?.onMenuItemClick(originalItem) ?: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
popup.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createActionButtonContext(itemId: Int): Context {
|
||||||
|
val themeOverlayRes =
|
||||||
|
when (itemId) {
|
||||||
|
R.id.action_play -> R.style.ThemeOverlay_Auxio_IconButton_Style_Small_Secondary
|
||||||
|
R.id.action_shuffle -> R.style.ThemeOverlay_Auxio_IconButton_Style_Small_Primary
|
||||||
|
else -> 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (themeOverlayRes != 0) ContextThemeWrapper(context, themeOverlayRes) else context
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2026 Auxio Project
|
|
||||||
* ButtonGroupToolbar.kt is part of Auxio.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.oxycblt.auxio.ui
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import androidx.annotation.AttrRes
|
|
||||||
import androidx.annotation.MenuRes
|
|
||||||
import androidx.appcompat.view.SupportMenuInflater
|
|
||||||
import androidx.appcompat.view.menu.MenuBuilder
|
|
||||||
import androidx.appcompat.view.menu.MenuItemImpl
|
|
||||||
import androidx.appcompat.widget.PopupMenu
|
|
||||||
import com.google.android.material.R as MR
|
|
||||||
import com.google.android.material.appbar.MaterialToolbar
|
|
||||||
import com.google.android.material.button.MaterialButtonGroup
|
|
||||||
import org.oxycblt.auxio.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A [MaterialToolbar] that replaces the standard
|
|
||||||
* [ActionMenuView][androidx.appcompat.widget.ActionMenuView] action items with a
|
|
||||||
* [MaterialButtonGroup] containing [RippleFixMaterialButton] instances. This enables M3 Expressive
|
|
||||||
* shape morphing and width animation behavior for toolbar action buttons.
|
|
||||||
*
|
|
||||||
* Since [MaterialToolbar] has no integration with [MaterialButtonGroup], this class intercepts menu
|
|
||||||
* inflation and constructs its own button group from the menu resource, hiding the internal
|
|
||||||
* [ActionMenuView][androidx.appcompat.widget.ActionMenuView] entirely. This is fragile, but the
|
|
||||||
* relevant internal APIs haven't changed in years.
|
|
||||||
*
|
|
||||||
* @author Alexander Capehart (OxygenCobalt)
|
|
||||||
*/
|
|
||||||
class ButtonGroupToolbar
|
|
||||||
@JvmOverloads
|
|
||||||
constructor(
|
|
||||||
context: Context,
|
|
||||||
attrs: AttributeSet? = null,
|
|
||||||
@AttrRes defStyleAttr: Int = androidx.appcompat.R.attr.toolbarStyle,
|
|
||||||
) : MaterialToolbar(context, attrs, defStyleAttr) {
|
|
||||||
private var menuItemClickListener: OnMenuItemClickListener? = null
|
|
||||||
private var overflowClickListener: ((View) -> Unit)? = null
|
|
||||||
private var buttonGroup: MaterialButtonGroup? = null
|
|
||||||
@SuppressLint("RestrictedApi") private var menuBuilder: MenuBuilder? = null
|
|
||||||
private var isInitialized = false
|
|
||||||
|
|
||||||
// Intercept inflateMenu calls from the super constructor to prevent ActionMenuView creation.
|
|
||||||
// During the super constructor, isInitialized is false so this is a no-op. After
|
|
||||||
// construction, this delegates to buildButtonGroup.
|
|
||||||
override fun inflateMenu(@MenuRes resId: Int) {
|
|
||||||
if (isInitialized) {
|
|
||||||
buildButtonGroup(resId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
// Read the menu attribute ourselves since we suppressed inflateMenu during the super
|
|
||||||
// constructor. This uses the same Toolbar_menu styleable that Toolbar reads internally.
|
|
||||||
val a =
|
|
||||||
context.obtainStyledAttributes(
|
|
||||||
attrs,
|
|
||||||
androidx.appcompat.R.styleable.Toolbar,
|
|
||||||
defStyleAttr,
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
val menuResId = a.getResourceId(androidx.appcompat.R.styleable.Toolbar_menu, 0)
|
|
||||||
a.recycle()
|
|
||||||
|
|
||||||
isInitialized = true
|
|
||||||
if (menuResId != 0) {
|
|
||||||
buildButtonGroup(menuResId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
override fun getMenu(): Menu {
|
|
||||||
return menuBuilder ?: super.getMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setOnMenuItemClickListener(listener: OnMenuItemClickListener?) {
|
|
||||||
menuItemClickListener = listener
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override the overflow button's click behavior. When set, the overflow button will call
|
|
||||||
* [block] instead of showing the default popup menu.
|
|
||||||
*/
|
|
||||||
fun overrideOnOverflowMenuClick(block: (View) -> Unit) {
|
|
||||||
overflowClickListener = block
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
private fun buildButtonGroup(@MenuRes resId: Int) {
|
|
||||||
// Inflate the menu into a MenuBuilder, re-using the same pattern as MenuDialogFragment.
|
|
||||||
// Since we don't have (and don't want) a dummy view to inflate this menu, just
|
|
||||||
// depend on the AndroidX Toolbar internal API and hope for the best.
|
|
||||||
val builder = MenuBuilder(context)
|
|
||||||
SupportMenuInflater(context).inflate(resId, builder)
|
|
||||||
menuBuilder = builder
|
|
||||||
|
|
||||||
// Separate action items from overflow items based on showAsAction flags.
|
|
||||||
val actionItems = mutableListOf<MenuItemImpl>()
|
|
||||||
val overflowItems = mutableListOf<MenuItemImpl>()
|
|
||||||
for (i in 0 until builder.size()) {
|
|
||||||
val item = builder.getItem(i) as MenuItemImpl
|
|
||||||
if (!item.isVisible) continue
|
|
||||||
if (item.requiresActionButton() || item.requestsActionButton()) {
|
|
||||||
actionItems.add(item)
|
|
||||||
} else {
|
|
||||||
overflowItems.add(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove old button group if one exists.
|
|
||||||
buttonGroup?.let { removeView(it) }
|
|
||||||
|
|
||||||
// Create new button group using the theme-configured style.
|
|
||||||
val group =
|
|
||||||
MaterialButtonGroup(context, null, MR.attr.materialButtonGroupStyle).apply {
|
|
||||||
layoutParams =
|
|
||||||
LayoutParams(
|
|
||||||
LayoutParams.WRAP_CONTENT,
|
|
||||||
LayoutParams.WRAP_CONTENT,
|
|
||||||
Gravity.END or Gravity.CENTER_VERTICAL,
|
|
||||||
)
|
|
||||||
spacing = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a MaterialButton for each action item.
|
|
||||||
for (item in actionItems) {
|
|
||||||
val button =
|
|
||||||
RippleFixMaterialButton(context, null, MR.attr.materialIconButtonStyle).apply {
|
|
||||||
layoutParams =
|
|
||||||
LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
)
|
|
||||||
id = item.itemId
|
|
||||||
icon = item.icon
|
|
||||||
contentDescription = item.title
|
|
||||||
setOnClickListener { menuItemClickListener?.onMenuItemClick(item) }
|
|
||||||
}
|
|
||||||
group.addView(button)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add an overflow button if there are overflow items.
|
|
||||||
if (overflowItems.isNotEmpty()) {
|
|
||||||
val overflowButton =
|
|
||||||
RippleFixMaterialButton(context, null, MR.attr.materialIconButtonStyle).apply {
|
|
||||||
layoutParams =
|
|
||||||
LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
)
|
|
||||||
setIconResource(R.drawable.ic_more_vert_24)
|
|
||||||
contentDescription = context.getString(R.string.lbl_more)
|
|
||||||
setOnClickListener { view ->
|
|
||||||
val customListener = overflowClickListener
|
|
||||||
if (customListener != null) {
|
|
||||||
customListener(view)
|
|
||||||
} else {
|
|
||||||
showOverflowPopup(view, overflowItems)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
group.addView(overflowButton)
|
|
||||||
}
|
|
||||||
|
|
||||||
addView(group)
|
|
||||||
buttonGroup = group
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showOverflowPopup(anchor: View, items: List<MenuItem>) {
|
|
||||||
val popup = PopupMenu(context, anchor)
|
|
||||||
for (item in items) {
|
|
||||||
popup.menu.add(item.groupId, item.itemId, item.order, item.title).apply {
|
|
||||||
icon = item.icon
|
|
||||||
isEnabled = item.isEnabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popup.setOnMenuItemClickListener { clickedItem ->
|
|
||||||
menuItemClickListener?.onMenuItemClick(clickedItem) ?: false
|
|
||||||
}
|
|
||||||
popup.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -41,10 +41,8 @@ import androidx.navigation.NavController
|
|||||||
import androidx.navigation.NavDirections
|
import androidx.navigation.NavDirections
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.google.android.material.appbar.MaterialToolbar
|
|
||||||
import java.lang.IllegalArgumentException
|
import java.lang.IllegalArgumentException
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
import org.oxycblt.musikr.MusicParent
|
import org.oxycblt.musikr.MusicParent
|
||||||
import org.oxycblt.musikr.Song
|
import org.oxycblt.musikr.Song
|
||||||
import timber.log.Timber as L
|
import timber.log.Timber as L
|
||||||
@@ -109,33 +107,6 @@ val View.isRtl: Boolean
|
|||||||
val ViewBinding.context: Context
|
val ViewBinding.context: Context
|
||||||
get() = root.context
|
get() = root.context
|
||||||
|
|
||||||
/**
|
|
||||||
* Override the behavior of a [MaterialToolbar]'s overflow menu to do something else. This is
|
|
||||||
* extremely dumb, but required to hook overflow menus to bottom sheet menus.
|
|
||||||
*/
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
fun Toolbar.overrideOnOverflowMenuClick(block: (View) -> Unit) {
|
|
||||||
if (this is ButtonGroupToolbar) {
|
|
||||||
// ButtonGroupToolbar manages its own overflow button, delegate directly.
|
|
||||||
overrideOnOverflowMenuClick(block)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for (toolbarChild in children) {
|
|
||||||
if (toolbarChild is ActionMenuView) {
|
|
||||||
for (menuChild in toolbarChild.children) {
|
|
||||||
// The overflow menu's view implementation is package-private, so test for the
|
|
||||||
// first child that isn't a plain action button.
|
|
||||||
if (menuChild !is ActionMenuItemView) {
|
|
||||||
// Override all listeners related to opening the overflow menu.
|
|
||||||
menuChild.setOnTouchListener(null)
|
|
||||||
menuChild.setOnClickListener(block)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut to easily set up a [GridLayoutManager.SpanSizeLookup].
|
* Shortcut to easily set up a [GridLayoutManager.SpanSizeLookup].
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -146,63 +146,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin">
|
app:layout_collapseMode="pin">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_normal_toolbar"
|
android:id="@+id/detail_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:menu="@menu/toolbar_detail"
|
app:menu="@menu/toolbar_detail"
|
||||||
app:navigationIcon="@drawable/ic_back_24">
|
app:navigationIcon="@drawable/ic_back_24" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_toolbar_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_tiny"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?attr/textAppearanceTitleLargeEmphasized"
|
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
tools:text="Name" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:spacing="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_info">
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_play"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_play_24" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_shuffle"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Primary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_shuffle_off_24" />
|
|
||||||
</com.google.android.material.button.MaterialButtonGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
android:id="@+id/detail_selection_toolbar"
|
android:id="@+id/detail_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -211,7 +164,7 @@
|
|||||||
app:menu="@menu/toolbar_selection"
|
app:menu="@menu/toolbar_selection"
|
||||||
app:navigationIcon="@drawable/ic_close_24" />
|
app:navigationIcon="@drawable/ic_close_24" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_edit_toolbar"
|
android:id="@+id/detail_edit_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/playback_toolbar"
|
android:id="@+id/playback_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -132,64 +132,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin" >
|
app:layout_collapseMode="pin" >
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_normal_toolbar"
|
android:id="@+id/detail_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:menu="@menu/toolbar_detail"
|
app:menu="@menu/toolbar_detail"
|
||||||
app:navigationIcon="@drawable/ic_back_24">
|
app:navigationIcon="@drawable/ic_back_24" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_toolbar_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_tiny"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?attr/textAppearanceTitleLargeEmphasized"
|
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
tools:text="Name" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:spacing="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_info">
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_play"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_play_24" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_shuffle"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Primary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_shuffle_off_24" />
|
|
||||||
</com.google.android.material.button.MaterialButtonGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
android:id="@+id/detail_selection_toolbar"
|
android:id="@+id/detail_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -198,7 +150,7 @@
|
|||||||
app:menu="@menu/toolbar_selection"
|
app:menu="@menu/toolbar_selection"
|
||||||
app:navigationIcon="@drawable/ic_close_24" />
|
app:navigationIcon="@drawable/ic_close_24" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_edit_toolbar"
|
android:id="@+id/detail_edit_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/playback_toolbar"
|
android:id="@+id/playback_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -144,64 +144,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin">
|
app:layout_collapseMode="pin">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_normal_toolbar"
|
android:id="@+id/detail_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:menu="@menu/toolbar_detail"
|
app:menu="@menu/toolbar_detail"
|
||||||
app:navigationIcon="@drawable/ic_back_24">
|
app:navigationIcon="@drawable/ic_back_24" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_toolbar_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_tiny"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?attr/textAppearanceTitleLargeEmphasized"
|
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
tools:text="Name" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:spacing="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_info">
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_play"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_play_24" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_shuffle"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Primary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_shuffle_off_24" />
|
|
||||||
</com.google.android.material.button.MaterialButtonGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
android:id="@+id/detail_selection_toolbar"
|
android:id="@+id/detail_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -210,7 +162,7 @@
|
|||||||
app:menu="@menu/toolbar_selection"
|
app:menu="@menu/toolbar_selection"
|
||||||
app:navigationIcon="@drawable/ic_close_24" />
|
app:navigationIcon="@drawable/ic_close_24" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_edit_toolbar"
|
android:id="@+id/detail_edit_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -146,63 +146,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin">
|
app:layout_collapseMode="pin">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_normal_toolbar"
|
android:id="@+id/detail_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:menu="@menu/toolbar_detail"
|
app:menu="@menu/toolbar_detail"
|
||||||
app:navigationIcon="@drawable/ic_back_24">
|
app:navigationIcon="@drawable/ic_back_24" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_toolbar_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_tiny"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?attr/textAppearanceTitleLargeEmphasized"
|
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
tools:text="Name" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:spacing="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_info">
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_play"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_play_24" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_shuffle"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Primary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_shuffle_off_24" />
|
|
||||||
</com.google.android.material.button.MaterialButtonGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
android:id="@+id/detail_selection_toolbar"
|
android:id="@+id/detail_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -211,7 +164,7 @@
|
|||||||
app:menu="@menu/toolbar_selection"
|
app:menu="@menu/toolbar_selection"
|
||||||
app:navigationIcon="@drawable/ic_close_24" />
|
app:navigationIcon="@drawable/ic_close_24" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_edit_toolbar"
|
android:id="@+id/detail_edit_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
style="@style/Widget.Auxio.AppBarLayout"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/about_toolbar"
|
android:id="@+id/about_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -119,64 +119,16 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_collapseMode="pin">
|
app:layout_collapseMode="pin">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_normal_toolbar"
|
android:id="@+id/detail_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:menu="@menu/toolbar_detail"
|
app:menu="@menu/toolbar_detail"
|
||||||
app:navigationIcon="@drawable/ic_back_24">
|
app:navigationIcon="@drawable/ic_back_24" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/detail_toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/detail_toolbar_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="@dimen/spacing_tiny"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?attr/textAppearanceTitleLargeEmphasized"
|
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
tools:text="Name" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:spacing="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/detail_info">
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_play"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_play_24" />
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
|
||||||
android:id="@+id/detail_toolbar_shuffle"
|
|
||||||
style="@style/Widget.Auxio.Button.Icon.Small.Primary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_shuffle_off_24" />
|
|
||||||
</com.google.android.material.button.MaterialButtonGroup>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
|
||||||
android:id="@+id/detail_selection_toolbar"
|
android:id="@+id/detail_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -185,7 +137,7 @@
|
|||||||
app:menu="@menu/toolbar_selection"
|
app:menu="@menu/toolbar_selection"
|
||||||
app:navigationIcon="@drawable/ic_close_24" />
|
app:navigationIcon="@drawable/ic_close_24" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/detail_edit_toolbar"
|
android:id="@+id/detail_edit_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/home_normal_toolbar"
|
android:id="@+id/home_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
app:menu="@menu/toolbar_home"
|
app:menu="@menu/toolbar_home"
|
||||||
app:title="@string/info_app_name" />
|
app:title="@string/info_app_name" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/home_selection_toolbar"
|
android:id="@+id/home_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/playback_toolbar"
|
android:id="@+id/playback_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/preferences_toolbar"
|
android:id="@+id/preferences_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/search_normal_toolbar"
|
android:id="@+id/search_normal_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -47,9 +47,9 @@
|
|||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</org.oxycblt.auxio.ui.AuxioToolbar>
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.ButtonGroupToolbar
|
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||||
android:id="@+id/search_selection_toolbar"
|
android:id="@+id/search_selection_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/toolbar_root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:baselineAligned="false"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||||
|
android:id="@+id/toolbar_navigation_button"
|
||||||
|
style="@style/Widget.Auxio.Button.Icon.Base"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="-12dp" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/toolbar_content_frame"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_margin="@dimen/spacing_medium"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/toolbar_title_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbar_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?attr/colorOnSurface" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbar_subtitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButtonGroup
|
||||||
|
android:id="@+id/toolbar_action_group"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,8 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_play"
|
||||||
|
android:icon="@drawable/ic_play_24"
|
||||||
|
android:title="@string/lbl_play"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_shuffle"
|
||||||
|
android:icon="@drawable/ic_shuffle_off_24"
|
||||||
|
android:title="@string/lbl_shuffle"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/placeholder"
|
android:id="@+id/placeholder"
|
||||||
android:title=""
|
android:title=""
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -2,25 +2,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- ANDROID COMPONENT-SPECIFIC STYLES.-->
|
<!-- ANDROID COMPONENT-SPECIFIC STYLES.-->
|
||||||
|
|
||||||
<!--
|
|
||||||
Hacks around the incorrectly-sized navigation icon in the Toolbar, changing it from
|
|
||||||
56dp to 48dp.
|
|
||||||
-->
|
|
||||||
<style name="Widget.Auxio.Toolbar.Navigation" parent="Widget.AppCompat.Toolbar.Button.Navigation">
|
|
||||||
<item name="android:minWidth">@dimen/size_touchable_small</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Hacks around the old overflow button that was deliberately downsized to 36dp
|
|
||||||
(presumably for compat with older devices)
|
|
||||||
-->
|
|
||||||
<style name="Widget.Auxio.Button.Overflow" parent="Widget.AppCompat.ActionButton.Overflow">
|
|
||||||
<item name="android:minWidth">@dimen/size_touchable_small</item>
|
|
||||||
<item name="android:minHeight">@dimen/size_touchable_small</item>
|
|
||||||
<item name="android:paddingStart">0dp</item>
|
|
||||||
<item name="android:paddingEnd">0dp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Auxio.Dialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
|
<style name="Theme.Auxio.Dialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
|
||||||
<item name="materialAlertDialogTitleTextStyle">@style/TextStyle.Auxio.Dialog</item>
|
<item name="materialAlertDialogTitleTextStyle">@style/TextStyle.Auxio.Dialog</item>
|
||||||
<item name="android:checkedTextViewStyle">@style/Widget.Auxio.Dialog.CheckedTextView</item>
|
<item name="android:checkedTextViewStyle">@style/Widget.Auxio.Dialog.CheckedTextView</item>
|
||||||
|
|||||||
@@ -115,8 +115,6 @@
|
|||||||
<item name="dialogPreferenceStyle">@style/Preference.Auxio.DialogPreference</item>
|
<item name="dialogPreferenceStyle">@style/Preference.Auxio.DialogPreference</item>
|
||||||
<item name="switchPreferenceCompatStyle">@style/Preference.Auxio.SwitchPreferenceCompat
|
<item name="switchPreferenceCompatStyle">@style/Preference.Auxio.SwitchPreferenceCompat
|
||||||
</item>
|
</item>
|
||||||
<item name="toolbarNavigationButtonStyle">@style/Widget.Auxio.Toolbar.Navigation</item>
|
|
||||||
<item name="actionOverflowButtonStyle">@style/Widget.Auxio.Button.Overflow</item>
|
|
||||||
<item name="materialButtonGroupStyle">@style/Widget.Auxio.MaterialButtonGroup</item>
|
<item name="materialButtonGroupStyle">@style/Widget.Auxio.MaterialButtonGroup</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -428,6 +428,14 @@
|
|||||||
<item name="colorOnContainer">?attr/colorOnSecondaryContainer</item>
|
<item name="colorOnContainer">?attr/colorOnSecondaryContainer</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="ThemeOverlay.Auxio.IconButton.Style.Small.Primary" parent="">
|
||||||
|
<item name="materialIconButtonStyle">@style/Widget.Auxio.Button.Icon.Small.Primary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ThemeOverlay.Auxio.IconButton.Style.Small.Secondary" parent="">
|
||||||
|
<item name="materialIconButtonStyle">@style/Widget.Auxio.Button.Icon.Small.Secondary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Auxio.Button.PlayPause" parent="Widget.Material3Expressive.Button.IconButton">
|
<style name="Widget.Auxio.Button.PlayPause" parent="Widget.Material3Expressive.Button.IconButton">
|
||||||
<item name="android:checkable">true</item>
|
<item name="android:checkable">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user