app/src/main/java/com/alibaba/weex/WXPageActivity.java
// Put up our own UI for how to handle the decoded contents.
Put up our own UI for how to handle the decoded contents.
Put up our own UI for how to handle the decoded contents .
private void handleDecodeInternally(String code) {
    if (!TextUtils.isEmpty(code)) {
      Uri uri = Uri.parse(code);
      if (uri.getQueryParameterNames().contains("bundle")) {
        WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
        WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
        String tip = WXEnvironment.sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode";
        Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
        finish();
        return;
      } else if (uri.getQueryParameterNames().contains("_wx_devtool")) {
        WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool");
        WXSDKEngine.reload();
        Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show();
        return;
      }else if (code.contains("_wx_debug")) {
        uri = Uri.parse(code);
        String debug_url = uri.getQueryParameter("_wx_debug");
        WXSDKEngine.switchDebugModel(true, debug_url);
        finish();
      } else {
        Toast.makeText(this, code, Toast.LENGTH_SHORT)
            .show();
        Intent intent = new Intent(Constants.ACTION_OPEN_URL);
        intent.setPackage(getPackageName());
        intent.setData(Uri.parse(code));
        startActivity(intent);
      }
    }
  }
private void handleDecodeInternally ( String code ) { if ( ! TextUtils . isEmpty ( code ) ) { Uri uri = Uri . parse ( code ) ; if ( uri . getQueryParameterNames ( ) . contains ( "bundle" ) ) { WXEnvironment . sDynamicMode = uri . getBooleanQueryParameter ( "debug" , false ) ; WXEnvironment . sDynamicUrl = uri . getQueryParameter ( "bundle" ) ; String tip = WXEnvironment . sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode" ; Toast . makeText ( this , tip , Toast . LENGTH_SHORT ) . show ( ) ; finish ( ) ; return ; } else if ( uri . getQueryParameterNames ( ) . contains ( "_wx_devtool" ) ) { WXEnvironment . sRemoteDebugProxyUrl = uri . getQueryParameter ( "_wx_devtool" ) ; WXSDKEngine . reload ( ) ; Toast . makeText ( this , "devtool" , Toast . LENGTH_SHORT ) . show ( ) ; return ; } else if ( code . contains ( "_wx_debug" ) ) { uri = Uri . parse ( code ) ; String debug_url = uri . getQueryParameter ( "_wx_debug" ) ; WXSDKEngine . switchDebugModel ( true , debug_url ) ; finish ( ) ; } else { Toast . makeText ( this , code , Toast . LENGTH_SHORT ) . show ( ) ; Intent intent = new Intent ( Constants . ACTION_OPEN_URL ) ; intent . setPackage ( getPackageName ( ) ) ; intent . setData ( Uri . parse ( code ) ) ; startActivity ( intent ) ; } } }
Put up our own UI for how to handle the decoded contents.
Put up our own UI for how to handle the decoded contents .