Fix plugin sdk visibility modifiers
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package de.mm20.launcher2.plugin.config
|
||||
|
||||
import android.os.Bundle
|
||||
|
||||
fun SearchPluginConfig(bundle: Bundle): SearchPluginConfig? {
|
||||
return SearchPluginConfig(
|
||||
storageStrategy = valueOfOrElse(
|
||||
bundle.getString(
|
||||
"storageStrategy",
|
||||
StorageStrategy.StoreCopy.name
|
||||
),
|
||||
StorageStrategy.StoreCopy,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun valueOfOrElse(value: String, default: StorageStrategy): StorageStrategy {
|
||||
return try {
|
||||
StorageStrategy.valueOf(value)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
default
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package de.mm20.launcher2.plugin.config
|
||||
|
||||
import android.os.Bundle
|
||||
|
||||
fun WeatherPluginConfig(bundle: Bundle): WeatherPluginConfig {
|
||||
return WeatherPluginConfig(
|
||||
minUpdateInterval = bundle.getLong(
|
||||
"minUpdateInterval",
|
||||
60 * 60 * 1000L
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.dokka)
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
|
||||
@@ -9,24 +9,4 @@ data class SearchPluginConfig(
|
||||
* @see [StorageStrategy]
|
||||
*/
|
||||
val storageStrategy: StorageStrategy = StorageStrategy.StoreCopy,
|
||||
) {
|
||||
fun toBundle(): Bundle {
|
||||
return Bundle().apply {
|
||||
putString("storageStrategy", storageStrategy.name)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
operator fun invoke(bundle: Bundle): SearchPluginConfig? {
|
||||
return SearchPluginConfig(
|
||||
storageStrategy = StorageStrategy.valueOfOrElse(
|
||||
bundle.getString(
|
||||
"storageStrategy",
|
||||
StorageStrategy.StoreCopy.name
|
||||
),
|
||||
StorageStrategy.StoreCopy,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -22,13 +22,4 @@ enum class StorageStrategy {
|
||||
* results and if you don't want to implement a cache for search results.
|
||||
*/
|
||||
StoreCopy;
|
||||
companion object {
|
||||
fun valueOfOrElse(value: String, default: StorageStrategy): StorageStrategy {
|
||||
return try {
|
||||
valueOf(value)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
default
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,22 +9,4 @@ 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
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user