diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt index a48f8748..0d8ffa12 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt @@ -62,7 +62,6 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr var mTracks = ArrayList() private var mHeadsetPlugReceiver = HeadsetPlugReceiver() private var mPlayer: MediaPlayer? = null - private var mPlayedTrackIndexes = ArrayList() private var mProgressHandler = Handler() private var mSleepTimer: CountDownTimer? = null private var mAudioManager: AudioManager? = null @@ -174,7 +173,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr mTracks.add(track) } } else { - getSortedTracks() + mTracks = getQueuedTracks() val wantedTrackId = intent?.getLongExtra(TRACK_ID, -1L) mCurrTrack = mTracks.firstOrNull { it.id == wantedTrackId } @@ -246,7 +245,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr private fun handleRefreshList(intent: Intent) { mTracks.clear() ensureBackgroundThread { - getSortedTracks() + mTracks = getQueuedTracks() EventBus.getDefault().post(Events.PlaylistUpdated(mTracks)) if (intent.getBooleanExtra(CALL_SETUP_AFTER, false)) { @@ -402,20 +401,6 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr } } - private fun getSortedTracks() { - if (config.currentPlaylist == ALL_TRACKS_PLAYLIST_ID) { - getAllDeviceTracks() - } - - mTracks = getQueuedTracks() - - /*Track.sorting = config.sorting - try { - mTracks.sort() - } catch (ignored: Exception) { - }*/ - } - private fun setupEqualizer() { try { mEqualizer = Equalizer(1, mPlayer!!.audioSessionId)