all: cleanup

This commit is contained in:
Alexander Capehart 2024-01-21 20:01:26 -07:00
parent b53a96f574
commit 8dc0be4a52
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
20 changed files with 47 additions and 39 deletions

View file

@ -21,8 +21,8 @@ android {
defaultConfig {
applicationId namespace
versionName "3.3.3"
versionCode 40
versionName "3.4.0"
versionCode 41
minSdk 24
targetSdk 34

View file

@ -111,12 +111,12 @@ class MainActivity : AppCompatActivity() {
}
/**
* Transform an [Intent] given to [MainActivity] into a [InternalPlayer.Action] that can be used
* in the playback system.
* Transform an [Intent] given to [MainActivity] into a [DeferredPlayback] that can be used in
* the playback system.
*
* @param intent The (new) [Intent] given to this [MainActivity], or null if there is no intent.
* @return true If the analogous [InternalPlayer.Action] to the given [Intent] was started,
* false otherwise.
* @return true If the analogous [DeferredPlayback] to the given [Intent] was started, false
* otherwise.
*/
private fun startIntentAction(intent: Intent?): Boolean {
if (intent == null) {

View file

@ -244,7 +244,7 @@ class ThemedSpeedDialView : SpeedDialView {
companion object {
private val VIEW_PROPERTY_BACKGROUND_TINT =
object : Property<View, Int>(Int::class.java, "backgroundTint") {
override fun get(view: View): Int? = view.backgroundTintList!!.defaultColor
override fun get(view: View): Int = view.backgroundTintList!!.defaultColor
override fun set(view: View, value: Int?) {
view.backgroundTintList = ColorStateList.valueOf(value!!)
@ -253,7 +253,7 @@ class ThemedSpeedDialView : SpeedDialView {
private val IMAGE_VIEW_PROPERTY_IMAGE_TINT =
object : Property<ImageView, Int>(Int::class.java, "imageTint") {
override fun get(view: ImageView): Int? = view.imageTintList!!.defaultColor
override fun get(view: ImageView): Int = view.imageTintList!!.defaultColor
override fun set(view: ImageView, value: Int?) {
view.imageTintList = ColorStateList.valueOf(value!!)

View file

@ -57,8 +57,10 @@ interface MusicSettings : Settings<MusicSettings.Listener> {
class MusicSettingsImpl
@Inject
constructor(@ApplicationContext context: Context, val documentPathFactory: DocumentPathFactory) :
Settings.Impl<MusicSettings.Listener>(context), MusicSettings {
constructor(
@ApplicationContext context: Context,
private val documentPathFactory: DocumentPathFactory
) : Settings.Impl<MusicSettings.Listener>(context), MusicSettings {
private val storageManager = context.getSystemServiceCompat(StorageManager::class)
override var musicDirs: MusicDirectories

View file

@ -368,7 +368,8 @@ sealed interface PlaylistDecision {
* @param songs The [Song]s to contain in the new [Playlist].
* @param template An existing playlist name that should be editable in the opened dialog. If
* null, a placeholder should be created and shown as a hint instead.
* @param context The context in which this decision is being fulfilled.
* @param reason The reason why a new playlist is being created. For all intensive purposes, you
* do not need to specify this.
*/
data class New(val songs: List<Song>, val template: String?, val reason: Reason) :
PlaylistDecision {

View file

@ -210,7 +210,7 @@ class PlaylistPickerViewModel @Inject constructor(private val musicRepository: M
}
/**
* Set a new [currentPlaylisttoExport] from a [Playlist] [Music.UID].
* Set a new [currentPlaylistToExport] from a [Playlist] [Music.UID].
*
* @param playlistUid The [Music.UID] of the [Playlist] to export.
*/

View file

@ -29,7 +29,7 @@ import org.oxycblt.auxio.util.inflater
import org.oxycblt.auxio.util.logD
/**
* [RecyclerView.Adapter] that manages a list of [Directory] instances.
* [RecyclerView.Adapter] that manages a list of [Path] music directory instances.
*
* @param listener A [DirectoryAdapter.Listener] to bind interactions to.
* @author Alexander Capehart (OxygenCobalt)
@ -37,9 +37,7 @@ import org.oxycblt.auxio.util.logD
class DirectoryAdapter(private val listener: Listener) :
RecyclerView.Adapter<MusicDirViewHolder>() {
private val _dirs = mutableListOf<Path>()
/**
* The current list of [SystemPath]s, may not line up with [MusicDirectories] due to removals.
*/
/** The current list of [Path]s, may not line up with [MusicDirectories] due to removals. */
val dirs: List<Path> = _dirs
override fun getItemCount() = dirs.size
@ -94,7 +92,7 @@ class DirectoryAdapter(private val listener: Listener) :
}
/**
* A [RecyclerView.Recycler] that displays a [Directory]. Use [from] to create an instance.
* A [RecyclerView.Recycler] that displays a [Path]. Use [from] to create an instance.
*
* @author Alexander Capehart (OxygenCobalt)
*/

View file

@ -23,9 +23,10 @@ import org.oxycblt.auxio.music.fs.Path
/**
* Represents the configuration for specific directories to filter to/from when loading music.
*
* @param dirs A list of [Directory] instances. How these are interpreted depends on [shouldInclude]
* @param shouldInclude True if the library should only load from the [Directory] instances, false
* if the library should not load from the [Directory] instances.
* @param dirs A list of directory [Path] instances. How these are interpreted depends on
* [shouldInclude]
* @param shouldInclude True if the library should only load from the [Path] instances, false if the
* library should not load from the [Path] instances.
* @author Alexander Capehart (OxygenCobalt)
*/
data class MusicDirectories(val dirs: List<Path>, val shouldInclude: Boolean)

View file

@ -90,7 +90,7 @@ interface MediaStoreExtractor {
* Create a framework-backed instance.
*
* @param context [Context] required.
* @param volumeManager [VolumeManager] required.
* @param pathInterpreterFactory A [MediaStorePathInterpreter.Factory] to use.
* @return A new [MediaStoreExtractor] that will work best on the device's API level.
*/
fun from(

View file

@ -114,8 +114,7 @@ constructor(
get() = _playbackDecision
/**
* The current audio session ID of the internal player. Null if no [InternalPlayer] is
* available.
* The current audio session ID of the internal player. Null if no audio player is available.
*/
val currentAudioSessionId: Int?
get() = playbackManager.currentAudioSessionId
@ -416,10 +415,10 @@ constructor(
}
/**
* Start the given [InternalPlayer.Action] to be completed eventually. This can be used to
* enqueue a playback action at startup to then occur when the music library is fully loaded.
* Start the given [DeferredPlayback] to be completed eventually. This can be used to enqueue a
* playback action at startup to then occur when the music library is fully loaded.
*
* @param action The [InternalPlayer.Action] to perform eventually.
* @param action The [DeferredPlayback] to perform eventually.
*/
fun playDeferred(action: DeferredPlayback) {
logD("Starting action $action")

View file

@ -374,6 +374,11 @@ private constructor(
positionMs,
SystemClock.elapsedRealtime())
fun nil() = Progression(false, false, 0, SystemClock.elapsedRealtime())
fun nil() =
Progression(
isPlaying = false,
isAdvancing = false,
initPositionMs = 0,
creationTime = SystemClock.elapsedRealtime())
}
}

View file

@ -207,7 +207,7 @@ interface PlaybackStateManager {
fun playDeferred(action: DeferredPlayback)
/**
* Request that the pending [PlaybackStateHolder.Action] (if any) be passed to the given
* Request that the pending [DeferredPlayback] (if any) be passed to the given
* [PlaybackStateHolder].
*
* @param stateHolder The [PlaybackStateHolder] to synchronize with. Must be the current
@ -271,7 +271,7 @@ interface PlaybackStateManager {
fun onIndexMoved(index: Int) {}
/**
* Called when the queue changed in a manner outlined by the given [Queue.Change].
* Called when the queue changed in a manner outlined by the given [DeferredPlayback].
*
* @param queue The songs of the new queue.
* @param index The new index of the currently playing [Song].
@ -305,9 +305,9 @@ interface PlaybackStateManager {
) {}
/**
* Called when the state of the [InternalPlayer] changes.
* Called when the state of the audio player changes.
*
* @param progression The new state of the [InternalPlayer].
* @param progression The new state of the audio player.
*/
fun onProgressionChanged(progression: Progression) {}

View file

@ -29,7 +29,7 @@ import java.util.*
*
* @author media3 team, Alexander Capehart (OxygenCobalt)
*/
class BetterShuffleOrder constructor(private val shuffled: IntArray) : ShuffleOrder {
class BetterShuffleOrder(private val shuffled: IntArray) : ShuffleOrder {
private val indexInShuffled: IntArray = IntArray(shuffled.size)
constructor(length: Int, startIndex: Int) : this(createShuffledList(length, startIndex))
@ -62,6 +62,7 @@ class BetterShuffleOrder constructor(private val shuffled: IntArray) : ShuffleOr
return if (shuffled.isNotEmpty()) shuffled[0] else C.INDEX_UNSET
}
@Suppress("KotlinConstantConditions") // Bugged for this function
override fun cloneAndInsert(insertionIndex: Int, insertionCount: Int): ShuffleOrder {
if (shuffled.isEmpty()) {
return BetterShuffleOrder(insertionCount, -1)

View file

@ -593,7 +593,7 @@ class PlaybackService :
private fun ExoPlayer.unscrambleQueueIndices(): List<Int> {
val timeline = currentTimeline
if (timeline.isEmpty()) {
if (timeline.isEmpty) {
return emptyList()
}
val queue = mutableListOf<Int>()

View file

@ -165,12 +165,12 @@ constructor(
/**
* A condensed form of the playback state that is safe to use in AppWidgets.
*
* @param song [Queue.currentSong]
* @param song [PlaybackStateManager.currentSong]
* @param cover A pre-loaded album cover [Bitmap] for [song].
* @param cover A pre-loaded album cover [Bitmap] for [song], with rounded corners.
* @param isPlaying [PlaybackStateManager.playerState]
* @param isPlaying [PlaybackStateManager.progression]
* @param repeatMode [PlaybackStateManager.repeatMode]
* @param isShuffled [Queue.isShuffled]
* @param isShuffled [PlaybackStateManager.isShuffled]
*/
data class PlaybackState(
val song: Song,

View file

@ -164,6 +164,7 @@
android:clickable="true"
android:focusable="true"
android:gravity="bottom|end"
android:contentDescription="@string/lbl_new_playlist"
app:sdMainFabAnimationRotateAngle="135"
app:sdMainFabClosedIconColor="@android:color/white"
app:sdMainFabClosedSrc="@drawable/ic_add_24" />
@ -172,6 +173,7 @@
android:id="@+id/home_shuffle_fab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/lbl_shuffle"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/spacing_medium"
android:src="@drawable/ic_shuffle_off_24" />

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -242,6 +242,7 @@
<plurals name="fmt_artist_count">
<item quantity="one">%d atlikėjas</item>
<item quantity="few">%d atlikėjai</item>
<item quantity="many">%d atlikėjų</item>
<item quantity="other">%d atlikėjų</item>
</plurals>
<string name="set_rescan">Perskenuoti muziką</string>

View file

@ -37,7 +37,7 @@
<string name="set_accent">Esquema de cores</string>
<string name="set_audio">Áudio</string>
<string name="set_personalize">Personalizar</string>
<string name="set_keep_shuffle">Memorizar musica misturada</string>
<string name="set_keep_shuffle">Memorizar música misturada</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">Nenhuma música encontrada</string>
<!-- Description Namespace | Accessibility Strings -->