-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MarkerClickedEvent MapClickedEvent MapMovedEvent
- Loading branch information
Showing
6 changed files
with
162 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/de/saring/leafletmap/events/MapClickEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.saring.leafletmap.events | ||
|
||
import de.saring.leafletmap.LatLong | ||
import java.util.* | ||
|
||
/** | ||
* Handles the MapClickEvent | ||
* @author Niklas Kellner | ||
*/ | ||
interface MapClickEventListener { | ||
fun onMapClick(latLong: LatLong) | ||
} | ||
|
||
internal class MapClickEventMaker { | ||
private val listeners = ArrayList<MapClickEventListener>() | ||
|
||
fun addListener(toAdd: MapClickEventListener) { | ||
listeners.add(toAdd) | ||
} | ||
|
||
fun MapClickEvent(latLong: LatLong) { | ||
// Notify everybody that may be interested. | ||
for (hl in listeners) | ||
hl.onMapClick(latLong) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/de/saring/leafletmap/events/MapMoveEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package de.saring.leafletmap.events | ||
|
||
import de.saring.leafletmap.LatLong | ||
import java.util.* | ||
|
||
/** | ||
* Handles the MapMoveEvent | ||
* | ||
* @author Niklas Kellner | ||
*/ | ||
interface MapMoveEventListener { | ||
fun onMapMove(center: LatLong) | ||
} | ||
|
||
internal class MapMoveEventMaker { | ||
private val listeners = ArrayList<MapMoveEventListener>() | ||
|
||
fun addListener(toAdd: MapMoveEventListener) { | ||
listeners.add(toAdd) | ||
} | ||
|
||
fun MapMoveEvent(latLong: LatLong) { | ||
// Notify everybody that may be interested. | ||
for (hl in listeners) | ||
hl.onMapMove(latLong) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/kotlin/de/saring/leafletmap/events/MarkerClickEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.saring.leafletmap.events | ||
|
||
import java.util.* | ||
|
||
/** | ||
* Handles the MarkerClickEvent | ||
* | ||
* @author Niklas Kellner | ||
*/ | ||
interface MarkerClickEventListener { | ||
fun onMarkerClick(title: String) | ||
} | ||
|
||
internal class MarkerClickEventMaker { | ||
private val listeners = ArrayList<MarkerClickEventListener>() | ||
private var listenerSet = false | ||
|
||
fun addListener(toAdd: MarkerClickEventListener) { | ||
listeners.add(toAdd) | ||
listenerSet = true | ||
} | ||
|
||
fun MarkerClickEvent(title: String){ | ||
// Notify everybody that may be interested. | ||
for (hl in listeners) | ||
hl.onMarkerClick(title) | ||
} | ||
|
||
|
||
fun isListenerSet(): Boolean{ | ||
return listenerSet | ||
} | ||
} |