Steps to create new plugin
- Add
maven { url "https://jitpack.io"}
in build.gradle repositories (read more at https://jitpack.io/) - Add
implementation 'com.github.damionx7:Zettel-Notes-Plugin-Api:1.0.21'
in build.gradle - Add intent-filter in AndroidManifest.xml
<intent-filter>
<action android:name="org.eu.thedoc.zettelnotes.intent.buttons" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
- Create
Button
class and make it extendButtonInterface
public class Button
extends ButtonInterface {
private final Listener mListener = new Listener() {
@Override
public void onClick() {
if (mCallback != null) {
mCallback.insertText("\uD83D\uDE04");
}
}
@Override
public boolean onLongClick() {
if (mCallback != null) {
String selectedText = mCallback.getTextSelected(false);
if (!selectedText.isEmpty()) {
mCallback.replaceTextSelected("\uD83D\uDE04");
return true;
}
}
return false;
}
};
@Override
public String getName() {
return "Plugin";
}
@Override
public Listener getListener() {
return mListener;
}
}