Implement plugin weather provider

This commit is contained in:
MM20
2023-12-22 01:02:13 +01:00
parent d80e4c66a4
commit 211f30170c
7 changed files with 366 additions and 9 deletions
@@ -1,5 +1,7 @@
package de.mm20.launcher2.plugin.config
import android.os.Bundle
data class WeatherPluginConfig(
/**
* Minimum time (in ms) that needs to pass before the provider can be queried again.
@@ -7,4 +9,22 @@ data class WeatherPluginConfig(
* or weather provider.
*/
val minUpdateInterval: Long = 60 * 60 * 1000L,
)
) {
fun toBundle(): Bundle {
return Bundle().apply {
putLong("minUpdateInterval", minUpdateInterval)
}
}
companion object {
operator fun invoke(bundle: Bundle): WeatherPluginConfig {
return WeatherPluginConfig(
minUpdateInterval = bundle.getLong(
"minUpdateInterval",
60 * 60 * 1000L
),
)
}
}
}
@@ -2,7 +2,7 @@ package de.mm20.launcher2.plugin.contracts
object WeatherPluginContract {
object Paths {
const val Weather = "weather"
const val Forecasts = "forecasts"
const val Locations = "locations"
}