jw
05/27/2020, 12:28 AMbasher
05/28/2020, 2:32 AMbasher
05/28/2020, 2:33 AMbasher
05/28/2020, 2:34 AMSean Najera
06/05/2020, 11:42 PMjw
06/05/2020, 11:44 PMCharles
06/09/2020, 1:51 PMjw
06/09/2020, 2:06 PMjw
06/09/2020, 2:06 PMjw
06/09/2020, 2:06 PMjrod
06/09/2020, 3:01 PMdimsuz
06/10/2020, 4:47 PMContourLayout
question. Can I somehow achive the following: child view is laid out using wrap_content
if it has width < parent.width()
but otherwise it stays at parent.width()
.
In short I want center_horizontally + width=min(width, parent.width())
.
ConstraintLayout
has some magic flags for this (layout_width=0dp + constrainedWidth + constraintWidthDefault=wrap).
I tried leftTo { parent.left() }.rightTo(sizeMode = AtMost) { parent.right() }
but this does not center the view, altough it does forbid it to grow beyond parent.
@saket lightest ping :)dimsuz
06/10/2020, 5:11 PMcenterHorizontallyTo { parent.centerX() }.widthOf(SizeMode.AtMost) { parent.width() },
It's an almost literal translation of the "in short I want" rule I've written above.
Man, ContourLayout
is awesome! 👏saket
06/11/2020, 1:26 AMsaket
06/11/2020, 1:26 AMwidthOf
and heightOf
take size modesandev
06/11/2020, 5:25 PMjw
06/11/2020, 5:30 PMandev
06/11/2020, 5:45 PMsaket
06/11/2020, 5:49 PMjw
06/11/2020, 5:56 PMjw
06/11/2020, 5:56 PMandev
06/11/2020, 6:10 PMbasher
06/12/2020, 3:35 AMandev
06/12/2020, 12:53 PMalec
06/12/2020, 12:56 PMalec
06/12/2020, 12:56 PMalec
06/12/2020, 12:56 PMandev
06/12/2020, 1:03 PMandev
06/12/2020, 1:04 PMandev
06/12/2020, 6:15 PM@JvmOverloads
fun <T : Any> Flow<Query<T>>.mapToOne(
context: CoroutineContext = Dispatchers.Default
): Flow<T> = map {
withContext(context) {
it.executeAsOne()
}
}
wouldn't it be more idiomatic to use flowOn
instead of withContext
?