add doric registry

This commit is contained in:
pengfei.zhou
2019-07-20 13:13:35 +08:00
parent bc05a1b8e4
commit 16732340c7
21 changed files with 169 additions and 55 deletions

View File

@@ -0,0 +1,18 @@
package com.github.penfeizhou.doricdemo;
import com.github.penfeizhou.doric.DoricComponent;
import com.github.penfeizhou.doric.DoricLibrary;
import com.github.penfeizhou.doric.DoricRegistry;
/**
* @Description: com.github.penfeizhou.doricdemo
* @Author: pengfei.zhou
* @CreateDate: 2019-07-20
*/
@DoricComponent
public class DemoLibrary extends DoricLibrary {
@Override
public void load(DoricRegistry registry) {
registry.registerNativePlugin(DemoPlugin.class);
}
}

View File

@@ -0,0 +1,25 @@
package com.github.penfeizhou.doricdemo;
import android.widget.Toast;
import com.github.penfeizhou.doric.DoricContext;
import com.github.penfeizhou.doric.extension.bridge.DoricMethod;
import com.github.penfeizhou.doric.extension.bridge.DoricPlugin;
import com.github.penfeizhou.doric.plugin.DoricJavaPlugin;
/**
* @Description: com.github.penfeizhou.doricdemo
* @Author: pengfei.zhou
* @CreateDate: 2019-07-20
*/
@DoricPlugin(name = "demo")
public class DemoPlugin extends DoricJavaPlugin {
public DemoPlugin(DoricContext doricContext) {
super(doricContext);
}
@DoricMethod
public void test() {
Toast.makeText(getDoricContext().getContext(), "test", Toast.LENGTH_SHORT).show();
}
}