feat:fix when reloading call onCreate and onShow

This commit is contained in:
pengfei.zhou 2020-02-29 15:00:46 +08:00 committed by osborn
parent eb6ba3ee36
commit d713b04d51
4 changed files with 7 additions and 2 deletions

View File

@ -36,4 +36,5 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
implementation "com.qmuiteam:qmui:1.4.0"
}

View File

@ -43,7 +43,6 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final DoricSwipeLayout swipeLayout = findViewById(R.id.swipe_layout);
swipeLayout.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
@ -64,6 +63,9 @@ public class MainActivity extends AppCompatActivity {
String[] demos = getAssets().list("src");
List<String> ret = new ArrayList<>();
for (String str : demos) {
if (str.endsWith(".es5.js")) {
continue;
}
if (str.endsWith("js")) {
ret.add(str);
}

View File

@ -186,6 +186,7 @@ public class DoricContext {
this.script = script;
this.mRootNode.setId("");
getDriver().createContext(mContextId, script, source);
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
callEntity(DoricConstant.DORIC_ENTITY_INIT, this.initParams, extra);
onShow();
}

View File

@ -92,7 +92,8 @@ - (void)reload:(NSString *)script {
self.rootNode.viewId = nil;
self.script = script;
[self.driver createContext:self.contextId script:script source:self.source];
[self callEntity:DORIC_ENTITY_INIT, self.initialParams, nil];
[self callEntity:DORIC_ENTITY_CREATE, nil];
[self callEntity:DORIC_ENTITY_INIT, self.initialParams, self.extra, nil];
[self onShow];
}