From 98da4ab62da6b2901c8416ac01f283556c355a77 Mon Sep 17 00:00:00 2001 From: Sanjay Prajapati <82382452+sanjay-mi@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:02:38 +0530 Subject: [PATCH] Develop (#118) * Updated readme --------- Co-authored-by: Vrajendra --- README.md | 18 +++++++++++++- .../main/java/com/lassi/app/MainActivity.kt | 24 +------------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 74fb6de..5e1f96b 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,14 @@ Lassi is simplest way to pick media (either image, video, audio or doc) ### Key features -* Android 13 support +* Android 14 support * Simple implementation * Set your own custom styles * Filter by particular media type * Filter videos by min and max time * Enable/disable camera from LassiOption * You can open System Default view for file selection by using MediaType.FILE_TYPE_WITH_SYSTEM_VIEW +* Photo Picker feature integration # Usage @@ -146,6 +147,21 @@ Lassi is simplest way to pick media (either image, video, audio or doc) * Option - 2. To localize text content of Lassi picker with multiple language options, define language-specific string resource file in your project and update values of string resource keys mentioned in below link with your desired language. * [Lassi String Resources](https://github.com/Mindinventory/Lassi-Android/blob/931e147ebe6282bd1629858b5a9f29fe5a0b8b32/lassi/src/main/res/values/strings.xml) +### Way of utilizing Photo Picker +```kotlin + val intent = Lassi(this) + .with(LassiOption.CAMERA_AND_GALLERY) + .setMediaType(MediaType.PHOTO_PICKER) + .setMaxCount(4) + .setStatusBarColor(R.color.colorPrimaryDark) + .setToolbarColor(R.color.colorPrimary) + .setToolbarResourceColor(android.R.color.white) + .setProgressBarColor(R.color.colorAccent) + .setGalleryBackgroundColor(R.color.colorGrey) + .setCustomLimitExceedingErrorMessage("Selected item exceeded the limit!") + .build() +``` + ### Document access permission note If Android device SDK is >= 30 and wants to access document (only for choose the non media file) then add ```android.permission.MANAGE_EXTERNAL_STORAGE``` permission in your app otherwise library won't allow to access documents. Kindly check sample app for more detail. If you don't want to give Manage External Storage permission and wants to get files with system default view then You can use `OR` option from Step 1 and give required file type of document. diff --git a/app/src/main/java/com/lassi/app/MainActivity.kt b/app/src/main/java/com/lassi/app/MainActivity.kt index 4d298cf..b62477d 100644 --- a/app/src/main/java/com/lassi/app/MainActivity.kt +++ b/app/src/main/java/com/lassi/app/MainActivity.kt @@ -216,36 +216,14 @@ class MainActivity : AppCompatActivity(), View.OnClickListener { R.id.btnPhotoPicker -> { val intent = lassi.with(LassiOption.CAMERA_AND_GALLERY).setMaxCount(4) - .setAscSort(SortingOption.ASCENDING).setGridSize(2) .setMediaType(MediaType.PHOTO_PICKER) - .setPlaceHolder(R.drawable.ic_image_placeholder) - .setErrorDrawable(R.drawable.ic_image_placeholder) - .setSelectionDrawable(R.drawable.ic_checked_media) .setStatusBarColor(R.color.colorPrimaryDark) .setToolbarColor(R.color.colorPrimary) .setToolbarResourceColor(android.R.color.white) - .setAlertDialogNegativeButtonColor(R.color.cherry_red) - .setAlertDialogPositiveButtonColor(R.color.emerald_green) .setProgressBarColor(R.color.colorAccent) .setGalleryBackgroundColor(R.color.colorGrey) - .setCropType(CropImageView.CropShape.OVAL).setCropAspectRatio(1, 1) - .setCompressionRatio(10).setMinFileSize(0).setMaxFileSize(Int.MAX_VALUE.toLong()) - .enableActualCircleCrop() .setCustomLimitExceedingErrorMessage("Selected item exceeded the limit!") - .setSupportedFileTypes( - "jpg", - "jpeg", - "png", - "webp", - "gif", - "mp4", - "mkv", - "webm", - "avi", - "flv", - "3gp" - ).enableFlip() - .enableRotate().build() + .build() receiveData.launch(intent) } }