So when using AndroidView in the latest release, i...
# compose
b
So when using AndroidView in the latest release, is there a way to get the view to “update”? Say for instance I’m using a custom AndroidView from a library that has buttons, changing text, whatever, compose will never recompose those views. They just have the last state (or sometimes the initial state) when it was drawn last. A good example is ExoPlayer’s PlayerView (which has the built in PlayerController which is never updated with information about the currently playing video. (The surface view works great though).
j
you can pass
postInflationCallback
lambda to
AndroidView
which gets passed view which you can potentially use to do update. Doing something similar right now for
AndroidView
that wraps a
SupportMapFragment
(though still have a few things still to figure out as well)
b
Hmm, it seems postInflationCallback is only available when using a resource id. I’m using a standalone view. That might work for the initial update, but any ideas on updates that happen on the view afterwords?
a
our medium-term intention here is to have the configuration block observe snapshot updates and re-run when needed like the rest of compose
I think that's not hooked up just yet
b
Ohhhh ok. That sounds interesting. Any ideas when that might land?
a
Not sure. Some of the work that landed in the last couple of weeks around
emit
vs. the old special syntax for it is likely to impact how it ends up working
m
In a similar vein, im trying to add android:windowSoftInputMode adjustResize to AndroidView holding a WebView because when the keyboard is visible the webview doesnt scroll up or resize, is there a way to currently achieve this with AndroidView?
b
I think this might be related to this: https://issuetracker.google.com/issues/159838005 @Madhava
m
Maybe. Mine works fine, I can type into input boxes and scroll etc, albeit a little laggy, but im just wondering how would i do the normal android "hide keyboard" on webview pattern if its an xml attribute. Should I create an XML view in actual xml first and then load that rather than just programatically instantiating a WebView like the above link?