Add HegoPanel
This commit is contained in:
parent
88265d769d
commit
d8cf7bee4d
@ -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<JSDecoder> callEntity(String methodName, Object... args) {
|
||||
return HegoDriver.getInstance().invokeContextMethod(mContextId, methodName, args);
|
||||
}
|
||||
|
||||
public void teardown() {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user