diff --git a/CHANGELOG.md b/CHANGELOG.md index 439efa33e..f05f3f5fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 4.0.6 + +#### What's Improved +- Added option to enable/disable the file tree cache (disabled by default) +to prevent the library from not being updated on Samsung devices + +#### What's Fixed +- Fixed loading failing/crashing the app on some devices +- Fixed file tree cache being stored in cache storage rather than app storage + ## 4.0.5 #### What's Improved diff --git a/app/build.gradle b/app/build.gradle index 713ae9f14..e12d5daf3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { defaultConfig { applicationId namespace - versionName "4.0.5" - versionCode 64 + versionName "4.0.6" + versionCode 65 minSdk min_sdk targetSdk target_sdk diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicRepository.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicRepository.kt index ffe9abe3c..14730c8cb 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicRepository.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicRepository.kt @@ -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) diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt index 8317f67d8..01f6e15e9 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicSettings.kt @@ -51,6 +51,8 @@ interface MusicSettings : Settings { 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() } diff --git a/app/src/main/res/values/settings.xml b/app/src/main/res/values/settings.xml index 86e8d255a..fd5d1857b 100644 --- a/app/src/main/res/values/settings.xml +++ b/app/src/main/res/values/settings.xml @@ -15,6 +15,7 @@ auxio_observing auxio_music_dirs auxio_excluded_dirs + auxio_fs_cache auxio_cover_mode2 auxio_square_covers auxio_exclude_non_music diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26d456242..9111f1465 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -315,6 +315,8 @@ Music folders Manage where music should be loaded from New folder + Use file-system cache + Improves loading times, but can prevent new music from being added Excluded folders Manage folders to exclude from music loading Refresh music diff --git a/app/src/main/res/xml/preferences_root.xml b/app/src/main/res/xml/preferences_root.xml index 12f8fb94b..0b4009a44 100644 --- a/app/src/main/res/xml/preferences_root.xml +++ b/app/src/main/res/xml/preferences_root.xml @@ -38,6 +38,13 @@ app:summary="@string/set_excluded_locations_desc" app:title="@string/set_excluded_locations" /> + + +