TradeMe / MapMe

The Android maps adapter
MIT License
841 stars 75 forks source link

`attach` now accepts a nullable `View` as it internally is used safely #35

Open c-b-h opened 4 years ago

c-b-h commented 4 years ago

The mapView is treated as Nullable throughout MapMeAdapter but when attaching, only a NonNull View is accepted. Even as SupportMapFragment is inflated in a parent's onCreateView, upon configuration changes onMapReady might be called before onCreateView of the parent so if the attaching is done in onMapReady the only possible valid View to pass is the one fetched by requireView() but that View has yet not been created and an IllegalException will be thrown.

Instead if getView() that is Nullable would be allowed, things would work out.