Fixed pause on bluetooth disconnect, minor fixes

This commit is contained in:
Nite 2020-06-29 16:17:22 +02:00
parent fdc1748f8a
commit 7dad738fce
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
6 changed files with 15 additions and 4 deletions

View File

@ -77,17 +77,22 @@ public class Downloader
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleWithFixedDelay(downloadChecker, 5, 5, TimeUnit.SECONDS);
Log.i(TAG, "Downloader created");
}
public void onDestroy()
{
executorService.shutdown();
stop();
clear();
clearBackground();
Log.i(TAG, "Downloader destroyed");
}
public void stop()
{
executorService.shutdown();
Log.i(TAG, "Downloader stopped");
}
public synchronized void checkDownloads()
{
if (!Util.isExternalStoragePresent() || !externalStorageMonitor.isExternalStorageAvailable())

View File

@ -1081,7 +1081,7 @@ public class LocalMediaPlayer
cachedPosition = mediaPlayer.getCurrentPosition();
}
Util.sleepQuietly(25L);
Util.sleepQuietly(50L);
}
catch (Exception e)
{

View File

@ -96,7 +96,6 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
{
externalStorageMonitor.onDestroy();
context.stopService(new Intent(context, MediaPlayerService.class));
shufflePlayBuffer.onDestroy();
downloader.onDestroy();
Log.i(TAG, "MediaPlayerControllerImpl destroyed");

View File

@ -245,6 +245,9 @@ public class MediaPlayerLifecycleSupport
mediaPlayerController.pause();
mediaPlayerController.seekTo(0);
break;
case Constants.CMD_PAUSE:
mediaPlayerController.pause();
break;
case Constants.CMD_PROCESS_KEYCODE:
receiveIntent(intent);
break;

View File

@ -194,6 +194,8 @@ public class MediaPlayerService extends Service
downloadQueueSerializer.serializeDownloadQueueNow(downloader.downloadList,
downloader.getCurrentPlayingIndex(), getPlayerPosition());
localMediaPlayer.onDestroy();
downloader.stop();
shufflePlayBuffer.onDestroy();
} catch (Throwable ignored) {
}

View File

@ -65,11 +65,13 @@ public class ShufflePlayBuffer
}
};
executorService.scheduleWithFixedDelay(runnable, 1, 10, TimeUnit.SECONDS);
Log.i(TAG, "ShufflePlayBuffer created");
}
public void onDestroy()
{
executorService.shutdown();
Log.i(TAG, "ShufflePlayBuffer destroyed");
}
public List<MusicDirectory.Entry> get(int size)