Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fix dialog fragment setup, add regression test #14036

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Mar 5, 2019

Closes #14025, next to fixing the sample code, I added a test to catch regressions.

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Mar 5, 2019
@tobrun tobrun self-assigned this Mar 5, 2019
@tobrun tobrun requested a review from LukasPaczos March 5, 2019 11:06
@androideveloper
Copy link

Isn't this PR solving just sample usage case inside Activity? My case was a bit different. I'm using SupportMapFragment inside DialogFragment as a child fragment. I've attached demo project in the issue description.

@tobrun
Copy link
Member Author

tobrun commented Mar 6, 2019

Isn't this PR solving just sample usage case inside Activity? My case was a bit different. I'm using SupportMapFragment inside DialogFragment as a child fragment. I've attached demo project in the issue description.

This PR is solving an issue with our DialogFragment sample. Adding a map to a dialogfragment is as shown in the code a bit of a hack. DialogFragment doesn't follow the lifecycle in a same way as normal fragment and that is why we have to override the dismiss callback to do our cleanup. See here. Adding such a setup might work for this inner child fragment setup but again, it's more of a hack as a solution.

@tobrun tobrun merged commit 500080e into master Mar 6, 2019
@tobrun tobrun deleted the tvn-dialog-framgent-fix branch March 6, 2019 13:22
@androideveloper
Copy link

But how to do a hack for my case? I'm using extending SupportMapFragment, all lifecycle methods are controlled by the fragment. Also I have tried to debug my dialog and all lifecycle methods of the fragment are called for my map fragment, but it still freezes in onDestroyView. Isn't this a bug of SupportMapFragment? I do the same setup for Google Maps and it works without any issues.

@androideveloper
Copy link

I have tried to implement hacky logic, but still the same. Even if I call of lifecycle methods of map inside my parent dialog fragment onDismiss, still the same freeze. What is causing freeze actually? It's somewhere inside native C++ code as I guess.

@tobrun
Copy link
Member Author

tobrun commented Mar 22, 2019

@androideveloper found the root cause, added code similar to your setup as regression test in #14127

@androideveloper
Copy link

@tobrun Great! Thanks for the update! When are you planning to release it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapView.onDestroy() freezes at nativeDestroy when map is used inside dialog fragment
3 participants