Isaac Udy
12/11/2019, 11:27 PMBino
12/12/2019, 10:50 AMfontStyle
and fontFamily
but can I set a specific font for a fontFamily..?Luca Nicoletti
12/13/2019, 10:43 AM@Composable fun onDispose(callback: () -> Unit)
will this accept a @Composable
which actually returns a value now? Something like: @Composable fun disposeEverything() : Boolean
?Roar Gronmo
12/13/2019, 11:08 AMColumn
, Row
, modifier=
and Gravity
Do anyone have reasonable (sane) explanation on how I can achieve following tricky thing (see picture).
Here's the code where this layout is built, I want the "5 Center End me!" to be centered vertically (up-down) (as shown), but I can't find any reasonable way to do it in dev03, this was achievable in dev02...
@Composable
fun CardGravityTest()
{
Card(
modifier = Spacing(all = 4.dp),
color = Color.LightGray,
shape = RoundedCornerShape(
5.dp
)
){
Column {
Row {
Surface(color = Color.Red,
modifier = Spacing(all = 4.dp)) {
Text(text = "1 XX")
}
Column(modifier = Flexible(1f) wraps Expanded wraps Spacing(4.dp)){
Surface(color = Color.Green){
Text(text="2 Flexible wraps Expanded(1f) wraps Spacing(4.dp) x x xx xxx xxxx x xx xxx x xxx")
}
Surface(color = Color.Magenta){
Text(text = "3 Second line xxxxx xxx xx xxxxx xxxx")
}
}
Column() {
Surface(color = Color.DarkGray) {
Text(text = "4 Column: OK High on top!")
}
Surface(color = Color.Yellow,
modifier = Gravity.End){
Text(text = "5 Center End me!",
modifier = Gravity.End)
}
}
}
Divider()
Row (modifier = Spacing(top = 4.dp)){
Column (modifier = Flexible(1f) wraps Expanded){
Surface(color = Color.Blue, modifier = Gravity.Start) {
Text(text = "6 Row spacing top, Column Flexible(1f) wraps Expanded, Surface gravity start")
}
}
Column(modifier = Flexible(1f) wraps Expanded){
Surface(color = Color.Cyan, modifier = Gravity.End) {
Text(text = "7 Column Flexible wraps Expanded, Surface gravity end, " +
"paragraphstyle TextAlign.end ", paragraphStyle = ParagraphStyle(textAlign = TextAlign.End))
}
}
}
Row {
Surface(modifier = Spacing(all = 4.dp), color = Color.White) {
Text(text = "8 on Row")
}
Surface(modifier = Spacing(all = 4.dp), color = Color.Green)
{
Text(text = "9 on Row")
}
Column(modifier = Gravity.Center wraps Flexible(1f)){
Surface(color = Color.Red) {
Text(text = "10 col center flex, line 1")
}
Surface(color = Color.DarkGray)
{
Text(text = "11 line 2 xxxxxx")
}
}
Column(modifier = Gravity.Center wraps Expanded) {
Surface(color = Color.Magenta, modifier = Gravity.End) {
Text(text = "12 col cnt mod end")
}
}
}
}
}
}
Zach Klippenstein (he/him) [MOD]
12/13/2019, 6:35 PMui-android-view-non-ir
artifact, which is not published to Maven.
Is it actually possible to do this integration with the artifacts that are currently published?Leland Richardson [G]
12/13/2019, 6:38 PMBryan Lee
12/13/2019, 6:48 PMSlackbot
12/13/2019, 10:00 PMitnoles
12/14/2019, 2:56 AMIsaac Udy
12/14/2019, 5:23 AM@Composable fun Foo(x: Int){
val bar: @Composable() (@Composable() ()->Unit) -> Unit = if(x == 1) ::BooFar else ::FooBar
bar {
val stable = +memo { UUID.randomUUID().toString() }
Text(text = stable)
}
}
Roar Gronmo
12/14/2019, 1:38 PMTextView
on baseline (text baseline app:layout_constraintBaseline_toBaselineOf
), is/will this be possible in @Compose ?Jon
12/14/2019, 3:13 PMYang
12/15/2019, 5:04 AMpublic interface JavaInterface {
// this only happens when the method returns void
void test();
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
GlobalScope.launch {
test()
}
}
}
suspend fun test() {
withContext(Dispatchers.Default) {
// sam conversion won't compile
val listener1 = JavaInterface {
println("")
}
// this works
val listener2 = object : JavaInterface {
override fun test() {
println("")
}
}
}
}
msink
12/15/2019, 12:08 PMcompose-runtime
by Kotlin/Native?
I did quick and dirty port, and it more or less worksBryan Lee
12/16/2019, 6:04 PMval icon = +imageResource(R.drawable.ic_my_location_white_24dp)
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
Something to note: Using setViewContent instead of setContent since I'm using a custom map view
class MainActivity : AppCompatActivity() {
val mapContext = MapContext()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setViewContent {
AppTheme {
MapStack(mapContext = mapContext)
}
}
}
}
@Composable
fun MapStack(webMap: WebMap = WebMap(), mapContext: MapContext) {
Stack {
MapComponent(mapContext = mapContext, map = webMap.map)
aligned(Alignment.BottomRight){
val icon = +imageResource(R.drawable.ic_my_location_white_24dp)
FloatingActionButton(
icon = icon,
modifier = Spacing(left = 8.dp, top = 8.dp, right = 20.dp, bottom = 48.dp)
)
}
}
}
Zsolt
12/16/2019, 6:24 PMRoar Gronmo
12/16/2019, 6:38 PMTimo Drick
12/17/2019, 1:16 AM@Model
Test(var test: String)
the Compose framework will observe it and recompose the UI when it changes.
Can i also observe this class in my custom code outside of a @Composable function?Bryan Lee
12/17/2019, 7:33 PMprivate fun WebView.setRef(ref: (WebView) -> Unit) {
ref(this)
}
Taken from ui/ui-android-view/src/main/java/androidx/ui/androidview/WebComponent.ktZsolt
12/17/2019, 8:56 PMBryan Lee
12/17/2019, 11:08 PMval context = +ambient(ContextAmbient)
from a composable nested within setViewContent{ }?
Currently seem to be getting an NPE because of this.
Is there an alternative way of getting context?
EDIT: Currently I'm doing this from my activity to get context to a listener into my composable function.
val context: Context = this
setViewContent {
MapApp(context = context)
}
Bryan Lee
12/18/2019, 6:28 PMLeland Richardson [G]
12/19/2019, 11:12 PMcodeslubber
12/19/2019, 11:22 PMMark Haehnel
12/20/2019, 9:28 AMDrew Hamilton
12/20/2019, 4:29 PMLike Slack’s.This is what I was expecting to work:
Row {
ColoredRect(
color = (+MaterialTheme.colors()).onSurface.copy(alpha = 0.12f),
width = 4.dp
)
Space(Width(8.dp))
Text(toDo.text)
}
But what happens is that the ColoredRect
expands infinitely in height, pushing any elements below the row out of sight.
I’m using it as the text
element in an AlertDialog
. What am I doing wrong?Bryan Lee
12/20/2019, 10:36 PMRoar Gronmo
12/21/2019, 7:22 AMZsolt
12/22/2019, 2:41 PMdimsuz
12/22/2019, 6:28 PMdimsuz
12/22/2019, 6:28 PMAdam Powell
12/22/2019, 6:40 PM