コード例 #1
0
  /** This method must be invoked on the UI thread. */
  public static void initEmbeddedMode() {
    if (sInstance != null || !sReservedActivities.isEmpty()) return;

    Log.d(TAG, "Init embedded mode");
    XWalkCoreWrapper provisionalInstance = new XWalkCoreWrapper(null, -1);
    if (!provisionalInstance.findEmbeddedCore()) {
      Assert.fail("Please have your activity extend XWalkActivity for shared mode");
    }

    sInstance = provisionalInstance;
    sInstance.initXWalkCore();
  }
コード例 #2
0
  /** This method must be invoked on the UI thread. */
  public static void dockXWalkCore() {
    Assert.assertNotNull(sProvisionalInstance);
    Assert.assertNull(sInstance);

    Log.d(TAG, "Dock xwalk core");
    sInstance = sProvisionalInstance;
    sProvisionalInstance = null;
    sInstance.initXWalkCore();

    if (sInstance.isSharedMode()) {
      XWalkApplication application = XWalkApplication.getApplication();
      if (application == null) {
        Assert.fail("Please use XWalkApplication in the Android manifest for shared mode");
      }
      application.addResource(sInstance.mBridgeContext.getResources());
    }
    Log.d(TAG, "Initialize xwalk core successfully");
  }