Update string on find by username screen.

This commit is contained in:
Greyson Parrelli 2024-02-15 09:46:54 -05:00 committed by Cody Henthorne
parent 872ee805d1
commit 0d5961baf9
3 changed files with 57 additions and 36 deletions

View file

@ -357,7 +357,7 @@ private fun previewPermissionState(): PermissionState {
private val previewLifecycleOwner: LifecycleOwner = object : LifecycleOwner {
override val lifecycle: Lifecycle
get() = TODO("Not yet implemented")
get() = throw UnsupportedOperationException("Only for tests")
}
private fun shareQrBadge(activity: Activity, badge: Bitmap?) {

View file

@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.recipients.ui.findby
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContract
@ -124,7 +125,7 @@ class FindByActivity : PassphraseRequiredActivity() {
navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24)
) {
val context = LocalContext.current
FindByContent(
Content(
paddingValues = it,
state = state,
onUserEntryChanged = viewModel::onUserEntryChanged,
@ -265,25 +266,8 @@ class FindByActivity : PassphraseRequiredActivity() {
}
}
@Preview
@Composable
private fun FindByContentPreview() {
Previews.Preview {
FindByContent(
paddingValues = PaddingValues(0.dp),
state = FindByState(
mode = FindByMode.PHONE_NUMBER,
userEntry = ""
),
onUserEntryChanged = {},
onNextClick = {},
onSelectCountryPrefixClick = {}
)
}
}
@Composable
private fun FindByContent(
private fun Content(
paddingValues: PaddingValues,
state: FindByState,
onUserEntryChanged: (String) -> Unit,
@ -368,7 +352,7 @@ private fun FindByContent(
if (state.mode == FindByMode.USERNAME) {
Text(
text = stringResource(id = R.string.FindByActivity__enter_a_full_username),
text = stringResource(id = R.string.FindByActivity__enter_username_description),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier
@ -436,20 +420,6 @@ private fun PhoneNumberEntryPrefix(
}
}
@Preview
@Composable
private fun SelectCountryScreenPreview() {
Previews.Preview {
SelectCountryScreen(
paddingValues = PaddingValues(0.dp),
searchEntry = "",
onSearchEntryChanged = {},
supportedCountryPrefixes = FindByState(mode = FindByMode.PHONE_NUMBER).supportedCountryPrefixes,
onCountryPrefixSelected = {}
)
}
}
@Composable
private fun SelectCountryScreen(
paddingValues: PaddingValues,
@ -556,3 +526,54 @@ private fun CountryPrefixRowItem(
)
}
}
@Preview(name = "Light Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(name = "Dark Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun ContentPreviewPhoneNumber() {
Previews.Preview {
Content(
paddingValues = PaddingValues(0.dp),
state = FindByState(
mode = FindByMode.PHONE_NUMBER,
userEntry = ""
),
onUserEntryChanged = {},
onNextClick = {},
onSelectCountryPrefixClick = {}
)
}
}
@Preview(name = "Light Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(name = "Dark Theme", group = "content", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun ContentPreviewUsername() {
Previews.Preview {
Content(
paddingValues = PaddingValues(0.dp),
state = FindByState(
mode = FindByMode.USERNAME,
userEntry = ""
),
onUserEntryChanged = {},
onNextClick = {},
onSelectCountryPrefixClick = {}
)
}
}
@Preview(name = "Light Theme", group = "select country", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(name = "Dark Theme", group = "select country", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun SelectCountryScreenPreview() {
Previews.Preview {
SelectCountryScreen(
paddingValues = PaddingValues(0.dp),
searchEntry = "",
onSearchEntryChanged = {},
supportedCountryPrefixes = FindByState(mode = FindByMode.PHONE_NUMBER).supportedCountryPrefixes,
onCountryPrefixSelected = {}
)
}
}

View file

@ -6566,7 +6566,7 @@
<!-- Entry placeholder for find by phone number -->
<string name="FindByActivity__phone_number">Phone number</string>
<!-- Help text under user entry for find by username -->
<string name="FindByActivity__enter_a_full_username">Enter a full username with its pair of digits.</string>
<string name="FindByActivity__enter_username_description">Enter a username followed by a dot and its set of numbers.</string>
<!-- Content description for next action button -->
<string name="FindByActivity__next">Next</string>
<!-- Placeholder text for search input for selecting country code -->