Add contribution templates

Add contribution templates for this project.
This commit is contained in:
OxygenCobalt
2020-12-19 12:23:10 -07:00
parent 953e1291b6
commit f85bd85c92
15 changed files with 103 additions and 40 deletions
@@ -121,7 +121,7 @@ class PlaybackStateDatabase(context: Context) :
/**
* Read the stored [PlaybackState] from the database, if there is one.
* @return The stored [PlaybackState], null if there isn't one,.
* @return The stored [PlaybackState], null if there isn't one.
*/
fun readState(): PlaybackState? {
val database = writableDatabase
@@ -27,13 +27,9 @@ class LibraryViewModel : ViewModel(), SettingsManager.Callback {
private var mDisplayMode = DisplayMode.SHOW_ARTISTS
private var mIsNavigating = false
/** The current [SortMode] */
val sortMode: LiveData<SortMode> get() = mSortMode
/** The current library data */
val libraryData: LiveData<List<BaseModel>> get() = mLibraryData
/** The results from the last search query */
val searchResults: LiveData<List<BaseModel>> get() = mSearchResults
/** If LibraryFragment is already navigating */
val isNavigating: Boolean get() = mIsNavigating
private val settingsManager = SettingsManager.getInstance()
@@ -110,9 +106,6 @@ class LibraryViewModel : ViewModel(), SettingsManager.Callback {
}
}
/**
* Reset the search query.
*/
fun resetQuery() {
mSearchResults.value = listOf()
}
@@ -120,7 +113,7 @@ class LibraryViewModel : ViewModel(), SettingsManager.Callback {
// --- LIBRARY FUNCTIONS ---
/**
* Update the current [SortMode].
* Update the current [SortMode] with a menu id.
* @param itemId The id of the menu item selected.
*/
fun updateSortMode(@IdRes itemId: Int) {
@@ -28,7 +28,7 @@ class MusicStore private constructor() {
private var mSongs = listOf<Song>()
val songs: List<Song> get() = mSongs
/** All parent models loaded by Auxio */
/** All parent models (ex Albums, Artists) loaded by Auxio */
val parents: MutableList<BaseModel> by lazy {
val parents = mutableListOf<BaseModel>()
parents.addAll(mGenres)
@@ -100,7 +100,7 @@ fun ImageView.bindArtistImage(artist: Artist) {
}
/**
* Bind the genre image for an artist.
* Bind the genre image for a genre.
*/
@BindingAdapter("genreImage")
fun ImageView.bindGenreImage(genre: Genre) {
@@ -53,23 +53,20 @@ class PlaybackViewModel : ViewModel(), PlaybackStateManager.Callback {
val parent: LiveData<BaseModel?> get() = mParent
/** The current playback position, in seconds */
val position: LiveData<Long> get() = mPosition
/** The current queue determined my [mode] and [parent] */
/** The current queue determined by [mode] and [parent] */
val queue: LiveData<MutableList<Song>> get() = mQueue
/** The queue created by the user. */
val userQueue: LiveData<MutableList<Song>> get() = mUserQueue
/** The current [PlaybackMode] that also determines the queue */
val mode: LiveData<PlaybackMode> get() = mMode
/** Whether the playback is paused or played. */
val isPlaying: LiveData<Boolean> get() = mIsPlaying
/** Whether the queue is shuffled or not. */
val isShuffling: LiveData<Boolean> get() = mIsShuffling
/** The current [LoopMode] */
/** The current repeat mode */
val loopMode: LiveData<LoopMode> get() = mLoopMode
/** Whether the user is seeking or not */
val isSeeking: LiveData<Boolean> get() = mIsSeeking
/** Whether to nav to an item or not */
val navToItem: LiveData<BaseModel?> get() = mNavToItem
/** Whether the play/pause button on CompactPlaybackFragment can animate */
val canAnimate: Boolean get() = mCanAnimate
/** The position as a duration string. */
@@ -156,7 +156,7 @@ class QueueAdapter(
}
/**
* Generic ViewHolder for the **user queue header**. Has the clear queue button.
* ViewHolder for the **user queue header**. Has the clear queue button.
*/
inner class UserQueueHeaderViewHolder(
context: Context,
@@ -1,5 +1,8 @@
package org.oxycblt.auxio.playback.state
/**
* Enum that determines the playback repeat mode.
*/
enum class LoopMode {
NONE, ONCE, INFINITE;
@@ -851,7 +851,6 @@ class PlaybackStateManager private constructor() {
/**
* Create an ordered queue based on an [Artist].
* @return A list of the songs in the [Artist], ordered.
*/
private fun orderSongsInArtist(artist: Artist): MutableList<Song> {
val final = mutableListOf<Song>()
@@ -865,7 +864,6 @@ class PlaybackStateManager private constructor() {
/**
* Create an ordered queue based on a [Genre].
* @return A list of the songs in the [Genre], ordered.
*/
private fun orderSongsInGenre(genre: Genre): MutableList<Song> {
val final = mutableListOf<Song>()
@@ -887,29 +885,17 @@ class PlaybackStateManager private constructor() {
* remove them on destruction with [removeCallback].
*/
interface Callback {
/** Called when the song updates */
fun onSongUpdate(song: Song?) {}
/** Called when the parent updates */
fun onParentUpdate(parent: BaseModel?) {}
/** Called when the position updates */
fun onPositionUpdate(position: Long) {}
/** Called when the queue updates */
fun onQueueUpdate(queue: MutableList<Song>) {}
/** Called when the user queue updates */
fun onUserQueueUpdate(userQueue: MutableList<Song>) {}
/** Called when the mode updates */
fun onModeUpdate(mode: PlaybackMode) {}
/** Called when the index updates */
fun onIndexUpdate(index: Int) {}
/** Called when the playing status changes */
fun onPlayingUpdate(isPlaying: Boolean) {}
/** Called when the shuffle status changes */
fun onShuffleUpdate(isShuffling: Boolean) {}
/** Called when the loop mode changes */
fun onLoopUpdate(mode: LoopMode) {}
/** Called when a seek is confirmed */
fun onSeekConfirm(position: Long) {}
/** Called when the restore process is finished */
fun onRestoreFinish() {}
}
@@ -96,7 +96,7 @@ class SongsFragment : Fragment() {
}
/**
* Go through the fast scroller process.
* Go through the fast scroller setup process.
* @param binding Binding required
*/
private fun setupFastScroller(binding: FragmentSongsBinding) {