lets refetch the initial tracks at upgrading from 5.4.0 too
This commit is contained in:
parent
0b1583ac0f
commit
0f65e2a579
4 changed files with 11 additions and 2 deletions
|
@ -56,6 +56,7 @@ class MainActivity : SimpleActivity() {
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
if (config.appRunCount < 3) {
|
if (config.appRunCount < 3) {
|
||||||
config.wereCoversUpdated = true
|
config.wereCoversUpdated = true
|
||||||
|
config.wereInitialTracksFetched = true
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
|
|
|
@ -66,10 +66,13 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
|
||||||
activity.tracksDAO.updateCoverArt(it.coverArt, it.mediaStoreId)
|
activity.tracksDAO.updateCoverArt(it.coverArt, it.mediaStoreId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.config.wereCoversUpdated = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!context.config.wereInitialTracksFetched) {
|
||||||
val allTracks = context.getAllInitialTracks()
|
val allTracks = context.getAllInitialTracks()
|
||||||
RoomHelper(context).insertTracksWithPlaylist(allTracks)
|
RoomHelper(context).insertTracksWithPlaylist(allTracks)
|
||||||
|
context.config.wereInitialTracksFetched = true
|
||||||
context.config.wereCoversUpdated = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(WERE_COVERS_UPDATED, false)
|
get() = prefs.getBoolean(WERE_COVERS_UPDATED, false)
|
||||||
set(wereCoversUpdated) = prefs.edit().putBoolean(WERE_COVERS_UPDATED, wereCoversUpdated).apply()
|
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
|
var playlistSorting: Int
|
||||||
get() = prefs.getInt(PLAYLIST_SORTING, PLAYER_SORT_BY_TITLE)
|
get() = prefs.getInt(PLAYLIST_SORTING, PLAYER_SORT_BY_TITLE)
|
||||||
set(playlistSorting) = prefs.edit().putInt(PLAYLIST_SORTING, playlistSorting).apply()
|
set(playlistSorting) = prefs.edit().putInt(PLAYLIST_SORTING, playlistSorting).apply()
|
||||||
|
|
|
@ -10,6 +10,7 @@ const val START_SLEEP_TIMER = "start_sleep_timer"
|
||||||
const val STOP_SLEEP_TIMER = "stop_sleep_timer"
|
const val STOP_SLEEP_TIMER = "stop_sleep_timer"
|
||||||
const val TRACK_ID = "track_id"
|
const val TRACK_ID = "track_id"
|
||||||
const val WERE_COVERS_UPDATED = "were_covers_updated"
|
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 RESTART_PLAYER = "RESTART_PLAYER"
|
||||||
|
|
||||||
const val ARTIST = "artist"
|
const val ARTIST = "artist"
|
||||||
|
|
Loading…
Reference in a new issue