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
15 changed files with 21 additions and 26 deletions
@@ -122,7 +122,6 @@ constructor(
return stream
}
@Suppress("BlockingMethodInNonBlockingContext")
private suspend fun extractMediaStoreCover(album: Album) =
// Eliminate any chance that this blocking call might mess up the loading process
withContext(Dispatchers.IO) { context.contentResolver.openInputStream(album.coverUri) }
@@ -222,7 +222,7 @@ data class Sort(val mode: Mode, val direction: Direction) {
/**
* Sort by the item's name.
*
* @see Music.sortName
* @see Music.name
*/
object ByName : Mode {
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].
*
* @param direction The [Direction] to sort in.
* @param direction The [Sort.Direction] to sort in.
* @see compareBy
* @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]
*
* @param direction The [Direction] to sort in.
* @param direction The [Sort.Direction] to sort in.
* @param comparator A [Comparator] to wrap.
* @return A new [Comparator] with the specified configuration.
* @see compareBy
@@ -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.
*
* @param context [Context] required
@@ -27,7 +27,6 @@ import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import org.oxycblt.auxio.R
import org.oxycblt.auxio.music.cache.CacheRepository
import org.oxycblt.auxio.music.device.DeviceLibrary
import org.oxycblt.auxio.music.device.RawSong
@@ -18,7 +18,6 @@
package org.oxycblt.auxio.music.device
import java.util.*
import org.oxycblt.auxio.R
import org.oxycblt.auxio.list.Sort
import org.oxycblt.auxio.music.*
@@ -52,15 +52,15 @@ class RawSong(
var extensionMimeType: String? = null,
/** @see Music.UID */
var musicBrainzId: String? = null,
/** @see Music.rawName */
/** @see Music.name */
var name: String? = null,
/** @see Music.rawSortName */
/** @see Music.name */
var sortName: String? = null,
/** @see Song.track */
var track: Int? = null,
/** @see Disc.number */
/** @see Song.disc */
var disc: Int? = null,
/** @See Disc.name */
/** @See Song.disc */
var subtitle: String? = null,
/** @see Song.date */
var date: Date? = null,
@@ -103,9 +103,9 @@ class RawAlbum(
val mediaStoreId: Long,
/** @see Music.uid */
val musicBrainzId: UUID?,
/** @see Music.rawName */
/** @see Music.name */
val name: String,
/** @see Music.rawSortName */
/** @see Music.name */
val sortName: String?,
/** @see Album.releaseType */
val releaseType: ReleaseType?,
@@ -145,9 +145,9 @@ class RawAlbum(
class RawArtist(
/** @see Music.UID */
val musicBrainzId: UUID? = null,
/** @see Music.rawName */
/** @see Music.name */
val name: String? = null,
/** @see Music.rawSortName */
/** @see Music.name */
val sortName: String? = null
) {
// Artists are grouped as follows:
@@ -185,7 +185,7 @@ class RawArtist(
* @author Alexander Capehart (OxygenCobalt)
*/
class RawGenre(
/** @see Music.rawName */
/** @see Music.name */
val name: String? = null
) {
@@ -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
// ID3v1 tags.
val genreIds = groups.getOrNull(1)
if (genreIds != null && genreIds.isNotEmpty()) {
if (!genreIds.isNullOrEmpty()) {
val ids = genreIds.substring(1, genreIds.lastIndex).split(")(")
for (id in ids) {
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
// escaped strings formatted as ((genre).
val genreName = groups.getOrNull(3)
if (genreName != null && genreName.isNotEmpty()) {
if (!genreName.isNullOrEmpty()) {
if (genreName.startsWith("((")) {
genres.add(genreName.substring(1))
} else {
@@ -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
* 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
* operation that would be unsuitable elsewhere in the app.
@@ -18,7 +18,6 @@
package org.oxycblt.auxio.music.user
import java.util.*
import org.oxycblt.auxio.music.*
import org.oxycblt.auxio.music.device.DeviceLibrary
import org.oxycblt.auxio.music.info.Name
@@ -109,7 +109,7 @@ abstract class BasePreferenceFragment(@XmlRes private val screen: Int) :
// Copy the built-in preference dialog launching code into our project so
// we can automatically use the provided preference class.
val dialog = IntListPreferenceDialog.from(preference)
@Suppress("Deprecation") dialog.setTargetFragment(this, 0)
dialog.setTargetFragment(this, 0)
dialog.show(parentFragmentManager, IntListPreferenceDialog.TAG)
}
is WrappedDialogPreference -> {