Cleanup code
Cleanup a bunch of redundant, unused, and bad code.
This commit is contained in:
parent
13b80585d2
commit
d8a40fe219
32 changed files with 66 additions and 109 deletions
|
@ -1,17 +1,20 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="org.oxycblt.auxio">
|
package="org.oxycblt.auxio">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
|
<!-- TODO: Backup -->
|
||||||
<application
|
<application
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Base">
|
android:theme="@style/Theme.Base"
|
||||||
|
tools:ignore="AllowBackup">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
|
@ -59,9 +59,9 @@ class MainFragment : Fragment() {
|
||||||
)
|
)
|
||||||
|
|
||||||
val navController = (
|
val navController = (
|
||||||
childFragmentManager.findFragmentById(R.id.explore_nav_host)
|
childFragmentManager.findFragmentById(R.id.explore_nav_host)
|
||||||
as NavHostFragment?
|
as NavHostFragment?
|
||||||
)?.findNavController()
|
)?.findNavController()
|
||||||
|
|
||||||
// --- UI SETUP ---
|
// --- UI SETUP ---
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ class AlbumDetailFragment : DetailFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't enable the sort button if there's only one song [or less]
|
// Don't enable the sort button if there's only one song [or less]
|
||||||
if (detailModel.currentAlbum.value!!.numSongs < 2) {
|
if (detailModel.currentAlbum.value!!.songs.size < 2) {
|
||||||
binding.albumSortButton.disable(requireContext())
|
binding.albumSortButton.disable(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ArtistDetailFragment : DetailFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable the sort button if there is only one album [Or less]
|
// Disable the sort button if there is only one album [Or less]
|
||||||
if (detailModel.currentArtist.value!!.numAlbums < 2) {
|
if (detailModel.currentArtist.value!!.albums.size < 2) {
|
||||||
binding.artistSortButton.disable(requireContext())
|
binding.artistSortButton.disable(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class GenreDetailFragment : DetailFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable the sort button if there is only one artist [Or less]
|
// Disable the sort button if there is only one artist [Or less]
|
||||||
if (detailModel.currentGenre.value!!.numArtists < 2) {
|
if (detailModel.currentGenre.value!!.artists.size < 2) {
|
||||||
binding.genreSortButton.disable(requireContext())
|
binding.genreSortButton.disable(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class LibraryViewModel : ViewModel() {
|
||||||
val searchHasFocus: Boolean get() = mSearchHasFocus
|
val searchHasFocus: Boolean get() = mSearchHasFocus
|
||||||
|
|
||||||
// TODO: Move these to prefs when they're added
|
// TODO: Move these to prefs when they're added
|
||||||
private val mShowMode = MutableLiveData(ShowMode.SHOW_GENRES)
|
private val mShowMode = MutableLiveData(ShowMode.SHOW_ARTISTS)
|
||||||
val showMode: LiveData<ShowMode> get() = mShowMode
|
val showMode: LiveData<ShowMode> get() = mShowMode
|
||||||
|
|
||||||
private val mSortMode = MutableLiveData(SortMode.ALPHA_DOWN)
|
private val mSortMode = MutableLiveData(SortMode.ALPHA_DOWN)
|
||||||
|
|
|
@ -45,7 +45,6 @@ data class Song(
|
||||||
* @property year The year this album was released. 0 if there is none in the metadata.
|
* @property year The year this album was released. 0 if there is none in the metadata.
|
||||||
* @property artist The Album's parent [Artist]. use this instead of [artistId]
|
* @property artist The Album's parent [Artist]. use this instead of [artistId]
|
||||||
* @property songs The Album's child [Song]s.
|
* @property songs The Album's child [Song]s.
|
||||||
* @property numSongs The amount of songs in an Album.
|
|
||||||
* @property totalDuration The combined duration of all of the album's child songs, formatted.
|
* @property totalDuration The combined duration of all of the album's child songs, formatted.
|
||||||
* @author OxygenCobalt
|
* @author OxygenCobalt
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +58,6 @@ data class Album(
|
||||||
lateinit var artist: Artist
|
lateinit var artist: Artist
|
||||||
|
|
||||||
val songs = mutableListOf<Song>()
|
val songs = mutableListOf<Song>()
|
||||||
val numSongs: Int get() = songs.size
|
|
||||||
val totalDuration: String by lazy {
|
val totalDuration: String by lazy {
|
||||||
var seconds: Long = 0
|
var seconds: Long = 0
|
||||||
songs.forEach {
|
songs.forEach {
|
||||||
|
@ -80,15 +78,7 @@ data class Artist(
|
||||||
val albums = mutableListOf<Album>()
|
val albums = mutableListOf<Album>()
|
||||||
val genres = mutableListOf<Genre>()
|
val genres = mutableListOf<Genre>()
|
||||||
|
|
||||||
val numAlbums: Int get() = albums.size
|
val songs: List<Song> by lazy {
|
||||||
val numSongs: Int by lazy {
|
|
||||||
var num = 0
|
|
||||||
albums.forEach {
|
|
||||||
num += it.numSongs
|
|
||||||
}
|
|
||||||
num
|
|
||||||
}
|
|
||||||
val songs: MutableList<Song> by lazy {
|
|
||||||
val songs = mutableListOf<Song>()
|
val songs = mutableListOf<Song>()
|
||||||
albums.forEach {
|
albums.forEach {
|
||||||
songs.addAll(it.songs)
|
songs.addAll(it.songs)
|
||||||
|
@ -109,22 +99,14 @@ data class Genre(
|
||||||
) : BaseModel() {
|
) : BaseModel() {
|
||||||
val artists = mutableListOf<Artist>()
|
val artists = mutableListOf<Artist>()
|
||||||
|
|
||||||
val numArtists: Int get() = artists.size
|
val albums: List<Album> by lazy {
|
||||||
val numAlbums: Int by lazy {
|
val albums = mutableListOf<Album>()
|
||||||
var num = 0
|
|
||||||
artists.forEach {
|
artists.forEach {
|
||||||
num += it.numAlbums
|
albums.addAll(it.albums)
|
||||||
}
|
}
|
||||||
num
|
albums
|
||||||
}
|
}
|
||||||
val numSongs: Int by lazy {
|
val songs: List<Song> by lazy {
|
||||||
var num = 0
|
|
||||||
artists.forEach {
|
|
||||||
num += it.numSongs
|
|
||||||
}
|
|
||||||
num
|
|
||||||
}
|
|
||||||
val songs: MutableList<Song> by lazy {
|
|
||||||
val songs = mutableListOf<Song>()
|
val songs = mutableListOf<Song>()
|
||||||
artists.forEach {
|
artists.forEach {
|
||||||
songs.addAll(it.songs)
|
songs.addAll(it.songs)
|
||||||
|
|
|
@ -92,10 +92,10 @@ fun Int.toYear(context: Context): String {
|
||||||
@BindingAdapter("genreCounts")
|
@BindingAdapter("genreCounts")
|
||||||
fun TextView.bindGenreCounts(genre: Genre) {
|
fun TextView.bindGenreCounts(genre: Genre) {
|
||||||
val artists = context.resources.getQuantityString(
|
val artists = context.resources.getQuantityString(
|
||||||
R.plurals.format_artist_count, genre.numArtists, genre.numArtists
|
R.plurals.format_artist_count, genre.artists.size, genre.artists.size
|
||||||
)
|
)
|
||||||
val albums = context.resources.getQuantityString(
|
val albums = context.resources.getQuantityString(
|
||||||
R.plurals.format_album_count, genre.numAlbums, genre.numAlbums
|
R.plurals.format_album_count, genre.albums.size, genre.albums.size
|
||||||
)
|
)
|
||||||
|
|
||||||
text = context.getString(R.string.format_double_counts, artists, albums)
|
text = context.getString(R.string.format_double_counts, artists, albums)
|
||||||
|
@ -116,10 +116,10 @@ fun TextView.bindArtistGenre(artist: Artist) {
|
||||||
@BindingAdapter("artistCounts")
|
@BindingAdapter("artistCounts")
|
||||||
fun TextView.bindArtistCounts(artist: Artist) {
|
fun TextView.bindArtistCounts(artist: Artist) {
|
||||||
val albums = context.resources.getQuantityString(
|
val albums = context.resources.getQuantityString(
|
||||||
R.plurals.format_album_count, artist.numAlbums, artist.numAlbums
|
R.plurals.format_album_count, artist.albums.size, artist.albums.size
|
||||||
)
|
)
|
||||||
val songs = context.resources.getQuantityString(
|
val songs = context.resources.getQuantityString(
|
||||||
R.plurals.format_song_count, artist.numSongs, artist.numSongs
|
R.plurals.format_song_count, artist.songs.size, artist.songs.size
|
||||||
)
|
)
|
||||||
|
|
||||||
text = context.getString(R.string.format_double_counts, albums, songs)
|
text = context.getString(R.string.format_double_counts, albums, songs)
|
||||||
|
@ -133,7 +133,7 @@ fun TextView.bindAllAlbumDetails(album: Album) {
|
||||||
album.year.toYear(context),
|
album.year.toYear(context),
|
||||||
context.resources.getQuantityString(
|
context.resources.getQuantityString(
|
||||||
R.plurals.format_song_count,
|
R.plurals.format_song_count,
|
||||||
album.numSongs, album.numSongs
|
album.songs.size, album.songs.size
|
||||||
),
|
),
|
||||||
album.totalDuration
|
album.totalDuration
|
||||||
)
|
)
|
||||||
|
@ -147,7 +147,7 @@ fun TextView.bindAlbumInfo(album: Album) {
|
||||||
album.artist.name,
|
album.artist.name,
|
||||||
context.resources.getQuantityString(
|
context.resources.getQuantityString(
|
||||||
R.plurals.format_song_count,
|
R.plurals.format_song_count,
|
||||||
album.numSongs, album.numSongs
|
album.songs.size, album.songs.size
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.oxycblt.auxio.music.coil
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import androidx.databinding.BindingAdapter
|
import androidx.databinding.BindingAdapter
|
||||||
|
@ -16,7 +15,7 @@ import org.oxycblt.auxio.music.Genre
|
||||||
import org.oxycblt.auxio.music.Song
|
import org.oxycblt.auxio.music.Song
|
||||||
|
|
||||||
// Get a bitmap for a song, onDone will be called when the bitmap is loaded.
|
// Get a bitmap for a song, onDone will be called when the bitmap is loaded.
|
||||||
// Don't use this on UI elements, thats what the BindingAdapters are for.
|
// Don't use this on UI elements, that's what the BindingAdapters are for.
|
||||||
fun getBitmap(song: Song, context: Context, onDone: (Bitmap) -> Unit) {
|
fun getBitmap(song: Song, context: Context, onDone: (Bitmap) -> Unit) {
|
||||||
Coil.enqueue(
|
Coil.enqueue(
|
||||||
ImageRequest.Builder(context)
|
ImageRequest.Builder(context)
|
||||||
|
@ -57,7 +56,7 @@ fun ImageView.bindArtistImage(artist: Artist) {
|
||||||
val request: ImageRequest
|
val request: ImageRequest
|
||||||
|
|
||||||
// If there is more than one album, then create a mosaic of them.
|
// If there is more than one album, then create a mosaic of them.
|
||||||
if (artist.numAlbums >= 4) {
|
if (artist.albums.size >= 4) {
|
||||||
val uris = mutableListOf<Uri>()
|
val uris = mutableListOf<Uri>()
|
||||||
|
|
||||||
for (i in 0..3) {
|
for (i in 0..3) {
|
||||||
|
@ -93,11 +92,9 @@ fun ImageView.bindArtistImage(artist: Artist) {
|
||||||
fun ImageView.bindGenreImage(genre: Genre) {
|
fun ImageView.bindGenreImage(genre: Genre) {
|
||||||
val request: ImageRequest
|
val request: ImageRequest
|
||||||
|
|
||||||
if (genre.numArtists >= 4) {
|
if (genre.artists.size >= 4) {
|
||||||
val uris = mutableListOf<Uri>()
|
val uris = mutableListOf<Uri>()
|
||||||
|
|
||||||
Log.d(this::class.simpleName, genre.numAlbums.toString())
|
|
||||||
|
|
||||||
// Get the Nth cover from each artist, if possible.
|
// Get the Nth cover from each artist, if possible.
|
||||||
for (i in 0..3) {
|
for (i in 0..3) {
|
||||||
val artist = genre.artists[i]
|
val artist = genre.artists[i]
|
||||||
|
|
|
@ -21,7 +21,7 @@ enum class MusicLoaderResponse {
|
||||||
|
|
||||||
// Class that loads music from the FileSystem.
|
// Class that loads music from the FileSystem.
|
||||||
// TODO: Add custom artist images from the filesystem
|
// TODO: Add custom artist images from the filesystem
|
||||||
// TODO: Move genre loading of songs [Loads would take longer though]
|
// TODO: Move genre loading to songs [Loads would take longer though]
|
||||||
class MusicLoader(
|
class MusicLoader(
|
||||||
private val resolver: ContentResolver,
|
private val resolver: ContentResolver,
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class MusicLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
albums = albums.distinctBy {
|
albums = albums.distinctBy {
|
||||||
it.name to it.artistId to it.year to it.numSongs
|
it.name to it.artistId to it.year
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
Log.d(
|
Log.d(
|
||||||
|
|
|
@ -57,8 +57,6 @@ fun NotificationManager.createMediaNotification(
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Things that probably aren't possible but would be nice
|
|
||||||
// - Playing intent takes you to PlaybackFragment instead of MainFragment
|
|
||||||
return NotificationCompat.Builder(context, NotificationUtils.CHANNEL_ID)
|
return NotificationCompat.Builder(context, NotificationUtils.CHANNEL_ID)
|
||||||
.setSmallIcon(R.drawable.ic_song)
|
.setSmallIcon(R.drawable.ic_song)
|
||||||
.setStyle(
|
.setStyle(
|
||||||
|
@ -124,7 +122,7 @@ fun NotificationCompat.Builder.updateMode(context: Context) {
|
||||||
|
|
||||||
// If playing from all songs, set the subtext as that, otherwise the currently played parent.
|
// If playing from all songs, set the subtext as that, otherwise the currently played parent.
|
||||||
if (playbackManager.mode == PlaybackMode.ALL_SONGS) {
|
if (playbackManager.mode == PlaybackMode.ALL_SONGS) {
|
||||||
setSubText(context.getString(R.string.title_all_songs))
|
setSubText(context.getString(R.string.label_all_songs))
|
||||||
} else {
|
} else {
|
||||||
setSubText(playbackManager.parent!!.name)
|
setSubText(playbackManager.parent!!.name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class PlaybackFragment : Fragment(), SeekBar.OnSeekBarChangeListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates for the current duration TextView/Seekbar
|
// Updates for the current duration TextView/SeekBar
|
||||||
playbackModel.formattedPosition.observe(viewLifecycleOwner) {
|
playbackModel.formattedPosition.observe(viewLifecycleOwner) {
|
||||||
binding.playbackDurationCurrent.text = it
|
binding.playbackDurationCurrent.text = it
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,20 +80,21 @@ class QueueAdapter(
|
||||||
fun removeItem(adapterIndex: Int) {
|
fun removeItem(adapterIndex: Int) {
|
||||||
data.removeAt(adapterIndex)
|
data.removeAt(adapterIndex)
|
||||||
|
|
||||||
notifyItemRemoved(adapterIndex)
|
|
||||||
|
|
||||||
// Check for two things:
|
// Check for two things:
|
||||||
// If the data from the next queue is now entirely empty [Signified by a header at the end]
|
// If the data from the next queue is now entirely empty [Signified by a header at the end]
|
||||||
// Or if the data from the last queue is now entirely empty [Signified by there being 2 headers with no items in between]
|
// Or if the data from the last queue is now entirely empty [Signified by there being 2 headers with no items in between]
|
||||||
if (data[data.lastIndex] is Header) {
|
if (data[data.lastIndex] is Header) {
|
||||||
val lastIndex = data.lastIndex
|
val lastIndex = data.lastIndex
|
||||||
|
|
||||||
// TODO: Do notifyItemRangeRemoved instead of notifyItemRemoved
|
|
||||||
data.removeAt(lastIndex)
|
data.removeAt(lastIndex)
|
||||||
notifyItemRemoved(lastIndex)
|
|
||||||
|
notifyItemRangeRemoved(lastIndex, 2)
|
||||||
} else if (data.lastIndex >= 1 && data[0] is Header && data[1] is Header) {
|
} else if (data.lastIndex >= 1 && data[0] is Header && data[1] is Header) {
|
||||||
data.removeAt(0)
|
data.removeAt(0)
|
||||||
notifyItemRemoved(0)
|
|
||||||
|
notifyItemRangeRemoved(0, 2)
|
||||||
|
} else {
|
||||||
|
notifyItemRemoved(adapterIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class QueueFragment : Fragment() {
|
||||||
name = getString(
|
name = getString(
|
||||||
R.string.format_next_from,
|
R.string.format_next_from,
|
||||||
if (playbackModel.mode.value == PlaybackMode.ALL_SONGS)
|
if (playbackModel.mode.value == PlaybackMode.ALL_SONGS)
|
||||||
getString(R.string.title_all_songs)
|
getString(R.string.label_all_songs)
|
||||||
else
|
else
|
||||||
playbackModel.parent.value!!.name
|
playbackModel.parent.value!!.name
|
||||||
)
|
)
|
||||||
|
|
|
@ -133,7 +133,7 @@ class PlaybackStateManager private constructor() {
|
||||||
|
|
||||||
PlaybackMode.IN_ARTIST -> {
|
PlaybackMode.IN_ARTIST -> {
|
||||||
mParent = song.album.artist
|
mParent = song.album.artist
|
||||||
mQueue = song.album.artist.songs
|
mQueue = song.album.artist.songs.toMutableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaybackMode.IN_ALBUM -> {
|
PlaybackMode.IN_ALBUM -> {
|
||||||
|
@ -425,7 +425,7 @@ class PlaybackStateManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- PERSISTENCE FUNCTIONS ---
|
// --- PERSISTENCE FUNCTIONS ---
|
||||||
// TODO: Implement a fast queue save function that can be enabled in settings
|
// TODO: Implement a fast queue save function
|
||||||
|
|
||||||
suspend fun saveStateToDatabase(context: Context) {
|
suspend fun saveStateToDatabase(context: Context) {
|
||||||
Log.d(this::class.simpleName, "Saving state to DB.")
|
Log.d(this::class.simpleName, "Saving state to DB.")
|
||||||
|
@ -557,15 +557,15 @@ class PlaybackStateManager private constructor() {
|
||||||
// Traverse albums and then album songs instead of just the songs, as its faster.
|
// Traverse albums and then album songs instead of just the songs, as its faster.
|
||||||
musicStore.albums.find { it.id == item.albumId }
|
musicStore.albums.find { it.id == item.albumId }
|
||||||
?.songs?.find { it.id == item.songId }?.let {
|
?.songs?.find { it.id == item.songId }?.let {
|
||||||
mQueue.add(it)
|
mQueue.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userQueueItems.forEach { item ->
|
userQueueItems.forEach { item ->
|
||||||
musicStore.albums.find { it.id == item.albumId }
|
musicStore.albums.find { it.id == item.albumId }
|
||||||
?.songs?.find { it.id == item.songId }?.let {
|
?.songs?.find { it.id == item.songId }?.let {
|
||||||
mUserQueue.add(it)
|
mUserQueue.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forceQueueUpdate()
|
forceQueueUpdate()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.oxycblt.auxio.music.BaseModel
|
||||||
// Base Diff callback
|
// Base Diff callback
|
||||||
class DiffCallback<T : BaseModel> : DiffUtil.ItemCallback<T>() {
|
class DiffCallback<T : BaseModel> : DiffUtil.ItemCallback<T>() {
|
||||||
override fun areContentsTheSame(oldItem: T, newItem: T): Boolean {
|
override fun areContentsTheSame(oldItem: T, newItem: T): Boolean {
|
||||||
return oldItem == newItem
|
return oldItem.hashCode() == newItem.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean {
|
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean {
|
||||||
|
|
|
@ -43,7 +43,7 @@ fun ImageButton.disable(context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.createToast(context: Context) {
|
fun String.createToast(context: Context) {
|
||||||
Toast.makeText(context, this, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context.applicationContext, this, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply a custom vertical divider
|
// Apply a custom vertical divider
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:gravity="center"
|
|
||||||
android:left="16dp"
|
|
||||||
android:right="16dp">
|
|
||||||
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="@android:color/white" />
|
|
||||||
<corners android:radius="4dp" />
|
|
||||||
<size android:height="3dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.fragment.app.FragmentContainerView android:id="@+id/main_nav_host"
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
android:id="@+id/nav_host"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
app:menu="@menu/menu_album_actions"
|
app:menu="@menu/menu_album_actions"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
||||||
app:navigationIcon="@drawable/ic_back"
|
app:navigationIcon="@drawable/ic_back"
|
||||||
app:title="@string/title_library_fragment" />
|
app:title="@string/label_library" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/nested_scroll"
|
android:id="@+id/nested_scroll"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
app:menu="@menu/menu_detail"
|
app:menu="@menu/menu_detail"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
||||||
app:navigationIcon="@drawable/ic_back"
|
app:navigationIcon="@drawable/ic_back"
|
||||||
app:title="@string/title_library_fragment" />
|
app:title="@string/label_library" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
app:menu="@menu/menu_detail"
|
app:menu="@menu/menu_detail"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
||||||
app:navigationIcon="@drawable/ic_back"
|
app:navigationIcon="@drawable/ic_back"
|
||||||
app:title="@string/title_library_fragment" />
|
app:title="@string/label_library" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:layout_marginStart="@dimen/margin_medium"
|
android:layout_marginStart="@dimen/margin_medium"
|
||||||
android:text="@{@plurals/format_song_count(genre.numSongs, genre.numSongs)}"
|
android:text="@{@plurals/format_song_count(genre.songs.size, genre.songs.size)}"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/genre_counts"
|
app:layout_constraintTop_toBottomOf="@+id/genre_counts"
|
||||||
tools:text="80 Songs" />
|
tools:text="80 Songs" />
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
app:popupTheme="@style/AppThemeOverlay.Popup"
|
app:popupTheme="@style/AppThemeOverlay.Popup"
|
||||||
app:menu="@menu/menu_library"
|
app:menu="@menu/menu_library"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
||||||
app:title="@string/title_library_fragment" />
|
app:title="@string/label_library" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/library_recycler"
|
android:id="@+id/library_recycler"
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
app:navigationIcon="@drawable/ic_down"
|
app:navigationIcon="@drawable/ic_down"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:title="@string/title_playback"
|
app:title="@string/label_playback"
|
||||||
app:menu="@menu/menu_playback"
|
app:menu="@menu/menu_playback"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header" />
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header" />
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
android:elevation="@dimen/elevation_normal"
|
android:elevation="@dimen/elevation_normal"
|
||||||
app:menu="@menu/menu_songs"
|
app:menu="@menu/menu_songs"
|
||||||
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header"
|
||||||
app:title="@string/title_all_songs" />
|
app:title="@string/label_all_songs" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/song_recycler"
|
android:id="@+id/song_recycler"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/library_fragment"
|
android:id="@+id/library_fragment"
|
||||||
android:title="@string/title_library_fragment"
|
android:title="@string/label_library"
|
||||||
android:icon="@drawable/ic_library" />
|
android:icon="@drawable/ic_library" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/songs_fragment"
|
android:id="@+id/songs_fragment"
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
<navigation 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"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/nav_explore"
|
|
||||||
app:startDestination="@id/library_fragment">
|
app:startDestination="@id/library_fragment">
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
<navigation 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"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/nav_main"
|
|
||||||
app:startDestination="@id/loading_fragment">
|
app:startDestination="@id/loading_fragment">
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/loading_fragment"
|
android:id="@+id/loading_fragment"
|
||||||
|
|
|
@ -4,21 +4,14 @@
|
||||||
<dimen name="padding_tiny">4dp</dimen>
|
<dimen name="padding_tiny">4dp</dimen>
|
||||||
<dimen name="padding_small">8dp</dimen>
|
<dimen name="padding_small">8dp</dimen>
|
||||||
<dimen name="padding_medium">16dp</dimen>
|
<dimen name="padding_medium">16dp</dimen>
|
||||||
<dimen name="padding_mid_large">24dp</dimen>
|
|
||||||
<dimen name="padding_large">32dp</dimen>
|
|
||||||
<dimen name="padding_huge">64dp</dimen>
|
|
||||||
|
|
||||||
<!-- Margin namespace | Dimens for margin attributes -->
|
<!-- Margin namespace | Dimens for margin attributes -->
|
||||||
<dimen name="margin_tiny">4dp</dimen>
|
|
||||||
<dimen name="margin_small">8dp</dimen>
|
<dimen name="margin_small">8dp</dimen>
|
||||||
<dimen name="margin_mid_small">10dp</dimen>
|
<dimen name="margin_mid_small">10dp</dimen>
|
||||||
<dimen name="margin_medium">16dp</dimen>
|
<dimen name="margin_medium">16dp</dimen>
|
||||||
<dimen name="margin_mid_large">24dp</dimen>
|
<dimen name="margin_mid_large">24dp</dimen>
|
||||||
<dimen name="margin_large">32dp</dimen>
|
|
||||||
<dimen name="margin_huge">64dp</dimen>
|
|
||||||
|
|
||||||
<!-- Height Namespace | Height for UI elements -->
|
<!-- Height Namespace | Height for UI elements -->
|
||||||
<dimen name="height_tab_menu">40dp</dimen>
|
|
||||||
<dimen name="height_compact_progress">2dp</dimen>
|
<dimen name="height_compact_progress">2dp</dimen>
|
||||||
|
|
||||||
<!-- Width Namespace | Width for UI elements -->
|
<!-- Width Namespace | Width for UI elements -->
|
||||||
|
|
|
@ -2,18 +2,11 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Auxio</string>
|
<string name="app_name">Auxio</string>
|
||||||
|
|
||||||
<!-- Title Namespace | Toolbar titles -->
|
|
||||||
<string name="title_library_fragment">Library</string>
|
|
||||||
<string name="title_all_songs">All Songs</string>
|
|
||||||
<string name="title_playback">Now Playing</string>
|
|
||||||
|
|
||||||
<!-- Error Namespace | Error Labels -->
|
|
||||||
<string name="error_no_music">No music found.</string>
|
|
||||||
<string name="error_music_load_failed">Music loading failed.</string>
|
|
||||||
<string name="error_no_perms">Permissions to read storage are needed.</string>
|
|
||||||
|
|
||||||
<!-- Label Namespace | Static Labels -->
|
<!-- Label Namespace | Static Labels -->
|
||||||
<string name="label_retry">Retry</string>
|
<string name="label_retry">Retry</string>
|
||||||
|
<string name="label_library">Library</string>
|
||||||
|
<string name="label_all_songs">All Songs</string>
|
||||||
|
<string name="label_playback">Now Playing</string>
|
||||||
<string name="label_grant">Grant</string>
|
<string name="label_grant">Grant</string>
|
||||||
<string name="label_genres">Genres</string>
|
<string name="label_genres">Genres</string>
|
||||||
<string name="label_artists">Artists</string>
|
<string name="label_artists">Artists</string>
|
||||||
|
@ -28,7 +21,6 @@
|
||||||
<string name="label_play_artist">Play from artist</string>
|
<string name="label_play_artist">Play from artist</string>
|
||||||
<string name="label_play_album">Play from album</string>
|
<string name="label_play_album">Play from album</string>
|
||||||
<string name="label_go_artist">Go to artist</string>
|
<string name="label_go_artist">Go to artist</string>
|
||||||
<string name="label_go_album">Go to album</string>
|
|
||||||
<string name="label_queue">Queue</string>
|
<string name="label_queue">Queue</string>
|
||||||
<string name="label_queue_add">Add to queue</string>
|
<string name="label_queue_add">Add to queue</string>
|
||||||
<string name="label_queue_added">Added to queue</string>
|
<string name="label_queue_added">Added to queue</string>
|
||||||
|
@ -36,6 +28,11 @@
|
||||||
<string name="label_channel">Music Playback</string>
|
<string name="label_channel">Music Playback</string>
|
||||||
<string name="label_service_playback">The music playback service for Auxio.</string>
|
<string name="label_service_playback">The music playback service for Auxio.</string>
|
||||||
|
|
||||||
|
<!-- Error Namespace | Error Labels -->
|
||||||
|
<string name="error_no_music">No music found.</string>
|
||||||
|
<string name="error_music_load_failed">Music loading failed.</string>
|
||||||
|
<string name="error_no_perms">Permissions to read storage are needed.</string>
|
||||||
|
|
||||||
<!-- Hint Namespace | EditText Hints -->
|
<!-- Hint Namespace | EditText Hints -->
|
||||||
<string name="hint_search_library">Search Library…</string>
|
<string name="hint_search_library">Search Library…</string>
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,13 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Fix to get QueueFragment to not overlap the Status Bar or Navigation Bar
|
Fix to get QueueFragment to not overlap the Status Bar or Navigation Bar [Currently unused but still here]
|
||||||
https://stackoverflow.com/a/57790787/14143986
|
https://stackoverflow.com/a/57790787/14143986
|
||||||
-->
|
|
||||||
<style name="Theme.BottomSheetFix" parent="@style/Theme.Design.BottomSheetDialog">
|
<style name="Theme.BottomSheetFix" parent="@style/Theme.Design.BottomSheetDialog">
|
||||||
<item name="android:windowIsFloating">false</item>
|
<item name="android:windowIsFloating">false</item>
|
||||||
<item name="android:navigationBarColor">@color/background</item>
|
<item name="android:navigationBarColor">@color/background</item>
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
</style>
|
</style>
|
||||||
|
-->
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue