YorkShen closed pull request #1825: [Android] replace IWXDebugProxy as WXSDKInstance class URL: https://github.com/apache/incubator-weex/pull/1825
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java index 01f496de5b..28a36e3b0c 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java @@ -54,18 +54,14 @@ import com.alibaba.weex.https.WXRequestListener; import com.taobao.weex.IWXRenderListener; import com.taobao.weex.RenderContainer; -import com.taobao.weex.WXEnvironment; import com.taobao.weex.WXSDKEngine; import com.taobao.weex.WXSDKInstance; import com.taobao.weex.appfram.navigator.IActivityNavBarSetter; -import com.taobao.weex.bridge.WXBridgeManager; -import com.taobao.weex.common.IWXDebugProxy; import com.taobao.weex.common.WXRenderStrategy; import com.taobao.weex.ui.component.NestedContainer; import com.taobao.weex.ui.component.WXComponent; import com.taobao.weex.ui.component.WXVContainer; import com.taobao.weex.utils.WXFileUtils; -import com.taobao.weex.utils.WXJsonUtils; import com.taobao.weex.utils.WXLogUtils; import java.io.File; @@ -188,7 +184,7 @@ public void run() { ctx.getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect); mConfigMap.put("bundleUrl", mUri.toString()); String path = "file".equals(mUri.getScheme()) ? assembleFilePath(mUri) : mUri.toString(); - mInstance.render(TAG, WXFileUtils.loadAsset(path, WXPageActivity.this), + mInstance.render(path, WXFileUtils.loadAsset(path, WXPageActivity.this), mConfigMap, null, WXRenderStrategy.APPEND_ASYNC); } @@ -248,8 +244,13 @@ private void loadWXfromService(final String url) { public void onSuccess(WXHttpTask task) { Log.i(TAG, "into--[http:onSuccess] url:" + url); try { + Uri uri = Uri.parse(url); mConfigMap.put("bundleUrl", url); - mInstance.render(TAG, new String(task.response.data, "utf-8"), mConfigMap, null, WXRenderStrategy.APPEND_ASYNC); + if (uri.getPath().endsWith(".wlasm")){ + mInstance.render(TAG, task.response.data, mConfigMap, null); + } else { + mInstance.render(TAG, new String(task.response.data, "utf-8"), mConfigMap, null, WXRenderStrategy.APPEND_ASYNC); + } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } @@ -532,8 +533,8 @@ protected void onStop() { private void registerBroadcastReceiver() { mReceiver = new RefreshBroadcastReceiver(); IntentFilter filter = new IntentFilter(); - filter.addAction(IWXDebugProxy.ACTION_DEBUG_INSTANCE_REFRESH); - filter.addAction(IWXDebugProxy.ACTION_INSTANCE_RELOAD); + filter.addAction(WXSDKInstance.ACTION_DEBUG_INSTANCE_REFRESH); + filter.addAction(WXSDKInstance.ACTION_INSTANCE_RELOAD); registerReceiver(mReceiver, filter); } @@ -603,8 +604,8 @@ public boolean setNavBarTitle(String param) { public class RefreshBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (IWXDebugProxy.ACTION_INSTANCE_RELOAD.equals(intent.getAction()) || - IWXDebugProxy.ACTION_DEBUG_INSTANCE_REFRESH.equals(intent.getAction())) { + if (WXSDKInstance.ACTION_INSTANCE_RELOAD.equals(intent.getAction()) || + WXSDKInstance.ACTION_DEBUG_INSTANCE_REFRESH.equals(intent.getAction())) { // String myUrl = intent.getStringExtra("url"); // Log.e("WXPageActivity", "RefreshBroadcastReceiver reload onReceive ACTION_DEBUG_INSTANCE_REFRESH mBundleUrl:" + myUrl + " mUri:" + mUri); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services