Michal Bacik
10/30/2019, 9:54 PMkatz
10/30/2019, 11:28 PMonLayout
onMeasure
or so. Is it just a single view with 'draw' instructions genereated by compose?
2) Am i righre +memo
- just cache for some kind of date to reuse and not to stere in memory twise, +state
-some kind of 'model' that reatain state regardless activity state. And what is differences in thoseMichal Bacik
10/31/2019, 1:51 PMposts
.
This may work fine for simple app, but for complex app, the in-app widgets should be reusable and independent on some global state.
Rather the data on which widget works should be passed as parameters.
Even codelabs mention this: https://codelabs.developers.google.com/codelabs/jetpack-compose-basics/#4
I suggest that you keep actual posts: List<Post>
as property of MainActivity
(or its persisten state if needed), and pass this to widgets in parameters. Accessing global variables in widgets is antipattern by my opinion.
I tried and it's easy achievable.
class MainActivity : AppCompatActivity() {
private val posts: List<Post> = listOf(
...
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// load or transform posts
val posts = getPostsWithImagesLoaded(posts, resources)
setContent {
JetnewsApp(posts)
}
}
}
Same for topics
and other globals.romainguy
10/31/2019, 2:13 PMMichal Bacik
10/31/2019, 2:36 PMView
has Context
which allows to load resources (strings, images), read configuration or even get Application
object. Now I wonder if similar context may be there automatically, or we must pass it ourselves as paramater?katz
10/31/2019, 3:19 PMGrigorii Yurkov
10/31/2019, 6:19 PM@Deprecated
?Giorgos Neokleous
10/31/2019, 7:51 PMe: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Michal Bacik
10/31/2019, 8:19 PM@Composable
functions (or result that they create on UI tree)?
Widget, node, component or else?romainguy
10/31/2019, 8:24 PMfengdai
11/01/2019, 3:08 AMmeasurement
and intrinsic measurement
?Manuel Wrage
11/01/2019, 10:32 AMManuel Wrage
11/01/2019, 10:37 AMIonut Costan
11/01/2019, 11:51 AMLuca Nicoletti
11/01/2019, 12:24 PM@Preview
annotation is not available in android-x-master
repo, is it? Just synced, AS 4.0 is now bundled 👏🏼themishkun
11/01/2019, 2:48 PMLuca Nicoletti
11/01/2019, 3:51 PMaballano
11/01/2019, 4:12 PMaballano
11/01/2019, 6:35 PMdambakk
11/02/2019, 1:55 PMGrigorii Yurkov
11/03/2019, 4:44 PMvoddan
11/03/2019, 6:48 PMSaiedmomen
11/03/2019, 7:58 PMbmo
11/04/2019, 9:00 AM@Composable
functions as top level functions. but it brings a weird behavior.
Before, those functions were part of MainActivity
and the behavior was the one you can see in attachment.
Meaning, when I would change a TextField
, it would stay focused.
If I move the function as top level functions, it adds a new line on top but keep it focused on the empty one. The only difference between the two are were the functions are. Can somebody explain ?
PS : I have tried adding @Pivotal
or key(position) { ... }
around the Entry
but it doesn't change anything.dimsuz
11/04/2019, 10:56 AMDrawImage
component name feels a bit weird when used in a declarative framework. It sounds like a command to be executed rather than something describing a component. Following this we should've had DrawText
instead of Text
, no? 🙂
• Column(modifier = ...)
. Here modifier
also feels like a name that is way too generic. I mean isn't each and every argument of Column
component a modifier in some sense (it modifies its behavior/view)? I wish it would be more specific into what exactly it modifiesromainguy
11/04/2019, 11:04 AMBlundell
11/04/2019, 1:45 PM.toDp()
are we going to get a toDip()
? 😆 did anyone raise this at the time? 🙂louiscad
11/04/2019, 3:11 PMBruno_
11/04/2019, 6:31 PMadd
to ModelList
reloads the view, no? Because of that while the items are being loaded the app lags quite a lot, do I have to implement something like a pagination myself or is there a way to optimize such thing out of the box?nglauber
11/05/2019, 1:51 AMDrawVector
alignment. I’m not sure if it is related but, I’m trying to do this:
FloatingActionButton(
onClick = { ... }
) {
DrawVector(+vectorResource(R.drawable.ic_baseline_add))
}
The icon (which is an vector
drawable) is aligned on the top left.
And using this code is throwing an exception.
FloatingActionButton(
icon = imageFromResource(resources, R.drawable.ic_baseline_add),
onClick = { ... }
)
My suggestion would be:
1) the icon
parameter supports a vector
drawable; or
2) Image
component supports a vector
drawable.nglauber
11/05/2019, 1:51 AMDrawVector
alignment. I’m not sure if it is related but, I’m trying to do this:
FloatingActionButton(
onClick = { ... }
) {
DrawVector(+vectorResource(R.drawable.ic_baseline_add))
}
The icon (which is an vector
drawable) is aligned on the top left.
And using this code is throwing an exception.
FloatingActionButton(
icon = imageFromResource(resources, R.drawable.ic_baseline_add),
onClick = { ... }
)
My suggestion would be:
1) the icon
parameter supports a vector
drawable; or
2) Image
component supports a vector
drawable.Andrey Kulikov
11/05/2019, 11:35 AMnglauber
11/05/2019, 12:36 PMAndrey Kulikov
11/05/2019, 1:04 PMnglauber
11/05/2019, 3:26 PM