Align lifecycle timing for Android and iOS
This commit is contained in:
parent
e0055f437d
commit
eb6ba3ee36
@ -101,6 +101,7 @@ public class DoricContext {
|
||||
this.mContextId = contextId;
|
||||
this.source = source;
|
||||
this.extra = extra;
|
||||
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
@ -124,7 +125,6 @@ public class DoricContext {
|
||||
.put("height", height)
|
||||
.toJSONObject();
|
||||
callEntity(DoricConstant.DORIC_ENTITY_INIT, this.initParams, extra);
|
||||
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
||||
}
|
||||
|
||||
public AsyncResult<JSDecoder> callEntity(String methodName, Object... args) {
|
||||
|
@ -56,6 +56,7 @@ public class DoricPanel extends FrameLayout implements LifecycleObserver {
|
||||
|
||||
public void config(String script, String alias, String extra) {
|
||||
DoricContext doricContext = DoricContext.create(getContext(), script, alias, extra);
|
||||
doricContext.onShow();
|
||||
config(doricContext);
|
||||
}
|
||||
|
||||
@ -65,10 +66,6 @@ public class DoricPanel extends FrameLayout implements LifecycleObserver {
|
||||
if (getMeasuredWidth() != 0 && getMeasuredHeight() != 0) {
|
||||
mDoricContext.init(DoricUtils.px2dp(getMeasuredWidth()), DoricUtils.px2dp(getMeasuredHeight()));
|
||||
}
|
||||
if (getContext() instanceof LifecycleOwner
|
||||
&& ((LifecycleOwner) getContext()).getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
mDoricContext.onShow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +28,7 @@ - (void)config:(NSString *)script alias:(NSString *)alias extra:(NSString *)extr
|
||||
[self.view addSubview:it];
|
||||
}]];
|
||||
}];
|
||||
[self.doricContext onShow];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews {
|
||||
|
Reference in New Issue
Block a user