diff --git a/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoContext.java b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoContext.java index 7c7e204c..4331c7d2 100644 --- a/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoContext.java +++ b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoContext.java @@ -1,5 +1,8 @@ package com.github.pengfeizhou.hego; +import com.github.pengfeizhou.hego.utils.HegoSettableFuture; +import com.github.pengfeizhou.jscore.JSDecoder; + import java.util.concurrent.atomic.AtomicInteger; /** @@ -21,8 +24,8 @@ public class HegoContext { return new HegoContext(contextId); } - public void callEntity(String methodName, Object... args) { - HegoDriver.getInstance().invokeContextMethod(mContextId, methodName, args); + public HegoSettableFuture callEntity(String methodName, Object... args) { + return HegoDriver.getInstance().invokeContextMethod(mContextId, methodName, args); } public void teardown() { diff --git a/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoPanel.java b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoPanel.java new file mode 100644 index 00000000..3490ab17 --- /dev/null +++ b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoPanel.java @@ -0,0 +1,54 @@ +package com.github.pengfeizhou.hego; + +import android.content.Context; +import android.os.Build; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.annotation.RequiresApi; +import android.util.AttributeSet; +import android.widget.FrameLayout; + +/** + * @Description: Hego + * @Author: pengfei.zhou + * @CreateDate: 2019-07-18 + */ +public class HegoPanel extends FrameLayout { + + private HegoContext mHegoContext; + + public HegoPanel(@NonNull Context context) { + super(context); + } + + public HegoPanel(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public HegoPanel(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) + public HegoPanel(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public void config(String script, String alias) { + HegoContext hegoContext = HegoContext.createContext(script, alias); + config(hegoContext); + } + + public void config(HegoContext hegoContext) { + mHegoContext = hegoContext; + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + } + + public HegoContext getHegoContext() { + return mHegoContext; + } +}