[Android] VideoGridFragment: fix ArrayAdapter.addAll called before API 11
Thomas Guillem
git at videolan.org
Tue Oct 13 09:23:03 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct 13 08:43:53 2015 +0200| [ae12cd8c081fdf79ce485eeb462e5681b7e21ef4] | committer: Thomas Guillem
VideoGridFragment: fix ArrayAdapter.addAll called before API 11
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ae12cd8c081fdf79ce485eeb462e5681b7e21ef4
---
.../org/videolan/vlc/gui/video/VideoGridFragment.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 91e4bdf..f7e0c8f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -439,10 +439,22 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
+ private void addAllV7() {
+ for (MediaWrapper item : displayList)
+ mVideoAdapter.add(item);
+ }
+
+ @TargetApi(android.os.Build.VERSION_CODES.HONEYCOMB)
+ private void addAllV11() {
+ mVideoAdapter.addAll(displayList);
+ }
@Override
public void run() {
mVideoAdapter.clear();
- mVideoAdapter.addAll(displayList);
+ if (AndroidUtil.isHoneycombOrLater())
+ addAllV11();
+ else
+ addAllV7();
}
});
}
More information about the Android
mailing list