8000 GitHub - demndevel/gester-core: Core library for Gester and its plugins
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

demndevel/gester-core

Repository files navigation

Gester Core

Core library with AIDL bound service contracts for Gester app

How to create new plugin

Firstly, you need to create an android app without default activity (or you can add it if you want). Then you need to add the library

[versions]
gesterCore = "0.0.11" # use latest version

[libraries]
gester-core = { module = "io.github.demndevel:gester-core", version.ref = "gesterCore" }
implementation(libs.gester.core)

Each plugin has its own metadata. You can create it by buildPluginMetadata, e.g.:

val wowPluginMetadata = buildPluginMetadata(
	pluginId = "Some Plugin ID",
	pluginName = "Some Plugin Name"
) {
	consumeAnyInput = true
	description = "this is a really cool plugin!!"

	version = PluginVersion(
		major = 1,
		minor = 1,
	)
}

As each plugin is a bound service, you should create it by using predefined PluginService class with open methods:

class WowPlugin : PluginService(wowPluginMetadata) {
	override fun executeAnyInputHandler(input: String): List<OperationResult> {
		val intent = Intent(Intent.ACTION_VIEW).apply {
			data = Uri.parse("https://github.com/demndevel/")
		}

		return if (input == "test") {
			listOf(
				BasicOperationResult(
					text = "Test result",
					intent = intent,
					label = "website",
					pinToTop = false,
				)
			)
		} else emptyList()
	}
}

And finally you need to make few changes to Android Manifest:

  1. Declare permission
<permission android:name="com.demn.PLUGIN_SERVICE_PERMISSION" />
  1. Add bound service with that permission and intent filter
<service
  android:name=".WowPlugin"
  android:exported="true"
  android:permission="com.demn.PLUGIN_SERVICE_PERMISSION"
  android:process=":remote">
  <intent-filter>
    <action android:name="findutil.intent.action.PICK_PLUGIN" />
    <category android:name="findutil.intent.category.ADD_PLUGIN" />
  </intent-filter>
</service>

Result

telegram-cloud-photo-size-2-5271666919973447456-y

About

Core library for Gester and its plugins

Resources

Stars

Watchers

Forks

Packages

No packages published
0