A custom view to take pictures and put image in card view gallery .
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'
}
- 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"/>
- Configure context setting Activity or Fragment
mBinding.cardShowViewTakenPicturesView.setActivity(this);
or
mBinding.cardShowViewTakenPicturesView.setFragment(this);
- 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() {
}
});
- If you want show Edit State when no has Images when on create in view
// put method where you wish verify
mServiceInspectionFormFilledDetailFragBinding
.cardShowTakenPictureView.ifNoImagesShowEditStateViewConfigurationOnInit();
- 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);
}
- Optional component attributes
- app:pictureByName:
String
- app:updatedAt:
date
- app:showNoBorder:
boolean
, default valuefalse
- app:editModeOnly:
boolean
, default valuefalse
Add Programmatically :
mBinding.cardShowViewTakenPicturesView.setBinding(mBinding.cardShowViewTakenPicturesView,"Denis Vieira", new Date());
- 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);