feat(android): change from Fragment to a normal View - #703
Conversation
There was a problem hiding this comment.
-
Important: the
MapViewrefactor only forwardsonResume()andonDestroy(), but notonStart(),onPause(),onStop(), low-memory, or saved-state callbacks. Seeandroid/src/ti/map/TiUIMapView.java:96,android/src/ti/map/TiUIMapView.java:1443, andandroid/src/ti/map/ViewProxy.java:125.titanium-sdkshows these lifecycle hooks are available on proxies, so this is a real integration gap, not a platform limitation. The result is likely leaked map resources and broken restore/background behavior after activity pause/recreate. Fix by forwarding the full activity lifecycle toMapView, and if recreation is expected to preserve state, wire instance-state callbacks through toMapView.onCreate(savedState)/onSaveInstanceState(). -
Important:
liteModeandzOrderOnTopwere creation-time options before this change, but the new code always constructs a plainnew MapView(...)and only readsliteModelater as a boolean flag. Seeandroid/src/ti/map/TiUIMapView.java:96andandroid/src/ti/map/TiUIMapView.java:250. That means both public properties are now effectively ignored, which is a behavior regression. Fix by buildingGoogleMapOptionsfrom the proxy properties before creating theMapView.
|
Thanks for the updates! Two issues are still open:
The earlier liteMode/zOrderOnTop regression and the iOS workflow SDK mismatch look fixed. |
|
Thanks for the feedback, I'll do some more tests here 👍 |
hansemannn
left a comment
There was a problem hiding this comment.
Code-wise, this looks very well now! Feel free to merge once functionally tested.
|
Hmmm... |
This reverts commit df6fa60.
|
You are right, it was inferred from the others. Would be good to expose it on the SDK side, but no blocker here anymore. |
|
|
|
Have to open it again. It looks like there still some fragment crashes with the current map in different scenarios. In one client app restarting the app with the tab group as the selected tab crashed with the |
|
If you are still fine with the changes @hansemannn I would merge this one so we can have this version for 14.0.0. After this is merged I'll update the bugfix PR #717 so it apply all the fixes to the view version and release a new version that people can use if they like (or need). And with Ti SDK 14.0.0 we'll ship this version right away. |
I think it is currently the only module that uses Fragments instead of a normal view. This had some issues before (ListView header) and it will fix tidev/titanium-sdk#14214
Also matches the same library versions as #678 (merge first for the action fixes).
Tested:
Changes:
ti.map-android-6.0.0.zip
(updated 26/07/30 - 15:40)
Lite mode check:
ListView Header/Footer example
Saved state test:
Expected with the fix: the map comes back at the position you left it, and it's still alive — panning fires regionchanged (label updates) and the Munich marker is tappable.