Skip to content

Commit 6eee81c

Browse files
committed
Add new removePaths api which takes a predicate which operates on path id
1 parent bd02443 commit 6eee81c

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

Readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ There's an example in the demo app.
7575

7676
Add this to your module's build.gradle
7777
```groovy
78-
implementation 'ovh.plrapps:mapcompose:2.16.0'
78+
implementation 'ovh.plrapps:mapcompose:2.16.1'
7979
```
8080

8181
Starting with v.2.4.1, the library is using the

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
mavenCentral()
1111
}
1212
dependencies {
13-
classpath 'com.android.tools.build:gradle:8.8.2'
13+
classpath 'com.android.tools.build:gradle:8.9.1'
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1515

1616
// NOTE: Do not place your application dependencies here; they belong
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Wed Apr 21 20:01:30 CEST 2021
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

mapcompose/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=ovh.plrapps
2-
VERSION_NAME=2.16.0
2+
VERSION_NAME=2.16.1
33
ARTIFACT_ID=mapcompose
44

55
POM_NAME=MapCompose

mapcompose/src/main/java/ovh/plrapps/mapcompose/api/PathApi.kt

+7
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ fun MapState.removeAllPaths() {
145145
pathState.removeAllPaths()
146146
}
147147

148+
/**
149+
* Remove paths given a predicate which operates on path id.
150+
*/
151+
fun MapState.removePaths(predicate: (id: String) -> Boolean) {
152+
pathState.removePaths(predicate)
153+
}
154+
148155
/**
149156
* Check whether a path was already added or not.
150157
*

mapcompose/src/main/java/ovh/plrapps/mapcompose/ui/state/PathState.kt

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ internal class PathState(
6565
pathState.clear()
6666
}
6767

68+
fun removePaths(predicate: (String) -> Boolean) {
69+
val iter = pathState.iterator()
70+
for ((id, _) in iter) {
71+
if (predicate(id)) iter.remove()
72+
}
73+
}
74+
6875
fun updatePath(
6976
id: String,
7077
pathData: PathData? = null,

0 commit comments

Comments
 (0)