Group plugins by package
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package de.mm20.launcher2.plugin
|
||||
|
||||
import android.content.Intent
|
||||
|
||||
|
||||
data class PluginPackage(
|
||||
val packageName: String,
|
||||
val label: String,
|
||||
val description: String? = null,
|
||||
val author: String? = null,
|
||||
val settings: Intent? = null,
|
||||
val plugins: List<Plugin>,
|
||||
val isOfficial: Boolean = false,
|
||||
) {
|
||||
val enabled: Boolean = plugins.all { it.enabled }
|
||||
}
|
||||
@@ -15,5 +15,6 @@ interface PluginRepository {
|
||||
fun insertMany(plugins: List<Plugin>): Job
|
||||
fun insert(plugin: Plugin): Job
|
||||
fun update(plugin: Plugin): Job
|
||||
fun updateMany(plugins: List<Plugin>): Job
|
||||
fun deleteMany(): Job
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package de.mm20.launcher2.plugin
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.os.Bundle
|
||||
|
||||
|
||||
sealed class PluginState {
|
||||
data class Ready(
|
||||
/**
|
||||
* Status text, providing additional info what this plugin is currently configured to do.
|
||||
* For example "Search %user's files on %service"
|
||||
*/
|
||||
val text: String? = null,
|
||||
) : PluginState()
|
||||
data class SetupRequired(
|
||||
val setupActivity: PendingIntent,
|
||||
val message: String? = null,
|
||||
) : PluginState()
|
||||
|
||||
companion object {
|
||||
fun fromBundle(bundle: Bundle): PluginState? {
|
||||
val type = bundle.getString("type") ?: return null
|
||||
return when(type) {
|
||||
"Ready" -> Ready(
|
||||
text = bundle.getString("text"),
|
||||
)
|
||||
"SetupRequired" -> SetupRequired(
|
||||
setupActivity = bundle.getParcelable("setupActivity") ?: return null,
|
||||
message = bundle.getString("message"),
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user