Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added OnCameraChangeDownstreamListener to allow camera changes to be propagated. #27

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public void onCameraChange(CameraPosition newPosition) {
host.onClusteringCameraChange();
}
}

if (options.getOnCameraChangeDownstreamListener() != null) {
options.getOnCameraChangeDownstreamListener().onCameraChange(newPosition);
}

}

public void setDirty(long when) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.twotoasters.clusterkraf;

import com.google.android.gms.maps.GoogleMap;

/**
* Because Clusterkraf must set its own OnCameraChangeListener on the
* GoogleMap it is managing, and because the GoogleMap can only have one
* OnCameraChangeListener, Clusterkraf passes the event downstream to its
* users.
*/
public interface OnCameraChangeDownstreamListener extends GoogleMap.OnCameraChangeListener {
}
16 changes: 15 additions & 1 deletion library/src/com/twotoasters/clusterkraf/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class Options {
*/
private MarkerOptionsChooser markerOptionsChooser;

/**
* The OnCameraChangeDownstreamListener to receive callbacks when the map camera
* changes.
*/
private OnCameraChangeDownstreamListener onCameraChangeDownstreamListener;

/**
* The OnMarkerClickDownstreamListener to receive callbacks when a marker is
* clicked
Expand Down Expand Up @@ -367,7 +373,15 @@ public void setProcessingListener(ProcessingListener processingListener) {
this.processingListener = processingListener;
}

public enum ClusterClickBehavior {
public OnCameraChangeDownstreamListener getOnCameraChangeDownstreamListener() {
return onCameraChangeDownstreamListener;
}

public void setOnCameraChangeDownstreamListener(OnCameraChangeDownstreamListener onCameraChangeDownstreamListener) {
this.onCameraChangeDownstreamListener = onCameraChangeDownstreamListener;
}

public enum ClusterClickBehavior {
ZOOM_TO_BOUNDS, SHOW_INFO_WINDOW, NO_OP
}

Expand Down