Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data collection] Prompt user to select "Drop pin" or "Draw/walk perimeter" when organizers allow it #2715

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* 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.tasks.draw

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
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 com.google.android.ground.R
import com.google.android.ground.ui.theme.AppTheme
import com.google.android.ground.ui.theme.card_background

@Composable
fun ChoiceMapDialog() {
anandwana001 marked this conversation as resolved.
Show resolved Hide resolved
AlertDialog(
onDismissRequest = { },
title = { Text(stringResource(id = R.string.choice_map_dialog)) },
dismissButton = {
OutlinedButton(onClick = { }) { Text(text = stringResource(R.string.close)) }
},
confirmButton = { },
text = {
Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Text(text = stringResource(id = R.string.drop_a_pin),
modifier = Modifier
.weight(1f)
.background(
color = card_background,
shape = RoundedCornerShape(16.dp)
)
.padding(16.dp),
textAlign = TextAlign.Center)
Spacer(modifier = Modifier.width(8.dp))
Text(text = stringResource(id = R.string.draw_or_walk),
modifier = Modifier
.weight(1f)
.background(
color = card_background,
shape = RoundedCornerShape(16.dp)
)
.padding(16.dp),
textAlign = TextAlign.Center)
}
}
)
}

@Preview
@Composable
fun ChoiceMapDialogPreview() {
AppTheme {
ChoiceMapDialog()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ val md_theme_dark_outlineVariant = Color(0xFF424940)
val md_theme_dark_scrim = Color(0xFF000000)

val seed = Color(0xFF006E2C)

val card_background = Color(0xFFD4E8D1)
4 changes: 4 additions & 0 deletions ground/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,8 @@
</string>
<string name="draft_restored">Unsaved data restored</string>
<string name="load_tos_failed">Could not connect, try again later</string>

<string name="drop_a_pin">Drop a pin</string>
<string name="choice_map_dialog">How will you map this site?</string>
<string name="draw_or_walk">Draw or walk perimeter</string>
</resources>
Loading