Koneko Toujou
02/06/2023, 1:20 PMfun onAdd(v: ViewGroup, child: View) {
v.addView(child);
}
but for Composables insteadJakub Syty
02/06/2023, 1:22 PMJakub Syty
02/06/2023, 1:23 PMColumn {
Composable1()
Composable2()
}
Trym Nilsen
02/06/2023, 1:23 PMKoneko Toujou
02/06/2023, 1:23 PMJakub Syty
02/06/2023, 1:24 PMKoneko Toujou
02/06/2023, 1:24 PMJakub Syty
02/06/2023, 1:25 PMJakub Syty
02/06/2023, 1:25 PMKoneko Toujou
02/06/2023, 1:25 PMJakub Syty
02/06/2023, 1:26 PMJakub Syty
02/06/2023, 1:26 PMKoneko Toujou
02/06/2023, 1:27 PMKoneko Toujou
02/06/2023, 1:28 PMfun retText(s: String): Text {
return Text(text: s)
}
Jakub Syty
02/06/2023, 1:28 PMKoneko Toujou
02/06/2023, 1:28 PMFilip Wiesner
02/06/2023, 1:33 PMcould a function return a composable?
eg
```fun retText(s: String): Text {
return Text(text: s)
}```"Composable" is not an object - it's a function. So you could do
fun retText(s: String): @Composable () -> Unit = @Composable { Text(s) }
Koneko Toujou
02/06/2023, 1:35 PMKoneko Toujou
02/06/2023, 1:38 PMfun retText(s: String): @Composable () -> Unit = @Composable { Text(s) }
fun retBox(): @Composable () -> Unit = @Composable { Box() }
fun addTextToBox(box: @Composable () -> Unit, box: @Composable () -> Unit): @Composable () -> Unit = @Composable { box(); text(); }
could we do something like this?Jakub Syty
02/06/2023, 1:39 PMJakub Syty
02/06/2023, 1:40 PMKoneko Toujou
02/06/2023, 1:40 PMBox {
Text(s)
}
Filip Wiesner
02/06/2023, 1:41 PMKoneko Toujou
02/06/2023, 1:42 PMFilip Wiesner
02/06/2023, 1:43 PMJakub Syty
02/06/2023, 1:43 PMKoneko Toujou
02/06/2023, 1:44 PMval box = box()
val text = text("hello")
box.add(text)
display(box) // displays the constructed [box] object in compose kotlin
Filip Wiesner
02/06/2023, 1:44 PMThe whole purpose of compose is to be declarative instead of imperative. So you would be fighting yourself here
Jakub Syty
02/06/2023, 1:45 PMJakub Syty
02/06/2023, 1:45 PMJakub Syty
02/06/2023, 1:45 PMKoneko Toujou
02/06/2023, 1:46 PMJakub Syty
02/06/2023, 1:47 PMJakub Syty
02/06/2023, 1:47 PMJakub Syty
02/06/2023, 1:48 PMJakub Syty
02/06/2023, 1:48 PMKoneko Toujou
02/06/2023, 1:49 PMJakub Syty
02/06/2023, 1:49 PMJakub Syty
02/06/2023, 1:49 PMJakub Syty
02/06/2023, 1:49 PMJakub Syty
02/06/2023, 1:49 PMKoneko Toujou
02/06/2023, 1:51 PMKoneko Toujou
02/06/2023, 1:51 PMKoneko Toujou
02/06/2023, 1:52 PMJakub Syty
02/06/2023, 1:52 PMJakub Syty
02/06/2023, 1:52 PMJakub Syty
02/06/2023, 1:53 PMJakub Syty
02/06/2023, 1:53 PMKoneko Toujou
02/06/2023, 1:55 PMKoneko Toujou
02/06/2023, 1:57 PMKoneko Toujou
02/06/2023, 2:07 PMStarting October 15, 2021, Google said, "We're clarifying the Device and Network Abuse policy to prohibit apps or SDKs with interpreted languages (e.g., JavaScript) loaded at run time from violating any Google Play policies."
action against apps that "interfere with, disrupt, damage, or access in an unauthorized manner the user's device, other devices or computers, servers, networks, application programming interfaces (APIs), or services."
Fetching executable code from sources other than Google Play is also disallowed, except for code running in a virtual machine that has limited access to Android APIs, like JavaScript running in a WebView or browser.
Koneko Toujou
02/06/2023, 2:13 PMAn app distributed via Google Play may not modify, replace or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. This restriction does not apply to code that runs in a virtual machine or an interpreter where either provides indirect access to Android APIs (such as JavaScript in a WebView or browser).
Apps or third-party code (e.g. SDKs) with interpreted languages (JavaScript, Python, Lua, etc.) loaded at run time (e.g. not packaged with the app) must not allow potential violations of Google Play policies.
eygraber
02/06/2023, 2:17 PMeygraber
02/06/2023, 2:17 PMKoneko Toujou
02/06/2023, 3:28 PMJakub Syty
02/06/2023, 3:29 PMJakub Syty
02/06/2023, 3:30 PMJakub Syty
02/06/2023, 3:30 PMeygraber
02/06/2023, 3:30 PMeygraber
02/06/2023, 3:31 PMJakub Syty
02/06/2023, 3:32 PMJakub Syty
02/06/2023, 3:32 PMhfhbd
02/06/2023, 3:33 PMJakub Syty
02/06/2023, 3:33 PMJakub Syty
02/06/2023, 3:33 PMJakub Syty
02/06/2023, 3:34 PMJakub Syty
02/06/2023, 3:34 PMeygraber
02/06/2023, 3:36 PMJakub Syty
02/06/2023, 3:36 PMJakub Syty
02/06/2023, 3:38 PMJakub Syty
02/06/2023, 3:38 PMJakub Syty
02/06/2023, 3:39 PMjw
02/06/2023, 3:41 PMjw
02/06/2023, 3:42 PMjw
02/06/2023, 3:45 PMwhen
statement, and then have branches for each node type. it's the same thing you'd do with views, except instead of calling addView
you call a composable. The model objects drive the logic, whether you end up calling views, composables, println, or anything else is mostly irrelevant.eygraber
02/06/2023, 3:50 PMjw
02/06/2023, 6:04 PM