Search in sources :

Example 1 with ImagePickerSheetView

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);
}
Also used : ImageView(android.widget.ImageView) Uri(android.net.Uri) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView)

Example 2 with ImagePickerSheetView

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);
}
Also used : Bundle(android.os.Bundle) Priority(in.bugzy.data.model.Priority) BaseActivity(in.bugzy.ui.BaseActivity) PackageManager(android.content.pm.PackageManager) ProgressBar(android.widget.ProgressBar) Date(java.util.Date) AttachmentsAdapter(in.bugzy.ui.caseevents.AttachmentsAdapter) Uri(android.net.Uri) FullScreenImageActivity(in.bugzy.ui.casedetails.FullScreenImageActivity) OnClick(butterknife.OnClick) FileProvider(android.support.v4.content.FileProvider) BindView(butterknife.BindView) Manifest(android.Manifest) Area(in.bugzy.data.model.Area) Locale(java.util.Locale) MediaStore(android.provider.MediaStore) NachoTextView(com.hootsuite.nachos.NachoTextView) Attachment(in.bugzy.data.model.Attachment) View(android.view.View) Button(android.widget.Button) ChipTerminatorHandler(com.hootsuite.nachos.terminator.ChipTerminatorHandler) AdapterView(android.widget.AdapterView) TargetApi(android.annotation.TargetApi) Log(android.util.Log) Milestone(in.bugzy.data.model.Milestone) R(in.bugzy.R) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView) Category(in.bugzy.data.model.Category) Status(in.bugzy.data.model.Status) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) PopupMenu(android.support.v7.widget.PopupMenu) ItemOffsetDecoration(in.bugzy.ui.common.ItemOffsetDecoration) ActivityCompat(android.support.v4.app.ActivityCompat) Person(in.bugzy.data.model.Person) List(java.util.List) TextView(android.widget.TextView) Project(in.bugzy.data.model.Project) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) Case(in.bugzy.data.model.Case) BottomSheetLayout(com.flipboard.bottomsheet.BottomSheetLayout) ButterKnife(butterknife.ButterKnife) Environment(android.os.Environment) CaseEvent(in.bugzy.data.model.CaseEvent) SimpleDateFormat(java.text.SimpleDateFormat) Intent(android.content.Intent) BugzyAlertDialog(in.bugzy.ui.common.BugzyAlertDialog) NonNull(android.support.annotation.NonNull) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) BugzyApp(in.bugzy.BugzyApp) Toast(android.widget.Toast) Menu(android.view.Menu) CaseDetailsActivity(in.bugzy.ui.casedetails.CaseDetailsActivity) Build(android.os.Build) ViewModelProvider(android.arch.lifecycle.ViewModelProvider) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) IOException(java.io.IOException) PropType(in.bugzy.ui.editcase.CaseEditViewModel.PropType) Tag(in.bugzy.data.model.Tag) File(java.io.File) Spinner(android.widget.Spinner) CaseEventsAdapter(in.bugzy.ui.caseevents.CaseEventsAdapter) ViewModelProviders(android.arch.lifecycle.ViewModelProviders) RecyclerView(android.support.v7.widget.RecyclerView) ArrayAdapter(android.widget.ArrayAdapter) AlertDialog(android.support.v7.app.AlertDialog) Const(in.bugzy.common.Const) Glide(com.bumptech.glide.Glide) TypedValue(android.util.TypedValue) Toolbar(android.support.v7.widget.Toolbar) Pair(android.support.v4.util.Pair) CaseStatus(in.bugzy.data.model.CaseStatus) Activity(android.app.Activity) EditText(android.widget.EditText) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView)

Aggregations

Uri (android.net.Uri)2 Manifest (android.Manifest)1 TargetApi (android.annotation.TargetApi)1 Activity (android.app.Activity)1 ViewModelProvider (android.arch.lifecycle.ViewModelProvider)1 ViewModelProviders (android.arch.lifecycle.ViewModelProviders)1 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 Environment (android.os.Environment)1 MediaStore (android.provider.MediaStore)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 Snackbar (android.support.design.widget.Snackbar)1 ActivityCompat (android.support.v4.app.ActivityCompat)1 ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)1 FileProvider (android.support.v4.content.FileProvider)1 Pair (android.support.v4.util.Pair)1 AlertDialog (android.support.v7.app.AlertDialog)1