Skip to content

Commit d75a651

Browse files
committed
Get clouds by attribute
1 parent 8721819 commit d75a651

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ apply plugin: 'kotlin-android'
44
apply plugin: 'kotlin-android-extensions'
55

66
group = 'com.kylecorry'
7-
version = '2.3.1'
7+
version = '2.4.0'
88

99
android {
1010
compileSdkVersion 30
1111

1212
defaultConfig {
1313
minSdkVersion 23
1414
targetSdkVersion 30
15-
versionCode 33
15+
versionCode 34
1616
versionName version
1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818
}

app/src/main/java/com/kylecorry/trailsensecore/domain/weather/WeatherService.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,16 @@ class WeatherService : IWeatherService {
137137
override fun getCloudHeightRange(height: CloudHeight, location: Coordinate): HeightRange {
138138
return cloudService.getCloudHeightRange(height, location)
139139
}
140+
141+
override fun getCloudsByShape(shape: CloudShape): List<CloudType> {
142+
return cloudService.getCloudsByShape(shape)
143+
}
144+
145+
override fun getCloudsByHeight(height: CloudHeight): List<CloudType> {
146+
return cloudService.getCloudsByHeight(height)
147+
}
148+
149+
override fun getCloudsByColor(color: CloudColor): List<CloudType> {
150+
return cloudService.getCloudsByColor(color)
151+
}
140152
}

app/src/main/java/com/kylecorry/trailsensecore/domain/weather/clouds/CloudService.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,16 @@ class CloudService : ICloudService {
5858
}
5959
}
6060

61+
override fun getCloudsByShape(shape: CloudShape): List<CloudType> {
62+
return CloudType.values().filter { it.shape.contains(shape) }
63+
}
64+
65+
override fun getCloudsByHeight(height: CloudHeight): List<CloudType> {
66+
return CloudType.values().filter { it.height.contains(height) }
67+
}
68+
69+
override fun getCloudsByColor(color: CloudColor): List<CloudType> {
70+
return CloudType.values().filter { it.colors.contains(color) }
71+
}
72+
6173
}

app/src/main/java/com/kylecorry/trailsensecore/domain/weather/clouds/ICloudService.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ import com.kylecorry.trailsensecore.domain.geo.Coordinate
55
interface ICloudService {
66
fun getCloudPrecipitation(cloud: CloudType): CloudWeather
77
fun getCloudHeightRange(height: CloudHeight, location: Coordinate): HeightRange
8+
fun getCloudsByShape(shape: CloudShape): List<CloudType>
9+
fun getCloudsByHeight(height: CloudHeight): List<CloudType>
10+
fun getCloudsByColor(color: CloudColor): List<CloudType>
811
}

0 commit comments

Comments
 (0)