galex
07/29/2020, 8:21 PM@Composable
fun ProfileScreen(userUid: String) {
val userRepository = UserRepository()
val user = mutableStateOf<User?>(null)
launchInComposition {
user.value = userRepository.get(userUid)
Log.d(TAG, "url = ${user.value?.profileUrl}")
}
user.value?.profileUrl?.let { CoilImage(data = it) } ?: Text("No Image!")
}
brandonmcansh
07/30/2020, 1:03 AMYashovardhan
07/30/2020, 1:29 PMAdapterList
when items are added/removed/moved
I have a simple tasks list function where checked items move to the bottom. However, it happens almost instantly without any delay at all.
@Composable
fun TaskList(taskHandler: TaskHandler) {
AdapterList(data = taskHandler.list.sortedBy { it.isChecked }) {
TaskItem(task = it, taskHandler = taskHandler)
}
}
Mehdi Haghgoo
07/30/2020, 6:07 PMHorv
07/30/2020, 8:00 PMbrandonmcansh
07/30/2020, 9:37 PMBrett Best
07/30/2020, 10:06 PMDima Avdeev
07/30/2020, 10:22 PMDevesh Sanghvi
07/31/2020, 12:30 AMfun CustomBottomDrawerLayout(
drawerState: DrawerState,
onStateChange: (DrawerState) -> Unit,
gesturesEnabled: Boolean = true,
drawerShape: Shape = MaterialTheme.shapes.large,
drawerElevation: Dp = DrawerConstants.DefaultElevation,
drawerContent: @Composable() () -> Unit,
bodyContent: @Composable() () -> Unit
) {
Can I calculate the height of the drawerContent?brandonmcansh
07/31/2020, 2:17 AMWithConstraints
might get you there I would thinkbrandonmcansh
07/31/2020, 12:18 PMLoboda Deni
07/31/2020, 12:33 PMabstract class BaseState(
private val textState: String
) {
@Composable
fun render() {
Text(
modifier = Modifier.padding(8.dp),
text = textState
)
renderChild()
}
@Composable
protected abstract fun renderChild()
}
I get an error: e: java.lang.IllegalStateException: Cannot find the Composer classPhilip Blandford
07/31/2020, 12:40 PM@Composable
private fun QuickView() {
Box(Modifier.wrapContentSize(), border = Border(2.dp, Color.Black)) {
Canvas(modifier = Modifier.size(200.dp, 200.dp)) {
val scale = 1f
scale(scale) {
drawCircle(Color.Green, 100f, Offset(100f, 100f))
}
}
}
Putting the scale at 0.5f however reduces the radius as expected, but increases the center offset.Loboda Deni
07/31/2020, 1:04 PMSiyamed
07/31/2020, 4:47 PMZach Klippenstein (he/him) [MOD]
07/31/2020, 5:08 PMonValueChanged
should not be used to change the value of the text field to anything other than what the IME sent. This implies it shouldn't be used to implement something like InputFilter
for eg phone numbers. Is this a temporary limitation, or is there a plan to address this use case another way?galex
07/31/2020, 5:54 PMgalex
07/31/2020, 6:28 PM.fillMaxSize()
by default is giving me headaches. I’m so used to create a layout and it being set to match_parent
/ match_parent
, it is mind blowing!
This piece of gold helps me a lot:
fun <http://Modifier.help|Modifier.help>() = drawBackground(Color.Red)
KamilH
07/31/2020, 7:16 PM0.1.0-dev14
version, because in the project I’m using SQLDelight also which is not ready for Kotlin 1.4. Here is the log I’m getting when trying to compile:
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
w: /Users/kamilh/.gradle/caches/transforms-2/files-2.1/04a413422729efc3d813c1e8dc458522/jetified-kotlin-stdlib-common-1.3.72.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: /Users/kamilh/.gradle/caches/transforms-2/files-2.1/73c968e8b7f491e4cb989ea68f190ec5/jetified-kotlin-stdlib-jdk8-1.3.72.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: /Users/kamilh/.gradle/caches/transforms-2/files-2.1/c8b4b27cd3b0ad6090a0f2b1484265be/jetified-kotlin-stdlib-jdk7-1.3.72.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
w: /Users/kamilh/.gradle/caches/transforms-2/files-2.1/f52a3d8d13292768bb64d9bd79c13058/jetified-kotlin-stdlib-1.3.72.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4
I don’t understand what require 1.4 versionhuannguyen
08/01/2020, 5:26 AMCompose
into an existing project. Trying to answer some questions like is it possible to create a new Compose-based Fragment
in a multi-tab Activity
and in general how such integration would look like. I notice most of the Jetpack examples right now are Fragment-free so wondering if that is even doable. If anyone has gone through a similar journey can you please give me some pointers? ThanksAfzal Najam
08/01/2020, 6:42 AMACTION_VIEW
Intent with a Uri) and then press back to come back to my compose-based app, the Composable parts aren't recomposed.
The containing activity gets onStart and onResume called as expected. Does that mean I should be creating my app in onStart instead of onCreate?
Or is there a way to detect this from within composables? I'm expecting a state change upon returning to the app, based on something that happens in the activity's onStop when the app loses focus.
Edit: Is the right way to use LiveData.observeAsState()
? It seems like that works.
StateFlow.collectAsState()
didn't work as well, seems like some weird race condition in my code.galex
08/01/2020, 6:54 AM.dp
on a TextStyle
? Bold of Compose to fight directly the designers of the world 😂
Text(
text = "Save this dough recipe!",
style = TextStyle(fontSize = 16.dp) // doesn't compile
)
MBegemot
08/01/2020, 9:13 AMLoboda Deni
08/01/2020, 9:15 AMmzgreen
08/01/2020, 9:29 AMandylamax
08/01/2020, 12:43 PM@Compose
) instead of making compose a reserved word, similar to suspend functions?
Knowing this was much influenced by JB, if the annotations approach seemed more convenient, why didn't they go with it for suspend functions? (i.e @Suspend
)divyanshunegi
08/01/2020, 10:43 PMamar_1995
08/02/2020, 4:08 AMgalex
08/02/2020, 5:56 AMYashovardhan
08/02/2020, 8:56 AMYashovardhan
08/02/2020, 8:56 AMCheckbox(
checked = task.isChecked, onCheckedChange = {
taskHandler.checkItem(task)
}, color = MaterialTheme.colors.secondary,
modifier = Modifier.gravity(Alignment.CenterVertically)
)
And the theme is a simple MaterialTheme with colors = darkColorPalette()
Nader Jawad
08/02/2020, 7:05 PMYashovardhan
08/03/2020, 7:12 AMmatvei
08/03/2020, 9:59 AMYashovardhan
08/03/2020, 12:17 PM