From 223a63bfbe02f93f4e2272e4a6918e9d0651bdc3 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 2 Apr 2013 18:12:43 -0700 Subject: Get rid of handlers that aren't being used --- .../daneren2005/dsub/service/DownloadServiceImpl.java | 15 ++++++--------- .../src/github/daneren2005/dsub/util/Util.java | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'subsonic-android') diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 8890a5c7..da34ddaf 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -87,14 +87,12 @@ public class DownloadServiceImpl extends Service implements DownloadService { private final IBinder binder = new SimpleServiceBinder(this); private Looper mediaPlayerLooper; - private Handler mediaPlayerHandler; private MediaPlayer mediaPlayer; private MediaPlayer nextMediaPlayer; private boolean nextSetup = false; private boolean isPartial = true; private final List downloadList = new ArrayList(); private final List backgroundDownloadList = new ArrayList(); - private final Handler handler = new Handler(); private final DownloadServiceLifecycleSupport lifecycleSupport = new DownloadServiceLifecycleSupport(this); private final ShufflePlayBuffer shufflePlayBuffer = new ShufflePlayBuffer(this); @@ -167,7 +165,6 @@ public class DownloadServiceImpl extends Service implements DownloadService { }); mediaPlayerLooper = Looper.myLooper(); - mediaPlayerHandler = new Handler(mediaPlayerLooper); Looper.loop(); } }).start(); @@ -242,7 +239,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { if(nextPlayingTask != null) { nextPlayingTask.cancel(); } - Util.hidePlayingNotification(this, this, handler); + Util.hidePlayingNotification(this, this); instance = null; } @@ -517,7 +514,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { mRemoteControl.updateMetadata(this, currentPlaying.getSong()); } else { Util.broadcastNewTrackInfo(this, null); - Util.hidePlayingNotification(this, this, handler); + Util.hidePlayingNotification(this, this); } } @@ -836,16 +833,16 @@ public class DownloadServiceImpl extends Service implements DownloadService { } if (show) { - Util.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + Util.showPlayingNotification(this, this, currentPlaying.getSong()); } else if (pause) { SharedPreferences prefs = Util.getPreferences(this); if(prefs.getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) { - Util.showPlayingNotification(this, this, handler, currentPlaying.getSong()); + Util.showPlayingNotification(this, this, currentPlaying.getSong()); } else { - Util.hidePlayingNotification(this, this, handler); + Util.hidePlayingNotification(this, this); } } else if(hide) { - Util.hidePlayingNotification(this, this, handler); + Util.hidePlayingNotification(this, this); } mRemoteControl.setPlaybackState(playerState.getRemoteControlClientPlayState()); diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Util.java b/subsonic-android/src/github/daneren2005/dsub/util/Util.java index 034ab1d7..6e5d31a9 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Util.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Util.java @@ -644,7 +644,7 @@ public final class Util { .show(); } - public static void showPlayingNotification(final Context context, final DownloadServiceImpl downloadService, Handler handler, MusicDirectory.Entry song) { + public static void showPlayingNotification(final Context context, final DownloadServiceImpl downloadService, MusicDirectory.Entry song) { // Set the icon, scrolling text and timestamp final Notification notification = new Notification(R.drawable.stat_notify_playing, song.getTitle(), System.currentTimeMillis()); notification.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; @@ -738,7 +738,7 @@ public final class Util { rv.setOnClickPendingIntent(R.id.control_next, pendingIntent); } - public static void hidePlayingNotification(final Context context, final DownloadServiceImpl downloadService, Handler handler) { + public static void hidePlayingNotification(final Context context, final DownloadServiceImpl downloadService) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); manager.cancelAll(); -- cgit v1.2.3