give openSettings the context

This commit is contained in:
C10udburst 2022-08-11 11:05:47 +02:00
parent 416d2b67b9
commit e502be5972
3 changed files with 7 additions and 2 deletions

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}

View file

@ -65,5 +65,5 @@ abstract class Plugin {
/**
* This will add a button in the settings allowing you to add custom settings
*/
var openSettings: (() -> Unit)? = null
var openSettings: ((context: Context) -> Unit)? = null
}

View file

@ -89,7 +89,7 @@ class PluginAdapter(
itemView.action_settings?.isVisible = true
itemView.action_settings.setOnClickListener {
try {
plugin.openSettings!!.invoke()
plugin.openSettings!!.invoke(itemView.context)
} catch (e: Throwable) {
Log.e("PluginAdapter", "Failed to open ${metadata.name} settings: ${Log.getStackTraceString(e)}")
}