https://kotlinlang.org logo
#splitties
Title
# splitties
l

louiscad

08/28/2019, 1:05 PM
When using Views DSL for
ConstraintLayout
, would you prefer to use
below(view)
instead of
topToBottomOf(view)
,
above
instead of
bottomToTopOf
,
before
instead of
endToStartOf
and
after
instead of
startToEndOf
? I'm considering adding these into the ConstraintLayout module as aliases to the existing ones.
🚫 1
👌 3
r

ribesg

08/28/2019, 1:58 PM
before
and
after
aren’t as clearly horizontal as
below
and
above
are vertical
But yeah I think it would be better
l

louiscad

08/28/2019, 2:21 PM
I can also skip the horizontal helpers and provide only
below
and
above
.
I don't need them for now.
i

ispbox

08/28/2019, 5:01 PM
You can follow convention from Contour. For me startTo, endTo looks good (or leftTo/rightTo, but it is not good for RTL languages...)
l

louiscad

08/28/2019, 7:47 PM
I'm afraid
startTo
and
endTo
would be a little confusing among
startToStartOf
,
startToEndOf
,
endToStartOf
and
endToEndOf
. Note that
after
and
before
are already used as CSS selectors in W3C standards for WEB.
👍 1
i

ispbox

08/28/2019, 8:35 PM
Sounds reasonable!
l

louiscad

08/29/2019, 8:25 AM
I'm adding this:
Copy code
inline fun LP.before(view: View) = endToStartOf(view)
inline fun LP.above(view: View) = bottomToTopOf(view)
inline fun LP.after(view: View) = startToEndOf(view)
inline fun LP.below(view: View) = topToBottomOf(view)
I'm thinking of adding
bottomOf
,
startOf
, etc extension that would be aliases to
bottomToBottomOf
,
startToStartOf
, etc. Would you use it? Should I proceed? Or do you dislike the naming? What's now is enough?
4 Views