Alderson Elliot
02/12/2022, 2:03 PMbrabo-hi
02/12/2022, 9:37 PMval configuration = LocalConfiguration.current
configuration.setLocale(locale)
Doesn’t look to have any effect unless we add resources.updateConfiguration(configuration, resources.displayMetrics)
but this method looks deprecatedSam
02/12/2022, 10:47 PM@Composable
fun Greeting(name: String?) {
name?.let { Text(text = "Hello $name!") } ?: Text(text = "Hello!")
}
jasu
02/13/2022, 2:36 PMNoteList(
notes = viewmodel.notes.collectAsState().value,
onItemClick = { noteId ->
Log.e(TAG, "NotesListingScreen: noteId: $noteId clicked")
onEditNote(noteId)
}
)
@Composable
fun NoteList(notes: List<Note>, onItemClick: (String) -> Unit) {
val listState = rememberLazyListState()
LaunchedEffect(key1 = notes) { // when any item changes, scroll list to 0th index
listState.animateScrollToItem(0)
}
}
Brian Donovan
02/13/2022, 4:11 PM@RunWith(AndroidJUnit4::class)
class LoginTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>()
@Test
fun logInButtonEnabledTest() {
composeTestRule.setContent {
WHApplicationTheme {
LoginScreen({}, {}, {})
}
}
val email = "sampl"
val password = "Sa"
val isValidEmail: Boolean = EmailValidator.isValid(email)
val isValidPassword: Boolean = PasswordValidator.isValid(password)
if (isValidEmail && isValidPassword) {
composeTestRule
.onNodeWithTag(EMAIL_TEXT_FIELD)
.performTextInput(email)
composeTestRule
.onNodeWithTag(PASSWORD_TEXT_FIELD)
.performTextInput(password)
}
composeTestRule
.onNodeWithTag(LOG_IN_BUTTON)
.performClick()
}
}
interface FormValidator {
fun isValid(value: String): Boolean
}
object PasswordValidator : FormValidator {
override fun isValid(value: String): Boolean {
return value.length > 5 && !value.contains(" ")
}
}
object EmailValidator : FormValidator {
override fun isValid(value: String): Boolean {
val emailCheck = "^[A-Za-z](.*)([@])(.+)(\\.)(.+)"
return emailCheck.toRegex().matches(value)
}
}
brabo-hi
02/13/2022, 8:07 PMnavController.navigate("next") {
popUpTo("current") { inclusive = true }
}
and
navController.navigateUp()
navController.navigate("next")
gpaligot
02/13/2022, 8:17 PMExampleUiState
) as single source of truth for the UI and because you can’t pass a state as parameter inside a Composable (otherwise, lint error), does that means I’m forced to redraw my entire screen at each change of my state?
Thanks in advance for your time! :)james
02/14/2022, 4:27 AMpavankumar
02/14/2022, 8:24 AMCode snipper in the thread.
T.Ishikawa
02/14/2022, 12:27 PMErlan Amanatov
02/14/2022, 12:36 PMjasu
02/14/2022, 1:08 PMBino
02/14/2022, 2:53 PMCard
?theapache64
02/14/2022, 3:11 PMcompositionLocal
vs staticCompositionLocal
with a code snippet and output ?Chris Fillmore
02/14/2022, 3:42 PMColton Idle
02/14/2022, 5:08 PMLukasz Kalnik
02/14/2022, 5:23 PMpublic interface MutableState<T> : State<T>
A mutable value holder where reads to the value property during the execution of a Composable function, the current RecomposeScope will be subscribed to changes of that value.To be honest I feel like some words are missing from this sentence...
Lucca Beurmann
02/14/2022, 5:28 PMRavi
02/14/2022, 6:18 PMScrollableTabRow
?Chris Fillmore
02/14/2022, 8:13 PMblurRadius
required for Shadow
to be visible? I am just trying to use shadow in a TextStyle. If I don’t specify a non-zero blur radius, there is no shadow. This seems unexpected. I’d expect to be able to use shadow without blur. I’m on compose 1.2.0-alpha02
Mohan manu
02/15/2022, 5:10 AMYASAN
02/15/2022, 5:39 AMBackend Internal error: Exception during IR lowering
on the code that worked fine on my app module.Sean Proctor
02/15/2022, 8:01 AM@Composable
fun ScreenXContent() {
val focusRequester = remember { FocusRequester() }
TextField(
modifier = Modifier.focusRequester(focusRequester),
...
)
LaunchedEffect(Unit) {
focusRequester.requestFocus()
focusRequester.captureFocus()
}
}
When the user navigates away from that screen: in compose 1.0, the focus is freed and can be requested by something else; in compose 1.1, the focus is not freed and all subsequent focus requests fail. Should I be using a disposable effect to free the focus?Big Chungus
02/15/2022, 9:52 AMArchie
02/15/2022, 10:23 AMAdib Faramarzi
02/15/2022, 11:19 AMitem
in a lazy column that fills the rest of the screen with its height? (.fillMaxHeight
does not work).Vikas Singh
02/15/2022, 4:34 PMK Merle
02/15/2022, 5:55 PMjcechace
02/15/2022, 6:50 PMgalex
02/15/2022, 7:25 PMStateFlow
inside a lambda inside a @Composable
? Using rememberUpdatedState
or is there anything else I should be doing instead?