mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-08 03:21:05 +03:00
Fixed pause on bluetooth disconnect, minor fixes
This commit is contained in:
parent
fdc1748f8a
commit
7dad738fce
@ -77,17 +77,22 @@ public class Downloader
|
|||||||
executorService = Executors.newSingleThreadScheduledExecutor();
|
executorService = Executors.newSingleThreadScheduledExecutor();
|
||||||
executorService.scheduleWithFixedDelay(downloadChecker, 5, 5, TimeUnit.SECONDS);
|
executorService.scheduleWithFixedDelay(downloadChecker, 5, 5, TimeUnit.SECONDS);
|
||||||
Log.i(TAG, "Downloader created");
|
Log.i(TAG, "Downloader created");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
executorService.shutdown();
|
stop();
|
||||||
clear();
|
clear();
|
||||||
clearBackground();
|
clearBackground();
|
||||||
Log.i(TAG, "Downloader destroyed");
|
Log.i(TAG, "Downloader destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
executorService.shutdown();
|
||||||
|
Log.i(TAG, "Downloader stopped");
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void checkDownloads()
|
public synchronized void checkDownloads()
|
||||||
{
|
{
|
||||||
if (!Util.isExternalStoragePresent() || !externalStorageMonitor.isExternalStorageAvailable())
|
if (!Util.isExternalStoragePresent() || !externalStorageMonitor.isExternalStorageAvailable())
|
||||||
|
@ -1081,7 +1081,7 @@ public class LocalMediaPlayer
|
|||||||
cachedPosition = mediaPlayer.getCurrentPosition();
|
cachedPosition = mediaPlayer.getCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.sleepQuietly(25L);
|
Util.sleepQuietly(50L);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,6 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
|
|||||||
{
|
{
|
||||||
externalStorageMonitor.onDestroy();
|
externalStorageMonitor.onDestroy();
|
||||||
context.stopService(new Intent(context, MediaPlayerService.class));
|
context.stopService(new Intent(context, MediaPlayerService.class));
|
||||||
shufflePlayBuffer.onDestroy();
|
|
||||||
downloader.onDestroy();
|
downloader.onDestroy();
|
||||||
|
|
||||||
Log.i(TAG, "MediaPlayerControllerImpl destroyed");
|
Log.i(TAG, "MediaPlayerControllerImpl destroyed");
|
||||||
|
@ -245,6 +245,9 @@ public class MediaPlayerLifecycleSupport
|
|||||||
mediaPlayerController.pause();
|
mediaPlayerController.pause();
|
||||||
mediaPlayerController.seekTo(0);
|
mediaPlayerController.seekTo(0);
|
||||||
break;
|
break;
|
||||||
|
case Constants.CMD_PAUSE:
|
||||||
|
mediaPlayerController.pause();
|
||||||
|
break;
|
||||||
case Constants.CMD_PROCESS_KEYCODE:
|
case Constants.CMD_PROCESS_KEYCODE:
|
||||||
receiveIntent(intent);
|
receiveIntent(intent);
|
||||||
break;
|
break;
|
||||||
|
@ -194,6 +194,8 @@ public class MediaPlayerService extends Service
|
|||||||
downloadQueueSerializer.serializeDownloadQueueNow(downloader.downloadList,
|
downloadQueueSerializer.serializeDownloadQueueNow(downloader.downloadList,
|
||||||
downloader.getCurrentPlayingIndex(), getPlayerPosition());
|
downloader.getCurrentPlayingIndex(), getPlayerPosition());
|
||||||
localMediaPlayer.onDestroy();
|
localMediaPlayer.onDestroy();
|
||||||
|
downloader.stop();
|
||||||
|
shufflePlayBuffer.onDestroy();
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,13 @@ public class ShufflePlayBuffer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
executorService.scheduleWithFixedDelay(runnable, 1, 10, TimeUnit.SECONDS);
|
executorService.scheduleWithFixedDelay(runnable, 1, 10, TimeUnit.SECONDS);
|
||||||
|
Log.i(TAG, "ShufflePlayBuffer created");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
|
Log.i(TAG, "ShufflePlayBuffer destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MusicDirectory.Entry> get(int size)
|
public List<MusicDirectory.Entry> get(int size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user