Open RobinIsTheBird opened 7 years ago
Definitely a bug in my opinion.
Shouldn't be too hard to fix I think - worst comes to worst, we can record in a member variable of the MainMapFragment
whether the camera has been moved yet, though I think we can get something cleaner than that.
The solution is to override TabLayout#onNewIntent
and specify
<activity
android:name="org.azavea.otm.ui.TabLayout"
android:launchMode="singleTop" ...
in AndroidManifest.xml
.
In this solution, in order for TabLayout
to distinguish between a change of treeMap and a Navigate Up from tree details or the filter, the switcher needs to do an intent.setData
with the uri for the new InstanceInfo
.
TabLayout#onNewIntent(intent)
needs to
setIntent
with the new intentintent.getData()
yields a uri
,
reloadInstanceInfo
or something similarInstanceInfo
callback chain, call a method on MainMapFragment
similar to its post-PR #298 onActivityCreated
method.If intent.getData()
returns null, nothing further needs to be done.
References:
As we discussed in person, this can be fixed rather easily by overriding the up-navigation handling in FilterDisplay
to go back to the existing TabLayout
activity, rather than creating a new activity.
@maurizi,
singleTop
+ onNewIntent
is the general fix to both problems. It's no bigger deal than overriding up-nav handling in FilterDisplay
, but more general.
Related to #301 (after switching tree maps, using the back button ... previous tree map). The singleTop
+ onNewIntent
fix proposed here might also fix that issue.
@dboyer, need your input on whether this is desirable behavior, but I find it unexpected and jarring, and thought I had introduced a bug until I discovered it happening in the released android app.
Visit a treemap that includes your current location. The camera pans & zooms to your current location, which is good.
Pan and zoom away from the current location.
Tap the filter button, then tap the OTM logo, AKA the Navigate Up button.
It pans/zooms to your current location again. Seems like it ought to just return to where you were on the map.
The same problem exists when navigating up from tree details.
If you have location turned off, it pans/zooms to the default location and z, even more disconcerting.