mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
give openSettings the context
This commit is contained in:
parent
416d2b67b9
commit
e502be5972
3 changed files with 7 additions and 2 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"githubPullRequests.ignoredPullRequestBranches": [
|
||||||
|
"master"
|
||||||
|
]
|
||||||
|
}
|
|
@ -65,5 +65,5 @@ abstract class Plugin {
|
||||||
/**
|
/**
|
||||||
* This will add a button in the settings allowing you to add custom settings
|
* This will add a button in the settings allowing you to add custom settings
|
||||||
*/
|
*/
|
||||||
var openSettings: (() -> Unit)? = null
|
var openSettings: ((context: Context) -> Unit)? = null
|
||||||
}
|
}
|
|
@ -89,7 +89,7 @@ class PluginAdapter(
|
||||||
itemView.action_settings?.isVisible = true
|
itemView.action_settings?.isVisible = true
|
||||||
itemView.action_settings.setOnClickListener {
|
itemView.action_settings.setOnClickListener {
|
||||||
try {
|
try {
|
||||||
plugin.openSettings!!.invoke()
|
plugin.openSettings!!.invoke(itemView.context)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Log.e("PluginAdapter", "Failed to open ${metadata.name} settings: ${Log.getStackTraceString(e)}")
|
Log.e("PluginAdapter", "Failed to open ${metadata.name} settings: ${Log.getStackTraceString(e)}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue