diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-21 15:34:23 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-21 15:34:23 -0700 |
commit | af9562f49e4b671a2796ab1714ed0c8d4a543201 (patch) | |
tree | ea147e7ce61ab8542c9237700abac92a67cd15a8 /src | |
parent | a711ed48a91969373f1f46e12eabdfc77a4e31c3 (diff) | |
download | dsub-af9562f49e4b671a2796ab1714ed0c8d4a543201.tar.gz dsub-af9562f49e4b671a2796ab1714ed0c8d4a543201.tar.bz2 dsub-af9562f49e4b671a2796ab1714ed0c8d4a543201.zip |
Get rid of a couple of rare ANR's
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/MainFragment.java | 11 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/MainFragment.java b/src/github/daneren2005/dsub/fragments/MainFragment.java index fb36c9e3..0e1b587e 100644 --- a/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -254,9 +254,16 @@ public class MainFragment extends SubsonicFragment { private void setActiveServer(int instance) {
if (Util.getActiveServer(context) != instance) {
- DownloadService service = getDownloadService();
+ final DownloadService service = getDownloadService();
if (service != null) {
- service.clearIncomplete();
+ new SilentBackgroundTask<Void>(context) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ service.clearIncomplete();
+ return null;
+ }
+ }.execute();
+
}
Util.setActiveServer(context, instance);
context.invalidate();
diff --git a/src/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java b/src/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java index 5e1ad044..c27df2ba 100644 --- a/src/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java +++ b/src/github/daneren2005/dsub/util/compat/RemoteControlClientJB.java @@ -12,6 +12,7 @@ import android.media.MediaMetadataRetriever; import android.media.RemoteControlClient; import github.daneren2005.dsub.activity.SubsonicActivity; import github.daneren2005.dsub.service.DownloadService; +import github.daneren2005.dsub.util.SilentBackgroundTask; @TargetApi(18) public class RemoteControlClientJB extends RemoteControlClientICS { @@ -27,8 +28,14 @@ public class RemoteControlClientJB extends RemoteControlClientICS { }); mRemoteControl.setPlaybackPositionUpdateListener(new RemoteControlClient.OnPlaybackPositionUpdateListener() { @Override - public void onPlaybackPositionUpdate(long newPosition) { - downloadService.seekTo((int) newPosition); + public void onPlaybackPositionUpdate(final long newPosition) { + new SilentBackgroundTask<Void>(context) { + @Override + protected Void doInBackground() throws Throwable { + downloadService.seekTo((int) newPosition); + return null; + } + }.execute(); setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); } }); |