Merge branch 'master' of github.com:OxygenCobalt/Auxio into dev

This commit is contained in:
Alexander Capehart
2025-06-23 12:54:55 -06:00
8 changed files with 35 additions and 5 deletions
@@ -42,6 +42,7 @@ import org.oxycblt.musikr.Song
import org.oxycblt.musikr.Storage
import org.oxycblt.musikr.cache.MutableCache
import org.oxycblt.musikr.fs.mediastore.MediaStoreFS
import org.oxycblt.musikr.fs.saf.SAF
import org.oxycblt.musikr.playlist.db.StoredPlaylists
import org.oxycblt.musikr.tag.interpret.Naming
import org.oxycblt.musikr.tag.interpret.Separators
@@ -394,8 +395,7 @@ constructor(
val newRevision = currentRevision?.takeIf { withCache } ?: UUID.randomUUID()
val cache = if (withCache) cache else WriteOnlyMutableCache(cache)
val covers = settingCovers.mutate(context, newRevision)
// val fs = SAF.from(context, SAF.Query(locations, excludedLocations, withHidden))
val fs = MediaStoreFS.from(context)
val fs = SAF.from(context, SAF.Query(locations, excludedLocations, withHidden))
val storage = Storage(cache, covers, storedPlaylists)
val interpretation = Interpretation(nameFactory, separators)
val config = Config(fs, storage, interpretation)
@@ -51,6 +51,8 @@ interface MusicSettings : Settings<MusicSettings.Listener> {
var separators: String
/** Whether to enable more advanced sorting by articles and numbers. */
val intelligentSorting: Boolean
/** Whether to use the file-system cache for improved loading times. */
val useFileTreeCache: Boolean
interface Listener {
/** Called when the current music locations changed. */
@@ -133,6 +135,9 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext private val cont
override val intelligentSorting: Boolean
get() = sharedPreferences.getBoolean(getString(R.string.set_key_auto_sort_names), true)
override val useFileTreeCache: Boolean
get() = sharedPreferences.getBoolean(getString(R.string.set_key_fs_cache), false)
override fun onSettingChanged(key: String, listener: MusicSettings.Listener) {
// TODO: Differentiate "hard reloads" (Need the cache) and "Soft reloads"
// (just need to manipulate data)
@@ -145,7 +150,8 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext private val cont
getString(R.string.set_key_separators),
getString(R.string.set_key_auto_sort_names),
getString(R.string.set_key_with_hidden),
getString(R.string.set_key_exclude_non_music) -> {
getString(R.string.set_key_exclude_non_music),
getString(R.string.set_key_fs_cache) -> {
L.d("Dispatching indexing setting change for $key")
listener.onIndexingSettingChanged()
}