bricolsoftconsulting / mapchange Goto Github PK
View Code? Open in Web Editor NEWMapChange is an Android app that shows how to extend Google Maps' MapView class to get notifications when the map has been panned, zoomed or both.
MapChange is an Android app that shows how to extend Google Maps' MapView class to get notifications when the map has been panned, zoomed or both.
After using the map buttons to zoom in or out onChange in my MapViewChangeListener no longer appears to receive events. Is this a known issue? Will try to debug further on my end.
The current implementation of the callbacks into the MyMapView.OnChangeListener pretty much guarantees that all calls an application receives will happen on the background threads constructed by java.util.Timer. This is highly bad practice, especially in the Android framework. An application should be able to count on callbacks being posted to the main thread so they can safely manipulate the UI (especially when the callback is associated with a View) and not be left to do this work through extra Handlers as the sample code does.
This application should be reworked to post onChange() to the main thread. This can even be done with the post(), postDelayed() and removeCallbacks() facilities built directly into View (and therefore, MapView) which would eliminate the need for java.util.Timer altogether.
I use the android-mapviewballoons library to show balloon popups on the map. Additionally, I would like to hide all popups when I tap on the map. The library already implements this functionality using a OnSingleTapListener
that works on a TapControlledMapView
. This can be seen in the example application project: android-mapviewballoons-example. Choose the third activity, named "Tap close / Doubletap zoom" to test the behavior.
Your library requires the map view to be a MyMapView
class. Therefore, I have problems to attach the previously mentioned OnSingleTapListener
. Could you help me to sort this out? I opened a similar issue for the android-mapviewballoons project.
I found that computeScroll is indefinitely called under certain circumstances particularly when zoomed out, which means that the timer always is reset and never fires. So I needed to modify your computeScroll() method to check how many times it had been called and only reset it if it is under a specific limit.
private int computeScrollCount = 0;
private final static int MAX_SCROLL_COUNT = 25;
@Override
public void computeScroll()
{
super.computeScroll();
// Check for change
if (isSpanChange() || isZoomChange())
{
if (computeScrollCount < MAX_SCROLL_COUNT) {
// If computeScroll called before timer counts down we should drop it and
// start counter over again but dont let this occur indefinitely
resetMapChangeTimer();
}
computeScrollCount++;
}
}
then you need to reset the computeScrollCount=0 when the Timer fires.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.