use of com.flipboard.bottomsheet.commons.ImagePickerSheetView in project bottomsheet by Flipboard.
the class ImagePickerActivity method showSheetView.
/**
* Show an {@link ImagePickerSheetView}
*/
private void showSheetView() {
ImagePickerSheetView sheetView = new ImagePickerSheetView.Builder(this).setMaxItems(30).setShowCameraOption(createCameraIntent() != null).setShowPickerOption(createPickIntent() != null).setImageProvider(new ImagePickerSheetView.ImageProvider() {
@Override
public void onProvideImage(ImageView imageView, Uri imageUri, int size) {
Glide.with(ImagePickerActivity.this).load(imageUri).centerCrop().crossFade().into(imageView);
}
}).setOnTileSelectedListener(new ImagePickerSheetView.OnTileSelectedListener() {
@Override
public void onTileSelected(ImagePickerSheetView.ImagePickerTile selectedTile) {
bottomSheetLayout.dismissSheet();
if (selectedTile.isCameraTile()) {
dispatchTakePictureIntent();
} else if (selectedTile.isPickerTile()) {
startActivityForResult(createPickIntent(), REQUEST_LOAD_IMAGE);
} else if (selectedTile.isImageTile()) {
showSelectedImage(selectedTile.getImageUri());
} else {
genericError();
}
}
}).setTitle("Choose an image...").create();
bottomSheetLayout.showWithSheetView(sheetView);
}
use of com.flipboard.bottomsheet.commons.ImagePickerSheetView in project bugzy by cpunq.
the class CaseEditActivity method showSheetView.
/**
* Show an {@link ImagePickerSheetView}
*/
private void showSheetView() {
ImagePickerSheetView sheetView = new ImagePickerSheetView.Builder(this).setMaxItems(30).setShowCameraOption(createCameraIntent() != null).setShowPickerOption(createPickIntent() != null).setImageProvider((imageView, imageUri, size) -> Glide.with(CaseEditActivity.this).load(imageUri).into(imageView)).setOnTileSelectedListener(selectedTile -> {
mBottomSheetLayout.dismissSheet();
if (selectedTile.isCameraTile()) {
dispatchTakePictureIntent();
} else if (selectedTile.isPickerTile()) {
startActivityForResult(createPickIntent(), REQUEST_LOAD_IMAGE);
} else if (selectedTile.isImageTile()) {
showSelectedImage(selectedTile.getImageUri());
} else {
// genericError();
}
}).setTitle("Choose an image...").create();
mBottomSheetLayout.showWithSheetView(sheetView);
}
Aggregations