Make file plugin config parameter non-optional, remove unused field
This commit is contained in:
parent
c3acebe072
commit
f327906a3e
@ -4,10 +4,6 @@ import android.os.Bundle
|
|||||||
import de.mm20.launcher2.plugin.config.StorageStrategy
|
import de.mm20.launcher2.plugin.config.StorageStrategy
|
||||||
|
|
||||||
data class SearchPluginConfig(
|
data class SearchPluginConfig(
|
||||||
/**
|
|
||||||
* Icon resource to indicate that a result is from this provider
|
|
||||||
*/
|
|
||||||
val providerIconRes: Int? = null,
|
|
||||||
/**
|
/**
|
||||||
* Strategy to store items from this provider in the launcher database
|
* Strategy to store items from this provider in the launcher database
|
||||||
* @see [StorageStrategy]
|
* @see [StorageStrategy]
|
||||||
@ -16,7 +12,6 @@ data class SearchPluginConfig(
|
|||||||
) {
|
) {
|
||||||
fun toBundle(): Bundle {
|
fun toBundle(): Bundle {
|
||||||
return Bundle().apply {
|
return Bundle().apply {
|
||||||
putInt("providerIconRes", providerIconRes ?: 0)
|
|
||||||
putString("storageStrategy", storageStrategy.name)
|
putString("storageStrategy", storageStrategy.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +19,6 @@ data class SearchPluginConfig(
|
|||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(bundle: Bundle): SearchPluginConfig? {
|
operator fun invoke(bundle: Bundle): SearchPluginConfig? {
|
||||||
return SearchPluginConfig(
|
return SearchPluginConfig(
|
||||||
providerIconRes = bundle.getInt("providerIconRes", 0).takeIf { it != 0 },
|
|
||||||
storageStrategy = StorageStrategy.valueOfOrElse(
|
storageStrategy = StorageStrategy.valueOfOrElse(
|
||||||
bundle.getString(
|
bundle.getString(
|
||||||
"storageStrategy",
|
"storageStrategy",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import de.mm20.launcher2.plugin.contracts.FilePluginContract
|
|||||||
import de.mm20.launcher2.sdk.base.SearchPluginProvider
|
import de.mm20.launcher2.sdk.base.SearchPluginProvider
|
||||||
|
|
||||||
abstract class FileProvider(
|
abstract class FileProvider(
|
||||||
config: SearchPluginConfig = SearchPluginConfig(),
|
config: SearchPluginConfig,
|
||||||
) : SearchPluginProvider<File>(config) {
|
) : SearchPluginProvider<File>(config) {
|
||||||
abstract override suspend fun search(query: String): List<File>
|
abstract override suspend fun search(query: String): List<File>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user