Commit 6458a22e authored by Yacumima's avatar Yacumima

页面切换闪烁优化

parent 388d0a3c
......@@ -23,6 +23,8 @@
*/
package com.taobao.idlefish.flutterboost;
import android.os.Handler;
import com.taobao.idlefish.flutterboost.NavigationService.NavigationService;
import com.taobao.idlefish.flutterboost.interfaces.IContainerManager;
import com.taobao.idlefish.flutterboost.interfaces.IContainerRecord;
......@@ -36,6 +38,7 @@ public class ContainerRecord implements IContainerRecord {
private final IContainerManager mManager;
private final IFlutterViewContainer mContainer;
private final String mUniqueId;
private final Handler mHandler = new Handler();
private int mState = STATE_UNKNOW;
private MethodChannelProxy mProxy = new MethodChannelProxy();
......@@ -85,7 +88,12 @@ public class ContainerRecord implements IContainerRecord {
* If current container is finishing, we should call destroy flutter page early.
*/
if(mContainer.isFinishing()) {
mProxy.destroy();
mHandler.post(new Runnable() {
@Override
public void run() {
mProxy.destroy();
}
});
}
}
......
......@@ -144,12 +144,11 @@ abstract public class FlutterViewStub extends FrameLayout {
if (flutterView == null) return;
Debuger.log("detachFlutterView");
if (mSnapshot.getParent() == null) {
mBitmap = flutterView.getBitmap();
if (mBitmap != null && !mBitmap.isRecycled()) {
mSnapshot.setImageBitmap(mBitmap);
Debuger.log("snapshot view");
addView(mSnapshot);
}
}
......@@ -160,11 +159,12 @@ abstract public class FlutterViewStub extends FrameLayout {
@Override
public void run() {
if (flutterView.getParent() != null && flutterView.getParent() == mStub) {
Debuger.log("detachFlutterView");
mStub.removeView(flutterView);
}
}
};
sHandler.sendMessage(msg);
sHandler.sendMessageDelayed(msg,18);
}
public void destroy() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment