diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt index 333fc250..549cfce0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt @@ -56,6 +56,7 @@ class MainActivity : SimpleActivity() { appLaunched(BuildConfig.APPLICATION_ID) if (config.appRunCount < 3) { config.wereCoversUpdated = true + config.wereInitialTracksFetched = true } handlePermission(PERMISSION_WRITE_STORAGE) { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt index 6d0b1f66..1a66f239 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt @@ -66,10 +66,13 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager activity.tracksDAO.updateCoverArt(it.coverArt, it.mediaStoreId) } + context.config.wereCoversUpdated = true + } + + if (!context.config.wereInitialTracksFetched) { val allTracks = context.getAllInitialTracks() RoomHelper(context).insertTracksWithPlaylist(allTracks) - - context.config.wereCoversUpdated = true + context.config.wereInitialTracksFetched = true } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Config.kt index e18be3a0..9a8e6962 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Config.kt @@ -60,6 +60,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(WERE_COVERS_UPDATED, false) set(wereCoversUpdated) = prefs.edit().putBoolean(WERE_COVERS_UPDATED, wereCoversUpdated).apply() + var wereInitialTracksFetched: Boolean + get() = prefs.getBoolean(WERE_INITIAL_TRACKS_FETCHED, false) + set(wereInitialTracksFetched) = prefs.edit().putBoolean(WERE_INITIAL_TRACKS_FETCHED, wereInitialTracksFetched).apply() + var playlistSorting: Int get() = prefs.getInt(PLAYLIST_SORTING, PLAYER_SORT_BY_TITLE) set(playlistSorting) = prefs.edit().putInt(PLAYLIST_SORTING, playlistSorting).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt index 85ff9561..c6e876ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/Constants.kt @@ -10,6 +10,7 @@ const val START_SLEEP_TIMER = "start_sleep_timer" const val STOP_SLEEP_TIMER = "stop_sleep_timer" const val TRACK_ID = "track_id" const val WERE_COVERS_UPDATED = "were_covers_updated" +const val WERE_INITIAL_TRACKS_FETCHED = "were_initial_tracks_fetched" const val RESTART_PLAYER = "RESTART_PLAYER" const val ARTIST = "artist"