forked from mirrors/gecko-dev
Bug 1893174 - Added microsurvey prompt Compose UI r=android-reviewers,vdreghici
Differential Revision: https://phabricator.services.mozilla.com/D208768
This commit is contained in:
parent
4cff528999
commit
14624240c9
2 changed files with 95 additions and 1 deletions
|
|
@ -65,7 +65,6 @@ fun MicroSurveyHeader(
|
||||||
tint = FirefoxTheme.colors.iconPrimary,
|
tint = FirefoxTheme.colors.iconPrimary,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(20.dp)
|
.size(20.dp)
|
||||||
.padding(1.dp),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix.microsurvey.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.material.Icon
|
||||||
|
import androidx.compose.material.IconButton
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.fenix.compose.annotation.LightDarkPreview
|
||||||
|
import org.mozilla.fenix.compose.button.PrimaryButton
|
||||||
|
import org.mozilla.fenix.theme.FirefoxTheme
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initial microsurvey prompt displayed to the user to request completion of feedback.
|
||||||
|
*
|
||||||
|
* @param title The prompt header title.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun MicrosurveyRequestPrompt(
|
||||||
|
title: String = "Help make printing in Firefox better. It only takes a sec.",
|
||||||
|
) { // todo this is the message title FXDROID-1918)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(color = FirefoxTheme.colors.layer1)
|
||||||
|
.padding(all = 16.dp),
|
||||||
|
) {
|
||||||
|
Header(title)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
PrimaryButton(text = stringResource(id = R.string.micro_survey_continue_button_label)) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun Header(
|
||||||
|
title: String,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.ic_firefox),
|
||||||
|
contentDescription = null, // todo update to string res once a11y strings are available FXDROID-1919.
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = title,
|
||||||
|
style = FirefoxTheme.typography.headline7,
|
||||||
|
color = FirefoxTheme.colors.textPrimary,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
)
|
||||||
|
|
||||||
|
IconButton(
|
||||||
|
onClick = {},// todo FXDROID-1947
|
||||||
|
modifier = Modifier.size(20.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = R.drawable.ic_close),
|
||||||
|
contentDescription = null, // todo update to string res once a11y strings are available FXDROID-1919.
|
||||||
|
tint = FirefoxTheme.colors.iconPrimary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreviewScreenSizes
|
||||||
|
@LightDarkPreview
|
||||||
|
@Composable
|
||||||
|
private fun MicrosurveyRequestPromptPreview() {
|
||||||
|
FirefoxTheme {
|
||||||
|
MicrosurveyRequestPrompt()
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue