[Android] Prevent autoboxing

Geoffrey Métais git at videolan.org
Wed Aug 19 13:02:18 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Aug 19 13:00:49 2015 +0200| [8dfeb3fb1eef2e760ef5a909d5d8b007b84dc8f1] | committer: Geoffrey Métais

Prevent autoboxing

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

 vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java |    8 ++++----
 .../src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 73fc0ab..df65b5e 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -93,7 +93,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
     ArrayObjectAdapter mNetworkAdapter;
     ArrayObjectAdapter mOtherAdapter;
     View mRootContainer;
-    ArrayMap<String, Integer> mVideoIndex;
+    final ArrayMap<String, Integer> mVideoIndex = new ArrayMap<String, Integer>();
     Drawable mDefaultBackground;
     Activity mContext;
     private Object mSelectedItem;
@@ -280,7 +280,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
     public void updateItem() {
         if (mVideoAdapter != null && mVideoIndex != null && mItemToUpdate != null) {
             if (mVideoIndex.containsKey(mItemToUpdate.getLocation())) {
-                mVideoAdapter.notifyArrayItemRangeChanged(mVideoIndex.get(mItemToUpdate.getLocation()), 1);
+                mVideoAdapter.notifyArrayItemRangeChanged(mVideoIndex.get(mItemToUpdate.getLocation()).intValue(), 1);
             }
         }
         try {
@@ -342,7 +342,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
             mProgressBar.setVisibility(View.VISIBLE);
 
             //Video Section
-            mVideoIndex = new ArrayMap<String, Integer>();
+            mVideoIndex.clear();
             mVideoAdapter = new ArrayObjectAdapter(
                     new CardPresenter(mContext));
             final HeaderItem videoHeader = new HeaderItem(HEADER_VIDEO, getString(R.string.video));
@@ -404,7 +404,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
                         for (int i = 0; i < total; ++i) {
                             item = videoList.get(i);
                             mVideoAdapter.add(item);
-                            mVideoIndex.put(item.getLocation(), i);
+                            mVideoIndex.put(item.getLocation(), Integer.valueOf(i));
                         }
                     }
                 });
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java
index 9d9a218..8bb6b38 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java
@@ -92,7 +92,7 @@ public class VideoGridFragment extends MediaLibBrowserFragment implements IVideo
 
             for (int i = 0 ; i < size ; ++i){
                 MediaWrapper = mediaList.get(i);
-                mMediaIndex.put(MediaWrapper.getLocation(), i);
+                mMediaIndex.put(MediaWrapper.getLocation(), Integer.valueOf(i));
                 publishProgress(MediaWrapper);
             }
             return null;
@@ -118,7 +118,7 @@ public class VideoGridFragment extends MediaLibBrowserFragment implements IVideo
     public void updateItem() {
         if (mAdapter != null && mMediaIndex != null && mItemToUpdate != null
                 && mMediaIndex.containsKey(mItemToUpdate.getLocation()))
-            mAdapter.notifyArrayItemRangeChanged(mMediaIndex.get(mItemToUpdate.getLocation()), 1);
+            mAdapter.notifyArrayItemRangeChanged(mMediaIndex.get(mItemToUpdate.getLocation()).intValue(), 1);
         try {
             mBarrier.await();
         } catch (InterruptedException e) {



More information about the Android mailing list