all: cleanup
This commit is contained in:
parent
b53a96f574
commit
8dc0be4a52
20 changed files with 47 additions and 39 deletions
|
@ -21,8 +21,8 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId namespace
|
applicationId namespace
|
||||||
versionName "3.3.3"
|
versionName "3.4.0"
|
||||||
versionCode 40
|
versionCode 41
|
||||||
|
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
|
|
|
@ -111,12 +111,12 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an [Intent] given to [MainActivity] into a [InternalPlayer.Action] that can be used
|
* Transform an [Intent] given to [MainActivity] into a [DeferredPlayback] that can be used in
|
||||||
* in the playback system.
|
* the playback system.
|
||||||
*
|
*
|
||||||
* @param intent The (new) [Intent] given to this [MainActivity], or null if there is no intent.
|
* @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,
|
* @return true If the analogous [DeferredPlayback] to the given [Intent] was started, false
|
||||||
* false otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
private fun startIntentAction(intent: Intent?): Boolean {
|
private fun startIntentAction(intent: Intent?): Boolean {
|
||||||
if (intent == null) {
|
if (intent == null) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ class ThemedSpeedDialView : SpeedDialView {
|
||||||
companion object {
|
companion object {
|
||||||
private val VIEW_PROPERTY_BACKGROUND_TINT =
|
private val VIEW_PROPERTY_BACKGROUND_TINT =
|
||||||
object : Property<View, Int>(Int::class.java, "backgroundTint") {
|
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?) {
|
override fun set(view: View, value: Int?) {
|
||||||
view.backgroundTintList = ColorStateList.valueOf(value!!)
|
view.backgroundTintList = ColorStateList.valueOf(value!!)
|
||||||
|
@ -253,7 +253,7 @@ class ThemedSpeedDialView : SpeedDialView {
|
||||||
|
|
||||||
private val IMAGE_VIEW_PROPERTY_IMAGE_TINT =
|
private val IMAGE_VIEW_PROPERTY_IMAGE_TINT =
|
||||||
object : Property<ImageView, Int>(Int::class.java, "imageTint") {
|
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?) {
|
override fun set(view: ImageView, value: Int?) {
|
||||||
view.imageTintList = ColorStateList.valueOf(value!!)
|
view.imageTintList = ColorStateList.valueOf(value!!)
|
||||||
|
|
|
@ -57,8 +57,10 @@ interface MusicSettings : Settings<MusicSettings.Listener> {
|
||||||
|
|
||||||
class MusicSettingsImpl
|
class MusicSettingsImpl
|
||||||
@Inject
|
@Inject
|
||||||
constructor(@ApplicationContext context: Context, val documentPathFactory: DocumentPathFactory) :
|
constructor(
|
||||||
Settings.Impl<MusicSettings.Listener>(context), MusicSettings {
|
@ApplicationContext context: Context,
|
||||||
|
private val documentPathFactory: DocumentPathFactory
|
||||||
|
) : Settings.Impl<MusicSettings.Listener>(context), MusicSettings {
|
||||||
private val storageManager = context.getSystemServiceCompat(StorageManager::class)
|
private val storageManager = context.getSystemServiceCompat(StorageManager::class)
|
||||||
|
|
||||||
override var musicDirs: MusicDirectories
|
override var musicDirs: MusicDirectories
|
||||||
|
|
|
@ -368,7 +368,8 @@ sealed interface PlaylistDecision {
|
||||||
* @param songs The [Song]s to contain in the new [Playlist].
|
* @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
|
* @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.
|
* 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) :
|
data class New(val songs: List<Song>, val template: String?, val reason: Reason) :
|
||||||
PlaylistDecision {
|
PlaylistDecision {
|
||||||
|
|
|
@ -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.
|
* @param playlistUid The [Music.UID] of the [Playlist] to export.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.oxycblt.auxio.util.inflater
|
||||||
import org.oxycblt.auxio.util.logD
|
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.
|
* @param listener A [DirectoryAdapter.Listener] to bind interactions to.
|
||||||
* @author Alexander Capehart (OxygenCobalt)
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
|
@ -37,9 +37,7 @@ import org.oxycblt.auxio.util.logD
|
||||||
class DirectoryAdapter(private val listener: Listener) :
|
class DirectoryAdapter(private val listener: Listener) :
|
||||||
RecyclerView.Adapter<MusicDirViewHolder>() {
|
RecyclerView.Adapter<MusicDirViewHolder>() {
|
||||||
private val _dirs = mutableListOf<Path>()
|
private val _dirs = mutableListOf<Path>()
|
||||||
/**
|
/** The current list of [Path]s, may not line up with [MusicDirectories] due to removals. */
|
||||||
* The current list of [SystemPath]s, may not line up with [MusicDirectories] due to removals.
|
|
||||||
*/
|
|
||||||
val dirs: List<Path> = _dirs
|
val dirs: List<Path> = _dirs
|
||||||
|
|
||||||
override fun getItemCount() = dirs.size
|
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)
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,9 +23,10 @@ import org.oxycblt.auxio.music.fs.Path
|
||||||
/**
|
/**
|
||||||
* Represents the configuration for specific directories to filter to/from when loading music.
|
* 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 dirs A list of directory [Path] instances. How these are interpreted depends on
|
||||||
* @param shouldInclude True if the library should only load from the [Directory] instances, false
|
* [shouldInclude]
|
||||||
* if the library should not load from the [Directory] instances.
|
* @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)
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
*/
|
*/
|
||||||
data class MusicDirectories(val dirs: List<Path>, val shouldInclude: Boolean)
|
data class MusicDirectories(val dirs: List<Path>, val shouldInclude: Boolean)
|
||||||
|
|
|
@ -90,7 +90,7 @@ interface MediaStoreExtractor {
|
||||||
* Create a framework-backed instance.
|
* Create a framework-backed instance.
|
||||||
*
|
*
|
||||||
* @param context [Context] required.
|
* @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.
|
* @return A new [MediaStoreExtractor] that will work best on the device's API level.
|
||||||
*/
|
*/
|
||||||
fun from(
|
fun from(
|
||||||
|
|
|
@ -114,8 +114,7 @@ constructor(
|
||||||
get() = _playbackDecision
|
get() = _playbackDecision
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current audio session ID of the internal player. Null if no [InternalPlayer] is
|
* The current audio session ID of the internal player. Null if no audio player is available.
|
||||||
* available.
|
|
||||||
*/
|
*/
|
||||||
val currentAudioSessionId: Int?
|
val currentAudioSessionId: Int?
|
||||||
get() = playbackManager.currentAudioSessionId
|
get() = playbackManager.currentAudioSessionId
|
||||||
|
@ -416,10 +415,10 @@ constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the given [InternalPlayer.Action] to be completed eventually. This can be used to
|
* Start the given [DeferredPlayback] to be completed eventually. This can be used to enqueue a
|
||||||
* enqueue a playback action at startup to then occur when the music library is fully loaded.
|
* 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) {
|
fun playDeferred(action: DeferredPlayback) {
|
||||||
logD("Starting action $action")
|
logD("Starting action $action")
|
||||||
|
|
|
@ -374,6 +374,11 @@ private constructor(
|
||||||
positionMs,
|
positionMs,
|
||||||
SystemClock.elapsedRealtime())
|
SystemClock.elapsedRealtime())
|
||||||
|
|
||||||
fun nil() = Progression(false, false, 0, SystemClock.elapsedRealtime())
|
fun nil() =
|
||||||
|
Progression(
|
||||||
|
isPlaying = false,
|
||||||
|
isAdvancing = false,
|
||||||
|
initPositionMs = 0,
|
||||||
|
creationTime = SystemClock.elapsedRealtime())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ interface PlaybackStateManager {
|
||||||
fun playDeferred(action: DeferredPlayback)
|
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].
|
* [PlaybackStateHolder].
|
||||||
*
|
*
|
||||||
* @param stateHolder The [PlaybackStateHolder] to synchronize with. Must be the current
|
* @param stateHolder The [PlaybackStateHolder] to synchronize with. Must be the current
|
||||||
|
@ -271,7 +271,7 @@ interface PlaybackStateManager {
|
||||||
fun onIndexMoved(index: Int) {}
|
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 queue The songs of the new queue.
|
||||||
* @param index The new index of the currently playing [Song].
|
* @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) {}
|
fun onProgressionChanged(progression: Progression) {}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.util.*
|
||||||
*
|
*
|
||||||
* @author media3 team, Alexander Capehart (OxygenCobalt)
|
* @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)
|
private val indexInShuffled: IntArray = IntArray(shuffled.size)
|
||||||
|
|
||||||
constructor(length: Int, startIndex: Int) : this(createShuffledList(length, startIndex))
|
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
|
return if (shuffled.isNotEmpty()) shuffled[0] else C.INDEX_UNSET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("KotlinConstantConditions") // Bugged for this function
|
||||||
override fun cloneAndInsert(insertionIndex: Int, insertionCount: Int): ShuffleOrder {
|
override fun cloneAndInsert(insertionIndex: Int, insertionCount: Int): ShuffleOrder {
|
||||||
if (shuffled.isEmpty()) {
|
if (shuffled.isEmpty()) {
|
||||||
return BetterShuffleOrder(insertionCount, -1)
|
return BetterShuffleOrder(insertionCount, -1)
|
||||||
|
|
|
@ -593,7 +593,7 @@ class PlaybackService :
|
||||||
|
|
||||||
private fun ExoPlayer.unscrambleQueueIndices(): List<Int> {
|
private fun ExoPlayer.unscrambleQueueIndices(): List<Int> {
|
||||||
val timeline = currentTimeline
|
val timeline = currentTimeline
|
||||||
if (timeline.isEmpty()) {
|
if (timeline.isEmpty) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
val queue = mutableListOf<Int>()
|
val queue = mutableListOf<Int>()
|
||||||
|
|
|
@ -165,12 +165,12 @@ constructor(
|
||||||
/**
|
/**
|
||||||
* A condensed form of the playback state that is safe to use in AppWidgets.
|
* 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].
|
||||||
* @param cover A pre-loaded album cover [Bitmap] for [song], with rounded corners.
|
* @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 repeatMode [PlaybackStateManager.repeatMode]
|
||||||
* @param isShuffled [Queue.isShuffled]
|
* @param isShuffled [PlaybackStateManager.isShuffled]
|
||||||
*/
|
*/
|
||||||
data class PlaybackState(
|
data class PlaybackState(
|
||||||
val song: Song,
|
val song: Song,
|
||||||
|
|
|
@ -164,6 +164,7 @@
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="bottom|end"
|
android:gravity="bottom|end"
|
||||||
|
android:contentDescription="@string/lbl_new_playlist"
|
||||||
app:sdMainFabAnimationRotateAngle="135"
|
app:sdMainFabAnimationRotateAngle="135"
|
||||||
app:sdMainFabClosedIconColor="@android:color/white"
|
app:sdMainFabClosedIconColor="@android:color/white"
|
||||||
app:sdMainFabClosedSrc="@drawable/ic_add_24" />
|
app:sdMainFabClosedSrc="@drawable/ic_add_24" />
|
||||||
|
@ -172,6 +173,7 @@
|
||||||
android:id="@+id/home_shuffle_fab"
|
android:id="@+id/home_shuffle_fab"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/lbl_shuffle"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_margin="@dimen/spacing_medium"
|
android:layout_margin="@dimen/spacing_medium"
|
||||||
android:src="@drawable/ic_shuffle_off_24" />
|
android:src="@drawable/ic_shuffle_off_24" />
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@android:id/background"
|
android:id="@android:id/background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@android:id/background"
|
android:id="@android:id/background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -242,6 +242,7 @@
|
||||||
<plurals name="fmt_artist_count">
|
<plurals name="fmt_artist_count">
|
||||||
<item quantity="one">%d atlikėjas</item>
|
<item quantity="one">%d atlikėjas</item>
|
||||||
<item quantity="few">%d atlikėjai</item>
|
<item quantity="few">%d atlikėjai</item>
|
||||||
|
<item quantity="many">%d atlikėjų</item>
|
||||||
<item quantity="other">%d atlikėjų</item>
|
<item quantity="other">%d atlikėjų</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="set_rescan">Perskenuoti muziką</string>
|
<string name="set_rescan">Perskenuoti muziką</string>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<string name="set_accent">Esquema de cores</string>
|
<string name="set_accent">Esquema de cores</string>
|
||||||
<string name="set_audio">Áudio</string>
|
<string name="set_audio">Áudio</string>
|
||||||
<string name="set_personalize">Personalizar</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 -->
|
<!-- Error Namespace | Error Labels -->
|
||||||
<string name="err_no_music">Nenhuma música encontrada</string>
|
<string name="err_no_music">Nenhuma música encontrada</string>
|
||||||
<!-- Description Namespace | Accessibility Strings -->
|
<!-- Description Namespace | Accessibility Strings -->
|
||||||
|
|
Loading…
Reference in a new issue