Skip to content

Commit

Permalink
- Handled photo picker dialog closing behaviour
Browse files Browse the repository at this point in the history
- Handled audio and doc media type related issue occrring post selecting camera-type option
  • Loading branch information
vrajendraBhavsar committed Mar 26, 2024
1 parent 27ba25f commit 30c51f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/lassi/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
}

R.id.btnAudioPicker -> {
val intent = lassi.setMediaType(MediaType.AUDIO).setMaxCount(4).setGridSize(2)
val intent = lassi.with(LassiOption.CAMERA_AND_GALLERY).setMediaType(MediaType.AUDIO).setMaxCount(4).setGridSize(2)
.setPlaceHolder(R.drawable.ic_audio_placeholder)
.setErrorDrawable(R.drawable.ic_audio_placeholder)
.setSelectionDrawable(R.drawable.ic_checked_media)
Expand Down Expand Up @@ -252,7 +252,7 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
}

private fun launchDocPicker() {
val intent = lassi.setMediaType(MediaType.DOC).setMaxCount(4).setGridSize(2)
val intent = lassi.with(LassiOption.CAMERA_AND_GALLERY).setMediaType(MediaType.DOC).setMaxCount(4).setGridSize(2)
.setPlaceHolder(R.drawable.ic_document_placeholder)
.setErrorDrawable(R.drawable.ic_document_placeholder)
.setSelectionDrawable(R.drawable.ic_checked_media)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class FolderFragment : LassiBaseViewModelFragment<FolderViewModel, FragmentMedia
ToastUtils.showToast(
requireContext(), LassiConfig.getConfig().customLimitExceedingErrorMessage
)
activity?.finish()
} else {
if (uris.isNotEmpty()) {
val mediaPaths = ArrayList(uris.mapNotNull { uri ->
Expand All @@ -130,6 +129,7 @@ class FolderFragment : LassiBaseViewModelFragment<FolderViewModel, FragmentMedia
Log.d("PhotoPicker", "!@# PHOTO-PICKER:: No media selected")
}
}
activity?.finish() // To finish host activity when user closes photo picker dialog
}

private fun setResultOk(selectedMedia: ArrayList<MiMedia>?) {
Expand Down

0 comments on commit 30c51f1

Please sign in to comment.