[Android] Avoid useless comparison between lists

Geoffrey Métais git at videolan.org
Thu Jan 7 11:45:34 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan  7 11:33:13 2016 +0100| [5d209782eacb2d0c416c7368a44f21ceb96f0a57] | committer: Geoffrey Métais

Avoid useless comparison between lists

> https://code.videolan.org/videolan/vlc-android/commit/5d209782eacb2d0c416c7368a44f21ceb96f0a57
---

 .../org/videolan/vlc/gui/audio/AudioPlayer.java    | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index c05a671..a3d80cf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -419,7 +419,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
         if (mService == null)
             return;
 
-        final List<MediaWrapper> previousAudioList = mPlaylistAdapter.getMedias();
         mPlaylistAdapter.clear();
 
         final List<MediaWrapper> audioList = mService.getMedias();
@@ -436,28 +435,21 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
             mPlaylistAdapter.notifyItemRangeChanged(0, count);
 
         final int selectionIndex = currentIndex;
-        if (!previousAudioList.equals(audioList))
-            mPlaylist.post(new Runnable() {
-                @Override
-                public void run() {
-                    mPlaylistAdapter.setCurrentIndex(selectionIndex);
-                }
-            });
+        mPlaylist.post(new Runnable() {
+            @Override
+            public void run() {
+                mPlaylistAdapter.setCurrentIndex(selectionIndex);
+            }
+        });
     }
 
     OnSeekBarChangeListener mTimelineListner = new OnSeekBarChangeListener() {
 
         @Override
-        public void onStopTrackingTouch(SeekBar arg0) {
-            // TODO Auto-generated method stub
-
-        }
+        public void onStopTrackingTouch(SeekBar seekBar) {}
 
         @Override
-        public void onStartTrackingTouch(SeekBar arg0) {
-            // TODO Auto-generated method stub
-
-        }
+        public void onStartTrackingTouch(SeekBar seekBar) {}
 
         @Override
         public void onProgressChanged(SeekBar sb, int prog, boolean fromUser) {



More information about the Android mailing list