private void selectAllImages() { if (mSelectedAlbum == null) { mSelectedAlbum = EventBus.getDefault().getStickyEvent(Events.OnClickAlbumEvent.class).albumEntry; } if (sCheckedImages.size() < mPickOptions.limit || mPickOptions.limit == NO_LIMIT) { for (final ImageEntry imageEntry : mSelectedAlbum.imageList) { if (mPickOptions.limit != NO_LIMIT && sCheckedImages.size() + 1 > mPickOptions.limit) { // Hit the limit Toast.makeText(this, R.string.you_cant_check_more_images, Toast.LENGTH_SHORT).show(); break; } if (!imageEntry.isPicked) { // To avoid repeated images sCheckedImages.add(imageEntry); imageEntry.isPicked = true; } } } EventBus.getDefault().post(new Events.OnUpdateImagesThumbnailEvent()); updateFab(); if (shouldShowDeselectAll()) { showDeselectAll(); } }
private void deselectAllImages() { for (final ImageEntry imageEntry : mSelectedAlbum.imageList) { imageEntry.isPicked = false; sCheckedImages.remove(imageEntry); } EventBus.getDefault().post(new Events.OnUpdateImagesThumbnailEvent()); hideDeselectAll(); updateFab(); }
private void handleMultipleModeAddition(final ImageEntry imageEntry) { if (mPickOptions.pickMode != Picker.PickMode.MULTIPLE_IMAGES) { return; } if (sCheckedImages.size() < mPickOptions.limit || mPickOptions.limit == NO_LIMIT) { imageEntry.isPicked = true; sCheckedImages.add(imageEntry); } else { Toast.makeText(this, R.string.you_cant_check_more_images, Toast.LENGTH_SHORT).show(); Log.i("onPickImage", "You can't check more images"); } }
public void onClickDone(View view) { if (mPickOptions.pickMode == Picker.PickMode.SINGLE_IMAGE) { sCheckedImages.add(mCurrentlyDisplayedImage); mCurrentlyDisplayedImage.isPicked = true; } else { // No need to modify sCheckedImages for Multiple images mode } super.finish(); // New object because sCheckedImages will get cleared mPickOptions.pickListener.onPickedSuccessfully(new ArrayList<>(sCheckedImages)); sCheckedImages.clear(); EventBus.getDefault().removeAllStickyEvents(); }