all: fix inspections

Fix miscellanious code inspections.
This commit is contained in:
Alexander Capehart 2023-05-14 09:59:08 -06:00
parent d0444bb41d
commit 956b6fda2b
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
15 changed files with 21 additions and 26 deletions

View file

@ -122,7 +122,6 @@ constructor(
return stream return stream
} }
@Suppress("BlockingMethodInNonBlockingContext")
private suspend fun extractMediaStoreCover(album: Album) = private suspend fun extractMediaStoreCover(album: Album) =
// Eliminate any chance that this blocking call might mess up the loading process // Eliminate any chance that this blocking call might mess up the loading process
withContext(Dispatchers.IO) { context.contentResolver.openInputStream(album.coverUri) } withContext(Dispatchers.IO) { context.contentResolver.openInputStream(album.coverUri) }

View file

@ -222,7 +222,7 @@ data class Sort(val mode: Mode, val direction: Direction) {
/** /**
* Sort by the item's name. * Sort by the item's name.
* *
* @see Music.sortName * @see Music.name
*/ */
object ByName : Mode { object ByName : Mode {
override val intCode: Int override val intCode: Int
@ -520,7 +520,7 @@ data class Sort(val mode: Mode, val direction: Direction) {
/** /**
* Utility function to create a [Comparator] in a dynamic way determined by [direction]. * Utility function to create a [Comparator] in a dynamic way determined by [direction].
* *
* @param direction The [Direction] to sort in. * @param direction The [Sort.Direction] to sort in.
* @see compareBy * @see compareBy
* @see compareByDescending * @see compareByDescending
*/ */
@ -536,7 +536,7 @@ private inline fun <T : Music, K : Comparable<K>> compareByDynamic(
/** /**
* Utility function to create a [Comparator] in a dynamic way determined by [direction] * Utility function to create a [Comparator] in a dynamic way determined by [direction]
* *
* @param direction The [Direction] to sort in. * @param direction The [Sort.Direction] to sort in.
* @param comparator A [Comparator] to wrap. * @param comparator A [Comparator] to wrap.
* @return A new [Comparator] with the specified configuration. * @return A new [Comparator] with the specified configuration.
* @see compareBy * @see compareBy

View file

@ -350,7 +350,7 @@ interface Playlist : MusicParent {
} }
/** /**
* Run [Music.resolveName] on each instance in the given list and concatenate them into a [String] * Run [Name.resolve] on each instance in the given list and concatenate them into a [String]
* in a localized manner. * in a localized manner.
* *
* @param context [Context] required * @param context [Context] required

View file

@ -27,7 +27,6 @@ import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel
import org.oxycblt.auxio.R
import org.oxycblt.auxio.music.cache.CacheRepository import org.oxycblt.auxio.music.cache.CacheRepository
import org.oxycblt.auxio.music.device.DeviceLibrary import org.oxycblt.auxio.music.device.DeviceLibrary
import org.oxycblt.auxio.music.device.RawSong import org.oxycblt.auxio.music.device.RawSong

View file

@ -18,7 +18,6 @@
package org.oxycblt.auxio.music.device package org.oxycblt.auxio.music.device
import java.util.*
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.list.Sort import org.oxycblt.auxio.list.Sort
import org.oxycblt.auxio.music.* import org.oxycblt.auxio.music.*

View file

@ -52,15 +52,15 @@ class RawSong(
var extensionMimeType: String? = null, var extensionMimeType: String? = null,
/** @see Music.UID */ /** @see Music.UID */
var musicBrainzId: String? = null, var musicBrainzId: String? = null,
/** @see Music.rawName */ /** @see Music.name */
var name: String? = null, var name: String? = null,
/** @see Music.rawSortName */ /** @see Music.name */
var sortName: String? = null, var sortName: String? = null,
/** @see Song.track */ /** @see Song.track */
var track: Int? = null, var track: Int? = null,
/** @see Disc.number */ /** @see Song.disc */
var disc: Int? = null, var disc: Int? = null,
/** @See Disc.name */ /** @See Song.disc */
var subtitle: String? = null, var subtitle: String? = null,
/** @see Song.date */ /** @see Song.date */
var date: Date? = null, var date: Date? = null,
@ -103,9 +103,9 @@ class RawAlbum(
val mediaStoreId: Long, val mediaStoreId: Long,
/** @see Music.uid */ /** @see Music.uid */
val musicBrainzId: UUID?, val musicBrainzId: UUID?,
/** @see Music.rawName */ /** @see Music.name */
val name: String, val name: String,
/** @see Music.rawSortName */ /** @see Music.name */
val sortName: String?, val sortName: String?,
/** @see Album.releaseType */ /** @see Album.releaseType */
val releaseType: ReleaseType?, val releaseType: ReleaseType?,
@ -145,9 +145,9 @@ class RawAlbum(
class RawArtist( class RawArtist(
/** @see Music.UID */ /** @see Music.UID */
val musicBrainzId: UUID? = null, val musicBrainzId: UUID? = null,
/** @see Music.rawName */ /** @see Music.name */
val name: String? = null, val name: String? = null,
/** @see Music.rawSortName */ /** @see Music.name */
val sortName: String? = null val sortName: String? = null
) { ) {
// Artists are grouped as follows: // Artists are grouped as follows:
@ -185,7 +185,7 @@ class RawArtist(
* @author Alexander Capehart (OxygenCobalt) * @author Alexander Capehart (OxygenCobalt)
*/ */
class RawGenre( class RawGenre(
/** @see Music.rawName */ /** @see Music.name */
val name: String? = null val name: String? = null
) { ) {

View file

@ -228,7 +228,7 @@ private fun String.parseId3v2Genre(): List<String>? {
// Case 1: Genre IDs in the format (INT|RX|CR). If these exist, parse them as // Case 1: Genre IDs in the format (INT|RX|CR). If these exist, parse them as
// ID3v1 tags. // ID3v1 tags.
val genreIds = groups.getOrNull(1) val genreIds = groups.getOrNull(1)
if (genreIds != null && genreIds.isNotEmpty()) { if (!genreIds.isNullOrEmpty()) {
val ids = genreIds.substring(1, genreIds.lastIndex).split(")(") val ids = genreIds.substring(1, genreIds.lastIndex).split(")(")
for (id in ids) { for (id in ids) {
id.parseId3v1Genre()?.let(genres::add) id.parseId3v1Genre()?.let(genres::add)
@ -238,7 +238,7 @@ private fun String.parseId3v2Genre(): List<String>? {
// Case 2: Genre names as a normal string. The only case we have to look out for are // Case 2: Genre names as a normal string. The only case we have to look out for are
// escaped strings formatted as ((genre). // escaped strings formatted as ((genre).
val genreName = groups.getOrNull(3) val genreName = groups.getOrNull(3)
if (genreName != null && genreName.isNotEmpty()) { if (!genreName.isNullOrEmpty()) {
if (genreName.startsWith("((")) { if (genreName.startsWith("((")) {
genres.add(genreName.substring(1)) genres.add(genreName.substring(1))
} else { } else {

View file

@ -45,7 +45,7 @@ import org.oxycblt.auxio.util.logD
* *
* Loading music is a time-consuming process that would likely be killed by the system before it * Loading music is a time-consuming process that would likely be killed by the system before it
* could complete if ran anywhere else. So, this [Service] manages the music loading process as an * could complete if ran anywhere else. So, this [Service] manages the music loading process as an
* instance of [Indexer.Controller]. * instance of [MusicRepository.IndexingWorker].
* *
* This [Service] also handles automatic rescanning, as that is a similarly long-running background * This [Service] also handles automatic rescanning, as that is a similarly long-running background
* operation that would be unsuitable elsewhere in the app. * operation that would be unsuitable elsewhere in the app.

View file

@ -18,7 +18,6 @@
package org.oxycblt.auxio.music.user package org.oxycblt.auxio.music.user
import java.util.*
import org.oxycblt.auxio.music.* import org.oxycblt.auxio.music.*
import org.oxycblt.auxio.music.device.DeviceLibrary import org.oxycblt.auxio.music.device.DeviceLibrary
import org.oxycblt.auxio.music.info.Name import org.oxycblt.auxio.music.info.Name

View file

@ -109,7 +109,7 @@ abstract class BasePreferenceFragment(@XmlRes private val screen: Int) :
// Copy the built-in preference dialog launching code into our project so // Copy the built-in preference dialog launching code into our project so
// we can automatically use the provided preference class. // we can automatically use the provided preference class.
val dialog = IntListPreferenceDialog.from(preference) val dialog = IntListPreferenceDialog.from(preference)
@Suppress("Deprecation") dialog.setTargetFragment(this, 0) dialog.setTargetFragment(this, 0)
dialog.show(parentFragmentManager, IntListPreferenceDialog.TAG) dialog.show(parentFragmentManager, IntListPreferenceDialog.TAG)
} }
is WrappedDialogPreference -> { is WrappedDialogPreference -> {

View file

@ -7,7 +7,6 @@
android:paddingEnd="@dimen/spacing_mid_large" android:paddingEnd="@dimen/spacing_mid_large"
android:paddingStart="@dimen/spacing_mid_large" android:paddingStart="@dimen/spacing_mid_large"
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"
app:hintEnabled="false"> app:hintEnabled="false">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<org.oxycblt.auxio.list.recycler.DialogRecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <org.oxycblt.auxio.list.recycler.DialogRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
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/detail_properties" android:id="@+id/detail_properties"
style="@style/Widget.Auxio.RecyclerView.Linear" style="@style/Widget.Auxio.RecyclerView.Linear"

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout 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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
@ -27,6 +28,7 @@
android:id="@android:id/list_container" android:id="@android:id/list_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
tools:targetApi="n" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"

View file

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources></resources> <resources />