-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp UX for data submission screen and replace with compose based d…
…ialog (#2757) * Add a new UiState for submission completion * Handle newly added UiState in DataCollectionFragment * Add image from figma mocks * Create compose based dialog * Replace DialogFragment with compose based dialog * Remove unused references * Update license year
- Loading branch information
1 parent
6358298
commit bb52291
Showing
13 changed files
with
793 additions
and
161 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
93 changes: 93 additions & 0 deletions
93
...main/java/com/google/android/ground/ui/datacollection/DataSubmissionConfirmationDialog.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,93 @@ | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.android.ground.ui.datacollection | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.layout.wrapContentWidth | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.OutlinedButton | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.window.Dialog | ||
import androidx.compose.ui.window.DialogProperties | ||
import com.google.android.ground.R | ||
import com.google.android.ground.ui.theme.AppTheme | ||
|
||
@Composable | ||
fun DataSubmissionConfirmationDialog(onDismiss: () -> Unit) { | ||
Dialog( | ||
onDismissRequest = onDismiss, | ||
properties = DialogProperties(dismissOnBackPress = true, dismissOnClickOutside = true), | ||
) { | ||
Surface( | ||
modifier = Modifier.wrapContentWidth().wrapContentHeight(), | ||
shape = RoundedCornerShape(16.dp), | ||
tonalElevation = 8.dp, | ||
) { | ||
Column( | ||
modifier = Modifier.padding(16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.data_submitted), | ||
contentDescription = stringResource(R.string.data_submitted_image), | ||
contentScale = ContentScale.Fit, | ||
) | ||
|
||
Spacer(modifier = Modifier.height(12.dp)) | ||
|
||
Text( | ||
text = stringResource(R.string.data_collection_complete), | ||
style = MaterialTheme.typography.titleLarge, | ||
textAlign = TextAlign.Center, | ||
) | ||
|
||
Spacer(modifier = Modifier.height(8.dp)) | ||
|
||
Text( | ||
text = stringResource(R.string.data_collection_complete_details), | ||
style = MaterialTheme.typography.bodyMedium, | ||
textAlign = TextAlign.Center, | ||
) | ||
|
||
Spacer(modifier = Modifier.height(12.dp)) | ||
|
||
OutlinedButton(onClick = { onDismiss() }) { Text(stringResource(id = R.string.close)) } | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@Preview | ||
fun DataSubmissionConfirmationDialogPreview() { | ||
AppTheme { DataSubmissionConfirmationDialog {} } | ||
} |
38 changes: 0 additions & 38 deletions
38
...a/com/google/android/ground/ui/datacollection/DataSubmissionConfirmationDialogFragment.kt
This file was deleted.
Oops, something went wrong.
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.