/** {@inheritDoc} */ @Override @SuppressWarnings("boxing") public void onEndMediaDiscovered(File[] images, boolean userRequest) { // Now we have the paths of the images to use. Notify to the thread to // load pictures in background if (mBackgroundTask != null) { mBackgroundTask.setAvailableImages(images); if (images != null && images.length > 0) { mFirstLoad = false; } synchronized (mBackgroundTask.mLoadSync) { mBackgroundTask.mLoadSync.notify(); } this.mStatus = 1; // Loaded // Audit int found = images == null ? 0 : images.length; Log.d(TAG, "Media picture data reloaded: " + found + " images found."); if (userRequest) { CharSequence msg = String.format( mContext .getResources() .getQuantityText(R.plurals.msg_media_reload_complete, found) .toString(), found); Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show(); } } else { this.mStatus = 2; // Error } }
/** {@inheritDoc} */ @Override public void onStartMediaDiscovered(boolean userRequest) { // No images but thread should start here to received partial data this.mStatus = 0; // Loading if (mBackgroundTask != null) { mBackgroundTask.setAvailableImages(new File[] {}); if (!mBackgroundTask.mRun) { mBackgroundTask.start(); } else { synchronized (mBackgroundTask.mLoadSync) { mBackgroundTask.mLoadSync.notify(); } } } }