[Android] AudioPlayer: avoid multiple calls of getActivity()

Adrien Maglo git at videolan.org
Mon Mar 3 17:34:26 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Mar  3 17:33:19 2014 +0100| [d4874ce5008cb23e1aebc86be5310fe91c421700] | committer: Adrien Maglo

AudioPlayer: avoid multiple calls of getActivity()

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d4874ce5008cb23e1aebc86be5310fe91c421700
---

 .../src/org/videolan/vlc/gui/audio/AudioPlayer.java     |   15 +++++----------
 1 file changed, 5 insertions(+), 10 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 203fe4c..4c6101a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -326,25 +326,20 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
             mHeaderPlayPause.setContentDescription(getString(R.string.play));
         }
         if (mAudioController.isShuffling()) {
-            mShuffle.setImageResource(Util.getResourceFromAttribute(getActivity(),
-                                      R.attr.ic_shuffle_pressed));
+            mShuffle.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_shuffle_pressed));
         } else {
-            mShuffle.setImageResource(Util.getResourceFromAttribute(getActivity(),
-                                      R.attr.ic_shuffle_normal));
+            mShuffle.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_shuffle_normal));
         }
         switch(mAudioController.getRepeatType()) {
         case None:
-            mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
-                                     R.attr.ic_repeat_normal));
+            mRepeat.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_repeat_normal));
             break;
         case Once:
-            mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
-                                     R.attr.ic_repeat_one));
+            mRepeat.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_repeat_one));
             break;
         default:
         case All:
-            mRepeat.setImageResource(Util.getResourceFromAttribute(getActivity(),
-                                     R.attr.ic_repeat_pressed));
+            mRepeat.setImageResource(Util.getResourceFromAttribute(act, R.attr.ic_repeat_pressed));
             break;
         }
         if (mAudioController.hasNext())



More information about the Android mailing list