Skip to content

A custom view to take pictures and put image in card view gallery .

Notifications You must be signed in to change notification settings

stantmob/card-show-taken-pictures-view

Repository files navigation

Card Show Taken Picture View

A custom view to take pictures and put image in card view gallery .

Releases

How add into your project

Add the repository to your build.gradle with:

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and on your project dependencies:

dependencies {
        compile 'com.github.stantmob:card-show-taken-pictures-view:v1.0.0'
}

How to use

  1. Add component to view file
    <br.com.stant.libraries.cardshowviewtakenpicturesview.CardShowTakenPictureView
        android:id="@+id/card_show_view_taken_pictures_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
  1. Configure context setting Activity or Fragment
    mBinding.cardShowViewTakenPicturesView.setActivity(this);

or

    mBinding.cardShowViewTakenPicturesView.setFragment(this);
  1. Configure setOnSavedCardListener to get Callback with images
    mBinding.cardShowViewTakenPicturesView.setOnSavedCardListener(new CardShowTakenPictureViewContract.OnSavedCardListener() {
        @Override
        public void onSaved(List<CardShowTakenImage> imagesAsAdded, List<CardShowTakenImage> imagesAsRemoved) {
        }

        @Override
        public void onCancel() {

        }
    });
  1. If you want show Edit State when no has Images when on create in view
 // put method where you wish verify 
    mServiceInspectionFormFilledDetailFragBinding
                .cardShowTakenPictureView.ifNoImagesShowEditStateViewConfigurationOnInit();
  1. Configure onActivityResult to set Image in Card with take picture success
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        mBinding.cardShowViewTakenPicturesView.addImageOnActivityResult(requestCode, resultCode, data);
    }
  1. Optional component attributes
  • app:pictureByName: String
  • app:updatedAt: date
  • app:showNoBorder: boolean, default value false
  • app:editModeOnly: boolean, default value false

Add Programmatically :

    mBinding.cardShowViewTakenPicturesView.setBinding(mBinding.cardShowViewTakenPicturesView,"Denis Vieira", new Date());
  1. How setImages in the Card
  • Mapper your Image object into CardShowTakenImage model . ( You can set remoteImageUrl or LocalImageFilename)
    public CardShowTakenImage(String identifier, String remoteImageUrl, String localImageFilename) 
  • Set CardShowTakenImage List into view component. Use setCardImages method to
    mBinding.cardShowViewTakenPicturesView.setCardImages(cardShowTakenImagesList);