@Override public void onDestroy() { super.onDestroy(); if (mThumbnailer != null) mThumbnailer.clearJobs(); mBarrier.reset(); mVideoAdapter.clear(); }
public void updateList() { if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); final List<MediaWrapper> itemList = mMediaLibrary.getVideoItems(); if (mThumbnailer != null) mThumbnailer.clearJobs(); else Log.w(TAG, "Can't generate thumbnails, the thumbnailer is missing"); mVideoAdapter.setNotifyOnChange(true); mVideoAdapter.clear(); if (itemList.size() > 0) { new Thread( new Runnable() { @Override public void run() { if (mGroup != null || itemList.size() <= 10) { for (MediaWrapper item : itemList) { if (mGroup == null || item.getTitle().startsWith(mGroup)) { mVideoAdapter.setNotifyOnChange(false); mVideoAdapter.add(item); if (mThumbnailer != null) mThumbnailer.addJob(item); } } } else { List<MediaGroup> groups = MediaGroup.group(itemList); for (MediaGroup item : groups) { mVideoAdapter.setNotifyOnChange(false); mVideoAdapter.add(item.getMedia()); if (mThumbnailer != null) mThumbnailer.addJob(item); } } if (mReadyToDisplay) display(); } }) .start(); } else focusHelper(true); stopRefresh(); }
public void clear() { mVideoAdapter.clear(); }