Update string on find by username screen.
This commit is contained in:
parent
872ee805d1
commit
0d5961baf9
3 changed files with 57 additions and 36 deletions
|
@ -357,7 +357,7 @@ private fun previewPermissionState(): PermissionState {
|
||||||
|
|
||||||
private val previewLifecycleOwner: LifecycleOwner = object : LifecycleOwner {
|
private val previewLifecycleOwner: LifecycleOwner = object : LifecycleOwner {
|
||||||
override val lifecycle: Lifecycle
|
override val lifecycle: Lifecycle
|
||||||
get() = TODO("Not yet implemented")
|
get() = throw UnsupportedOperationException("Only for tests")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shareQrBadge(activity: Activity, badge: Bitmap?) {
|
private fun shareQrBadge(activity: Activity, badge: Bitmap?) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.recipients.ui.findby
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.activity.result.contract.ActivityResultContract
|
import androidx.activity.result.contract.ActivityResultContract
|
||||||
|
@ -124,7 +125,7 @@ class FindByActivity : PassphraseRequiredActivity() {
|
||||||
navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24)
|
navigationIconPainter = painterResource(id = R.drawable.symbol_arrow_left_24)
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
FindByContent(
|
Content(
|
||||||
paddingValues = it,
|
paddingValues = it,
|
||||||
state = state,
|
state = state,
|
||||||
onUserEntryChanged = viewModel::onUserEntryChanged,
|
onUserEntryChanged = viewModel::onUserEntryChanged,
|
||||||
|
@ -265,25 +266,8 @@ class FindByActivity : PassphraseRequiredActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun FindByContentPreview() {
|
private fun Content(
|
||||||
Previews.Preview {
|
|
||||||
FindByContent(
|
|
||||||
paddingValues = PaddingValues(0.dp),
|
|
||||||
state = FindByState(
|
|
||||||
mode = FindByMode.PHONE_NUMBER,
|
|
||||||
userEntry = ""
|
|
||||||
),
|
|
||||||
onUserEntryChanged = {},
|
|
||||||
onNextClick = {},
|
|
||||||
onSelectCountryPrefixClick = {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun FindByContent(
|
|
||||||
paddingValues: PaddingValues,
|
paddingValues: PaddingValues,
|
||||||
state: FindByState,
|
state: FindByState,
|
||||||
onUserEntryChanged: (String) -> Unit,
|
onUserEntryChanged: (String) -> Unit,
|
||||||
|
@ -368,7 +352,7 @@ private fun FindByContent(
|
||||||
|
|
||||||
if (state.mode == FindByMode.USERNAME) {
|
if (state.mode == FindByMode.USERNAME) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.FindByActivity__enter_a_full_username),
|
text = stringResource(id = R.string.FindByActivity__enter_username_description),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
modifier = Modifier
|
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
|
@Composable
|
||||||
private fun SelectCountryScreen(
|
private fun SelectCountryScreen(
|
||||||
paddingValues: PaddingValues,
|
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 = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6566,7 +6566,7 @@
|
||||||
<!-- Entry placeholder for find by phone number -->
|
<!-- Entry placeholder for find by phone number -->
|
||||||
<string name="FindByActivity__phone_number">Phone number</string>
|
<string name="FindByActivity__phone_number">Phone number</string>
|
||||||
<!-- Help text under user entry for find by username -->
|
<!-- 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 -->
|
<!-- Content description for next action button -->
|
||||||
<string name="FindByActivity__next">Next</string>
|
<string name="FindByActivity__next">Next</string>
|
||||||
<!-- Placeholder text for search input for selecting country code -->
|
<!-- Placeholder text for search input for selecting country code -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue