Akram Bensalem
07/02/2022, 9:37 AMandroidx.compose.ui:ui:1.3.0-alpha01
even with version 1.2.0-rc03 I face same problem
kotlinforandroid
07/02/2022, 1:28 PMnlindberg
07/02/2022, 1:35 PModay
07/02/2022, 6:25 PMclass MainActivity @Inject constructor() : ComponentActivity() {
private val viewModel: MainViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
if (viewModel.uiState.collectAsState().value.authenticated) {
Home()
} else {
Authentication()
}
}
}
}
this authenticated
field is going to change to true
or false
inside the viewModel depending if the user is authenticated or not
the above code will first come up with false for that field, showing the Authentication composable and then the change will happen triggering the recomposition and then it will come up with true and show the Home composable
how do I listen
to changes for that field, is the above even correct or how things should be done?kotlinforandroid
07/02/2022, 6:33 PMTheme -> ModalBottomSheetLayout -> Scaffold(bottomBar, topBar) -> NavHost
. I use the same TopBar
to prevent flickering. I was now wondering how I can propagate click events down to the correct screen that is currently displayed with NavHost
. To use the good old todo example:
When the user clicks a note they enter the EditNoteScreen
. The SmallAppTopBar
checks if the current route is edit-note
and if so, adds an action to delete the note. However, the press happens on the TopBar level which is "more upwards" then the EditNoteScreen
. And only the ViewModel of that screen knows the current note that gets edited.
The toplevel that contains the Theme -> ... -> Scaffold
does not even have a ViewModel. Until now it has been completely dump.Jitendra
07/03/2022, 10:02 AModay
07/03/2022, 1:07 PMDaniel Okanin
07/03/2022, 4:23 PMstable class ProViewModelItem {
unstable val profileImage: ImageDescriptor?
unstable val coverImage: ImageDescriptor?
stable val numReviews: Int
stable val reviewRating: Float
}
This is how I declare this class:
@Stable
class ProViewModelItem(
id: String?, title: String?,
val profileImage: ImageDescriptor? = null,
val coverImage: ImageDescriptor? = null,
val numReviews: Int = 0,
val reviewRating: Float = 0f,
) : HomeFeedViewModelItem(id, title)
Berkeli Alashov
07/04/2022, 1:15 AMinterface ColorSpec {
@Composable
operator fun invoke(): Color
companion object {
fun fromColor(lightVariant: Color, darkVariant: Color): ColorSpec = object : ColorSpec {
@Composable
override fun invoke(): Color = if (Theme.isDarkTheme) darkVariant else lightVariant
}
}
}
Frank van der Laan
07/04/2022, 10:20 AMpopUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
as a result, my tab's ViewModels is not cleared when switching tabs. That's good. But let's say the user now logs out and I want to clear this ViewModel after all. How do I do so? Popping all screens from the backstack will clear all their ViewModels, but this screen is not in the backstack anymore.Alex
07/04/2022, 11:42 AMJonas Frid
07/04/2022, 12:41 PMste
07/04/2022, 3:04 PMVelocityTracker::calculateVelocity
to determine whether complete the swipe at the end of a drag gesture or not. I just don't understand why it returns velocities with opposite signs upon very similar drag gestures...Vaios Tsitsonis
07/04/2022, 3:58 PMtestTag
used only for testing? Is it included in production code or is it somehow removed?Lilly
07/04/2022, 5:07 PMRow
composable be done better? I'm also asking because I coudn't access the nested weight and had to use fillMaxWidth(fraction = 0.Xf)
instead.
Without the nested Row, I'm not able to fix the position of the second Spacer
at ~0.7f. The second Spacer should look like it is horizontally aligned to Start
.
Screenshot -> in Thread.Colton Idle
07/05/2022, 12:03 AMTitouan
07/05/2022, 7:49 AMMjahangiry75
07/05/2022, 8:22 AMComposable
, I have a NumberPicker
(traditional View
)
If I want to make `NumberPicker`'s font the same as `Compose`'s, how can I do that?kotlinforandroid
07/05/2022, 11:42 AMScaffold
? I always compared it to AppBarLayout
but it seems that it is OK to nest Scaffolds
. Even Now In Android does it. https://github.com/android/nowinandroid. It Scaffold
just a special kind of Column
following some Material design parameters?Rihards
07/05/2022, 11:45 AMste
07/05/2022, 3:21 PMHorizontalPager
scroll (via userScrollEnabled
) when the user started a LazyColumn
scroll (and vice versa)? Do I need to write a complex NestedScrollConnection
?vgonda
07/05/2022, 3:48 PMComposeTest
the lifecycle aware composer is replaced with one controlled by the test? As far as I can tell, this makes it such that things aren't disposed when they would be outside a test environment, and it's causing us memory leaks in the test. More details in the thread.Matti MK
07/05/2022, 6:17 PMnavigation(
route = "routeToNavigateTo",
startDestination = "startDestination/{argument}"
) {
composable(route = "startDestination/{argument}" ... ) { ... }
}
Vaios Tsitsonis
07/05/2022, 10:24 PMdarkmoon_uk
07/06/2022, 1:45 AMAhmed Shehata
07/06/2022, 1:20 PMgalex
07/06/2022, 2:02 PMText
to the start of the Text
as label in a TextField
?
@Composable
fun SomeTextField(
label: String,
) {
TextField(
label = {
Text( // text label here
text = label
)
}
)
Text("Here is an error text") // align this to start where the text label starts
}
🤔Zoltan Demant
07/06/2022, 3:50 PM1.3.0-alpha01
? It looks to me like the Android 12 overscroll effect is active in all directions rather than just vertically?Akram Bensalem
07/06/2022, 4:43 PMpolicyGraph()
contactUsGraph()
aboutUsGraph()
conditionOfUseGraph()
share the same "Custom Parent Layout" but the other graphs do not share that layout ?mcpiroman
07/06/2022, 5:53 PM