diff --git a/app/src/main/java/org/dhis2/usescases/enrollment/EnrollmentActivity.kt b/app/src/main/java/org/dhis2/usescases/enrollment/EnrollmentActivity.kt index 78a7e35d4b4..2f6914d8afc 100644 --- a/app/src/main/java/org/dhis2/usescases/enrollment/EnrollmentActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/enrollment/EnrollmentActivity.kt @@ -19,7 +19,7 @@ import org.dhis2.commons.Constants.ENROLLMENT_UID import org.dhis2.commons.Constants.PROGRAM_UID import org.dhis2.commons.Constants.TEI_UID import org.dhis2.commons.data.TeiAttributesInfo -import org.dhis2.commons.dialogs.imagedetail.ImageDetailBottomDialog +import org.dhis2.commons.dialogs.imagedetail.ImageDetailActivity import org.dhis2.commons.featureconfig.data.FeatureConfigRepository import org.dhis2.commons.featureconfig.model.Feature import org.dhis2.databinding.EnrollmentActivityBinding @@ -348,14 +348,13 @@ class EnrollmentActivity : ActivityGlobalAbstract(), EnrollmentView { } override fun displayTeiPicture(picturePath: String) { - // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component - ImageDetailBottomDialog( - null, - File(picturePath), - ).show( - supportFragmentManager, - ImageDetailBottomDialog.TAG, + val intent = ImageDetailActivity.intent( + context = this, + title = null, + imagePath = picturePath, ) + + startActivity(intent) } /*endregion*/ /*region ACCESS*/ diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchTEList.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchTEList.kt index d35acf6b5f6..d374a11429c 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchTEList.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchTEList.kt @@ -21,7 +21,7 @@ import androidx.paging.PagedList import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.RecyclerView import org.dhis2.bindings.dp -import org.dhis2.commons.dialogs.imagedetail.ImageDetailBottomDialog +import org.dhis2.commons.dialogs.imagedetail.ImageDetailActivity import org.dhis2.commons.filters.workingLists.WorkingListViewModel import org.dhis2.commons.filters.workingLists.WorkingListViewModelFactory import org.dhis2.commons.resources.ColorUtils @@ -35,7 +35,6 @@ import org.dhis2.usescases.searchTrackEntity.ui.CreateNewButton import org.dhis2.usescases.searchTrackEntity.ui.FullSearchButtonAndWorkingList import org.dhis2.usescases.searchTrackEntity.ui.mapper.TEICardMapper import org.dhis2.utils.isLandscape -import java.io.File import javax.inject.Inject const val ARG_FROM_RELATIONSHIP = "ARG_FROM_RELATIONSHIP" @@ -232,8 +231,13 @@ class SearchTEList : FragmentGlobalAbstract() { // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component private fun displayImageDetail(imagePath: String) { - ImageDetailBottomDialog(null, File(imagePath)) - .show(childFragmentManager, ImageDetailBottomDialog.TAG) + val intent = ImageDetailActivity.intent( + context = requireContext(), + title = null, + imagePath = imagePath, + ) + + startActivity(intent) } private fun observeNewData() { diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/mapView/SearchTEMap.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/mapView/SearchTEMap.kt index 98c8723f342..475fe6fbb87 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/mapView/SearchTEMap.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/mapView/SearchTEMap.kt @@ -14,7 +14,7 @@ import org.dhis2.animations.CarouselViewAnimations import org.dhis2.bindings.dp import org.dhis2.commons.bindings.clipWithRoundedCorners import org.dhis2.commons.data.RelationshipOwnerType -import org.dhis2.commons.dialogs.imagedetail.ImageDetailBottomDialog +import org.dhis2.commons.dialogs.imagedetail.ImageDetailActivity import org.dhis2.commons.locationprovider.LocationSettingLauncher import org.dhis2.commons.resources.ColorType import org.dhis2.commons.resources.ColorUtils @@ -33,7 +33,6 @@ import org.dhis2.usescases.searchTrackEntity.SearchTEIViewModel import org.dhis2.usescases.searchTrackEntity.SearchTeiViewModelFactory import org.dhis2.utils.NetworkUtils import org.dhis2.utils.isPortrait -import java.io.File import javax.inject.Inject const val ARG_FROM_RELATIONSHIP = "ARG_FROM_RELATIONSHIP" @@ -260,14 +259,15 @@ class SearchTEMap : FragmentGlobalAbstract(), MapboxMap.OnMapClickListener { } .addOnProfileImageClickListener { path: String? -> if (binding.mapCarousel.carouselEnabled) { - // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component - ImageDetailBottomDialog( - null, - File(path), - ).show( - childFragmentManager, - ImageDetailBottomDialog.TAG, - ) + if (!path.isNullOrBlank()) { + val intent = ImageDetailActivity.intent( + context = requireContext(), + title = null, + imagePath = path, + ) + + startActivity(intent) + } } Unit } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt index aeaa18fa11c..22e458dbf30 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt @@ -31,7 +31,7 @@ import org.dhis2.commons.data.EventViewModel import org.dhis2.commons.data.StageSection import org.dhis2.commons.dialogs.CustomDialog import org.dhis2.commons.dialogs.DialogClickListener -import org.dhis2.commons.dialogs.imagedetail.ImageDetailBottomDialog +import org.dhis2.commons.dialogs.imagedetail.ImageDetailActivity import org.dhis2.commons.filters.FilterItem import org.dhis2.commons.filters.FilterManager import org.dhis2.commons.filters.FilterManager.PeriodRequest @@ -269,11 +269,13 @@ class TEIDataFragment : FragmentGlobalAbstract(), TEIDataContracts.View { val card = teiDashboardCardMapper.map( dashboardModel = dashboardModel, onImageClick = { fileToShow -> - // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component - ImageDetailBottomDialog( - null, - fileToShow, - ).show(childFragmentManager, ImageDetailBottomDialog.TAG) + val intent = ImageDetailActivity.intent( + context = requireActivity(), + title = null, + imagePath = fileToShow.path, + ) + + startActivity(intent) }, phoneCallback = { openChooser(it, Intent.ACTION_DIAL) }, emailCallback = { openChooser(it, Intent.ACTION_SENDTO) }, @@ -538,11 +540,13 @@ class TEIDataFragment : FragmentGlobalAbstract(), TEIDataContracts.View { binding.cardFront.teiImage.setOnClickListener { val fileToShow = File(filePath) if (fileToShow.exists()) { - // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component - ImageDetailBottomDialog( - null, - fileToShow, - ).show(childFragmentManager, ImageDetailBottomDialog.TAG) + val intent = ImageDetailActivity.intent( + context = requireActivity(), + title = null, + imagePath = fileToShow.path, + ) + + startActivity(intent) } } } diff --git a/commons/src/main/AndroidManifest.xml b/commons/src/main/AndroidManifest.xml index d1a58dce21a..6c8c73cf91e 100644 --- a/commons/src/main/AndroidManifest.xml +++ b/commons/src/main/AndroidManifest.xml @@ -16,6 +16,9 @@ android:name="org.dhis2.commons.featureconfig.ui.FeatureConfigView" android:exported="false"/> + + - \ No newline at end of file + diff --git a/form/src/main/java/org/dhis2/form/data/FormFileProvider.kt b/commons/src/main/java/org/dhis2/commons/data/FormFileProvider.kt similarity index 88% rename from form/src/main/java/org/dhis2/form/data/FormFileProvider.kt rename to commons/src/main/java/org/dhis2/commons/data/FormFileProvider.kt index f62191993e3..e807a844613 100644 --- a/form/src/main/java/org/dhis2/form/data/FormFileProvider.kt +++ b/commons/src/main/java/org/dhis2/commons/data/FormFileProvider.kt @@ -1,4 +1,4 @@ -package org.dhis2.form.data +package org.dhis2.commons.data import android.content.Context diff --git a/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailActivity.kt b/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailActivity.kt new file mode 100644 index 00000000000..b5d12adac35 --- /dev/null +++ b/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailActivity.kt @@ -0,0 +1,79 @@ +package org.dhis2.commons.dialogs.imagedetail + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.appcompat.app.AppCompatActivity +import androidx.compose.runtime.remember +import androidx.compose.ui.graphics.asImageBitmap +import androidx.compose.ui.graphics.painter.BitmapPainter +import androidx.core.content.FileProvider +import org.dhis2.commons.R +import org.dhis2.commons.data.FormFileProvider +import org.dhis2.commons.extensions.getBitmap +import org.hisp.dhis.mobile.ui.designsystem.component.FullScreenImage +import timber.log.Timber +import java.io.File +import java.io.IOException + +class ImageDetailActivity : AppCompatActivity() { + + companion object { + + private const val ARG_IMAGE_TITLE = "arg_image_title" + private const val ARG_IMAGE_PATH = "arg_image_path" + + fun intent(context: Context, title: String?, imagePath: String): Intent { + return Intent(context, ImageDetailActivity::class.java).apply { + putExtra(ARG_IMAGE_TITLE, title) + putExtra(ARG_IMAGE_PATH, imagePath) + } + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val title = intent.getStringExtra(ARG_IMAGE_TITLE) + val imagePath = intent.getStringExtra(ARG_IMAGE_PATH)!! + + setContent { + val painter = remember(imagePath) { + imagePath.getBitmap()?.let { BitmapPainter(it.asImageBitmap()) } + } + + FullScreenImage( + painter = painter!!, + title = title.orEmpty(), + onDismiss = { finish() }, + onDownloadButtonClick = { saveImage(imagePath) }, + onShareButtonClick = { shareImage(imagePath) }, + ) + } + } + + private fun saveImage(image: String) { + // TODO: Implement saving image to disk + } + + private fun shareImage(image: String) { + val intent = Intent(Intent.ACTION_SEND).apply { + val contentUri = FileProvider.getUriForFile( + this@ImageDetailActivity, + FormFileProvider.fileProviderAuthority, + File(image), + ) + setDataAndType(contentUri, contentResolver.getType(contentUri)) + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + putExtra(Intent.EXTRA_STREAM, contentUri) + } + + val title = resources.getString(R.string.open_with) + val chooser = Intent.createChooser(intent, title) + try { + startActivity(chooser) + } catch (e: IOException) { + Timber.e(e) + } + } +} diff --git a/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailBottomDialog.kt b/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailBottomDialog.kt deleted file mode 100644 index 09a95bd2886..00000000000 --- a/commons/src/main/java/org/dhis2/commons/dialogs/imagedetail/ImageDetailBottomDialog.kt +++ /dev/null @@ -1,83 +0,0 @@ -package org.dhis2.commons.dialogs.imagedetail - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.FrameLayout -import androidx.databinding.DataBindingUtil -import com.bumptech.glide.Glide -import com.bumptech.glide.load.engine.DiskCacheStrategy -import com.bumptech.glide.load.resource.bitmap.RoundedCorners -import com.bumptech.glide.request.RequestOptions -import com.google.android.material.bottomsheet.BottomSheetBehavior -import com.google.android.material.bottomsheet.BottomSheetDialog -import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import org.dhis2.commons.R -import org.dhis2.commons.bindings.dp -import org.dhis2.commons.bindings.widthAndHeight -import org.dhis2.commons.databinding.DetailImageBottomDialogBinding -import org.dhis2.commons.resources.ColorType -import org.dhis2.commons.resources.ColorUtils -import java.io.File - -class ImageDetailBottomDialog( - val label: String?, - private val fileToShow: File, -) : BottomSheetDialogFragment() { - companion object { - const val TAG: String = "IMG_DETAIL_DIALOG" - } - - private lateinit var binding: DetailImageBottomDialogBinding - - val colorUtils: ColorUtils = ColorUtils() - - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle?, - ): View { - binding = - DataBindingUtil.inflate(inflater, R.layout.detail_image_bottom_dialog, container, false) - binding.title = label - binding.closeButton.setImageDrawable( - colorUtils.tintDrawableWithColor( - binding.closeButton.drawable, - colorUtils.getPrimaryColor(requireContext(), ColorType.PRIMARY), - ), - ) - binding.closeButton.setOnClickListener { dismiss() } - - return binding.root - } - - // This is necessary to show the bottomSheet dialog with full height on landscape - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - view.viewTreeObserver.addOnGlobalLayoutListener { - val dialog = dialog as BottomSheetDialog - - val bottomSheet = - dialog.findViewById( - com.google.android.material.R.id.design_bottom_sheet, - ) - val behavior = BottomSheetBehavior.from(bottomSheet!!) - behavior.state = BottomSheetBehavior.STATE_EXPANDED - behavior.setPeekHeight(0) - } - } - - override fun onResume() { - super.onResume() - val (width, height) = fileToShow.widthAndHeight(300.dp) - Glide.with(this) - .load(fileToShow) - .apply(RequestOptions.skipMemoryCacheOf(true)) - .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE)) - .apply(RequestOptions.bitmapTransform(RoundedCorners(40))) - .apply(RequestOptions().override(width, height)) - .skipMemoryCache(true) - .into(binding.fullImage) - } -} diff --git a/commons/src/main/java/org/dhis2/commons/extensions/PictureBindings.kt b/commons/src/main/java/org/dhis2/commons/extensions/PictureBindings.kt new file mode 100644 index 00000000000..88bf020036f --- /dev/null +++ b/commons/src/main/java/org/dhis2/commons/extensions/PictureBindings.kt @@ -0,0 +1,9 @@ +package org.dhis2.commons.extensions + +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import java.io.File + +fun String.getBitmap(): Bitmap? = File(this) + .takeIf { it.exists() } + ?.let { BitmapFactory.decodeFile(it.absolutePath) } diff --git a/commons/src/main/res/values/strings.xml b/commons/src/main/res/values/strings.xml index 7a4741b683b..537fd500d8a 100644 --- a/commons/src/main/res/values/strings.xml +++ b/commons/src/main/res/values/strings.xml @@ -239,4 +239,5 @@ %d year overdue %d years overdue + Open with diff --git a/form/src/main/java/org/dhis2/form/ui/FormView.kt b/form/src/main/java/org/dhis2/form/ui/FormView.kt index abfddbcd60a..1ab3491afc3 100644 --- a/form/src/main/java/org/dhis2/form/ui/FormView.kt +++ b/form/src/main/java/org/dhis2/form/ui/FormView.kt @@ -50,11 +50,12 @@ import org.dhis2.commons.Constants import org.dhis2.commons.bindings.getFileFrom import org.dhis2.commons.bindings.getFileFromGallery import org.dhis2.commons.bindings.rotateImage +import org.dhis2.commons.data.FormFileProvider import org.dhis2.commons.dialogs.AlertBottomDialog import org.dhis2.commons.dialogs.CustomDialog import org.dhis2.commons.dialogs.calendarpicker.CalendarPicker import org.dhis2.commons.dialogs.calendarpicker.OnDatePickerListener -import org.dhis2.commons.dialogs.imagedetail.ImageDetailBottomDialog +import org.dhis2.commons.dialogs.imagedetail.ImageDetailActivity import org.dhis2.commons.extensions.closeKeyboard import org.dhis2.commons.extensions.serializable import org.dhis2.commons.extensions.truncate @@ -64,7 +65,6 @@ import org.dhis2.commons.orgunitselector.OUTreeFragment import org.dhis2.commons.orgunitselector.OrgUnitSelectorScope import org.dhis2.form.R import org.dhis2.form.data.DataIntegrityCheckResult -import org.dhis2.form.data.FormFileProvider import org.dhis2.form.data.RulesUtilsProviderConfigurationError import org.dhis2.form.data.SuccessfulResult import org.dhis2.form.data.scan.ScanContract @@ -638,6 +638,17 @@ class FormView : Fragment() { Uri.parse(currentValue.value) } } + + Intent.ACTION_SEND -> { + val contentUri = FileProvider.getUriForFile( + requireContext(), + FormFileProvider.fileProviderAuthority, + File(currentValue.value), + ) + setDataAndType(contentUri, requireContext().contentResolver.getType(contentUri)) + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + putExtra(Intent.EXTRA_STREAM, contentUri) + } } } @@ -963,8 +974,13 @@ class FormView : Fragment() { // TODO replace ImageDetailBottomDialog with new mobile ui Image detail component private fun showFullPicture(event: RecyclerViewUiEvents.ShowImage) { - ImageDetailBottomDialog(event.label, File(event.value)) - .show(parentFragmentManager, ImageDetailBottomDialog.TAG) + val intent = ImageDetailActivity.intent( + title = event.label, + imagePath = event.value, + context = requireActivity(), + ) + + startActivity(intent) } private fun openFileSelector(event: RecyclerViewUiEvents.OpenFileSelector) { diff --git a/form/src/main/java/org/dhis2/form/ui/binding/PictureBindings.kt b/form/src/main/java/org/dhis2/form/ui/binding/PictureBindings.kt index 727c4ff47ae..d8384b0d93c 100644 --- a/form/src/main/java/org/dhis2/form/ui/binding/PictureBindings.kt +++ b/form/src/main/java/org/dhis2/form/ui/binding/PictureBindings.kt @@ -1,12 +1,11 @@ package org.dhis2.form.ui.binding -import android.graphics.Bitmap -import android.graphics.BitmapFactory import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.databinding.BindingAdapter +import org.dhis2.commons.extensions.getBitmap import org.dhis2.form.R import org.dhis2.form.model.FieldUiModel import org.dhis2.form.model.UiEventType @@ -18,7 +17,6 @@ import org.dhis2.ui.theme.Dhis2Theme import org.dhis2.ui.theme.errorColor import org.dhis2.ui.theme.textSecondary import org.dhis2.ui.theme.warningColor -import java.io.File @BindingAdapter("picture") fun ComposeView.setPicture(fieldUiModel: FieldUiModel) { @@ -63,7 +61,3 @@ fun ComposeView.setPicture(fieldUiModel: FieldUiModel) { } } } - -fun String.getBitmap(): Bitmap? = File(this) - .takeIf { it.exists() } - ?.let { BitmapFactory.decodeFile(it.absolutePath) } diff --git a/form/src/main/java/org/dhis2/form/ui/dialog/QRDetailBottomDialog.kt b/form/src/main/java/org/dhis2/form/ui/dialog/QRDetailBottomDialog.kt index 63e6210b54a..ba11ce614c4 100644 --- a/form/src/main/java/org/dhis2/form/ui/dialog/QRDetailBottomDialog.kt +++ b/form/src/main/java/org/dhis2/form/ui/dialog/QRDetailBottomDialog.kt @@ -27,10 +27,10 @@ import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.core.content.FileProvider import androidx.fragment.app.viewModels import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import org.dhis2.commons.data.FormFileProvider import org.dhis2.commons.resources.ColorType import org.dhis2.commons.resources.ColorUtils import org.dhis2.form.R -import org.dhis2.form.data.FormFileProvider import org.dhis2.form.model.UiRenderType import org.hisp.dhis.android.core.arch.helpers.FileResourceDirectoryHelper import org.hisp.dhis.lib.expression.math.GS1Elements diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/ImageInputProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/ImageInputProvider.kt index 21c96e3ac86..554cad08f03 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/ImageInputProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/ImageInputProvider.kt @@ -1,5 +1,6 @@ package org.dhis2.form.ui.provider.inputfield +import android.content.Intent import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -9,6 +10,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.painter.BitmapPainter +import org.dhis2.commons.extensions.getBitmap import org.dhis2.commons.resources.ResourceManager import org.dhis2.form.R import org.dhis2.form.extensions.inputState @@ -16,7 +18,6 @@ import org.dhis2.form.extensions.legend import org.dhis2.form.extensions.supportingText import org.dhis2.form.model.FieldUiModel import org.dhis2.form.model.UiEventType -import org.dhis2.form.ui.binding.getBitmap import org.dhis2.form.ui.event.RecyclerViewUiEvents import org.dhis2.form.ui.intent.FormIntent import org.hisp.dhis.mobile.ui.designsystem.component.InputImage @@ -50,6 +51,15 @@ internal fun ProvideInputImage( onDownloadButtonClick = { uiEventHandler.invoke(RecyclerViewUiEvents.OpenFile(fieldUiModel)) }, + onShareButtonClick = { + uiEventHandler.invoke( + RecyclerViewUiEvents.OpenChooserIntent( + Intent.ACTION_SEND, + fieldUiModel.displayName, + fieldUiModel.uid, + ), + ) + }, onResetButtonClicked = { fieldUiModel.onClear() uploadState = getUploadState(fieldUiModel.displayName, false) @@ -63,8 +73,6 @@ internal fun ProvideInputImage( uploadState = getUploadState(fieldUiModel.displayName, true) fieldUiModel.invokeUiEvent(UiEventType.ADD_PICTURE) }, - onShareButtonClick = {}, - ) } diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/SignatureProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/SignatureProvider.kt index 0ad9ea58f47..3d49a4fa2d0 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/SignatureProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/SignatureProvider.kt @@ -1,5 +1,6 @@ package org.dhis2.form.ui.provider.inputfield +import android.content.Intent import android.graphics.BitmapFactory import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -68,6 +69,14 @@ fun ProvideInputSignature( uploadState = getUploadState(fieldUiModel.displayName, true) fieldUiModel.invokeUiEvent(UiEventType.ADD_SIGNATURE) }, - onShareButtonClick = {}, + onShareButtonClick = { + uiEventHandler.invoke( + RecyclerViewUiEvents.OpenChooserIntent( + Intent.ACTION_SEND, + fieldUiModel.displayName, + fieldUiModel.uid, + ), + ) + }, ) }