Skip to content

Commit 42e8df3

Browse files
authored
Merge pull request #1 from jeffdgr8/conditional-screen-based-algorithm-wrap
Don't wrap Algorithm if already implements ScreenBasedAlgorithm
2 parents 4a34125 + 2e288b8 commit 42e8df3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/src/com/google/maps/android/clustering/ClusterManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ public void setRenderer(ClusterRenderer<T> view) {
111111
}
112112

113113
public void setAlgorithm(Algorithm<T> algorithm) {
114-
setAlgorithm(new ScreenBasedAlgorithmAdapter<T>(algorithm));
114+
if (algorithm instanceof ScreenBasedAlgorithm) {
115+
setAlgorithm((ScreenBasedAlgorithm) algorithm);
116+
} else {
117+
setAlgorithm(new ScreenBasedAlgorithmAdapter<T>(algorithm));
118+
}
115119
}
116120

117121
public void setAlgorithm(ScreenBasedAlgorithm<T> algorithm) {

0 commit comments

Comments
 (0)