-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [ANDROAPP-6764] Review MEDIA permissions to comply with Google P…
…lay policy
- Loading branch information
Showing
12 changed files
with
293 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
form/src/main/java/org/dhis2/form/ui/dialog/ImagePickerOptionsDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.dhis2.form.ui.dialog | ||
|
||
import android.content.Context | ||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.animation.fadeIn | ||
import androidx.compose.animation.fadeOut | ||
import androidx.compose.animation.slideInVertically | ||
import androidx.compose.animation.slideOutVertically | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement.spacedBy | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import org.dhis2.form.R | ||
import org.hisp.dhis.mobile.ui.designsystem.component.BottomSheetShell | ||
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing | ||
|
||
@Composable | ||
internal fun ImagePickerOptionsDialog( | ||
showImageOptions: Boolean, | ||
onDismiss: () -> Unit, | ||
onTakePicture: (Context) -> Unit, | ||
onSelectFromGallery: () -> Unit, | ||
) { | ||
AnimatedVisibility( | ||
visible = showImageOptions, | ||
enter = slideInVertically() + fadeIn(), | ||
exit = slideOutVertically() + fadeOut(), | ||
) { | ||
BottomSheetShell( | ||
title = stringResource(R.string.select_option), | ||
onDismiss = onDismiss, | ||
content = { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding( | ||
horizontal = Spacing.Spacing16, | ||
vertical = Spacing.Spacing24, | ||
), | ||
verticalArrangement = spacedBy(Spacing.Spacing16), | ||
) { | ||
val context = LocalContext.current | ||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.clickable { | ||
onDismiss() | ||
onTakePicture(context) | ||
}, | ||
contentAlignment = Alignment.CenterStart, | ||
) { | ||
Text(stringResource(R.string.take_photo)) | ||
} | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.clickable { | ||
onDismiss() | ||
onSelectFromGallery() | ||
}, | ||
contentAlignment = Alignment.CenterStart, | ||
) { | ||
Text(stringResource(R.string.from_gallery)) | ||
} | ||
} | ||
}, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.