all: cleanup

This commit is contained in:
Alexander Capehart
2024-12-26 14:04:15 -05:00
parent 61fd11fe04
commit 75612dd1eb
10 changed files with 91 additions and 108 deletions
@@ -1,52 +0,0 @@
/*
* Copyright (c) 2023 Auxio Project
* Indexing.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.auxio.music
import android.os.Build
import org.oxycblt.musikr.IndexingProgress
/** Version-aware permission identifier for reading audio files. */
val PERMISSION_READ_AUDIO =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
android.Manifest.permission.READ_MEDIA_AUDIO
} else {
android.Manifest.permission.READ_EXTERNAL_STORAGE
}
/**
* Represents the current state of the music loader.
*
* @author Alexander Capehart (OxygenCobalt)
*/
sealed interface IndexingState {
/**
* Music loading is on-going.
*
* @param progress The current progress of the music loading.
*/
data class Indexing(val progress: IndexingProgress) : IndexingState
/**
* Music loading has completed.
*
* @param error If music loading has failed, the error that occurred will be here. Otherwise, it
* will be null.
*/
data class Completed(val error: Exception?) : IndexingState
}
@@ -26,7 +26,6 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import org.oxycblt.musikr.cache.Cache
import org.oxycblt.musikr.cache.StoredCache
import org.oxycblt.musikr.playlist.db.StoredPlaylists
@@ -41,7 +40,9 @@ interface MusicModule {
@Module
@InstallIn(SingletonComponent::class)
class MusikrShimModule {
@Singleton @Provides fun storedCache(@ApplicationContext context: Context) = StoredCache.from(context)
@Singleton
@Provides
fun storedCache(@ApplicationContext context: Context) = StoredCache.from(context)
@Singleton
@Provides
@@ -209,6 +209,28 @@ interface MusicRepository {
}
}
/**
* Represents the current state of the music loader.
*
* @author Alexander Capehart (OxygenCobalt)
*/
sealed interface IndexingState {
/**
* Music loading is on-going.
*
* @param progress The current progress of the music loading.
*/
data class Indexing(val progress: IndexingProgress) : IndexingState
/**
* Music loading has completed.
*
* @param error If music loading has failed, the error that occurred will be here. Otherwise, it
* will be null.
*/
data class Completed(val error: Exception?) : IndexingState
}
class MusicRepositoryImpl
@Inject
constructor(
@@ -75,7 +75,7 @@ class RevisionedCover(private val revision: UUID, val inner: Cover) : Cover by i
get() = "${inner.id}@${revision}"
}
internal fun String.toUuidOrNull(): UUID? =
private fun String.toUuidOrNull(): UUID? =
try {
UUID.fromString(this)
} catch (e: IllegalArgumentException) {
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.auxio.music.metadata
package org.oxycblt.auxio.music.interpret
import android.os.Bundle
import android.view.LayoutInflater
+1 -1
View File
@@ -96,7 +96,7 @@
tools:layout="@layout/dialog_music_locations" />
<dialog
android:id="@+id/separators_dialog"
android:name="org.oxycblt.auxio.music.metadata.SeparatorsDialog"
android:name="org.oxycblt.auxio.music.interpret.SeparatorsDialog"
android:label="separators_dialog"
tools:layout="@layout/dialog_separators" />