Пример #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");
  }
Пример #3
0
  public static int attachXWalkCore(Context context) {
    Assert.assertNotNull(sReservedObjects);
    Assert.assertNull(sInstance);

    Log.d(TAG, "Attach xwalk core");
    sProvisionalInstance = new XWalkCoreWrapper(context, -1);
    if (!sProvisionalInstance.findEmbeddedCore()) {
      int status = sProvisionalInstance.mCoreStatus;

      if (!sProvisionalInstance.findSharedCore()) {
        if (sProvisionalInstance.mCoreStatus != XWalkLibraryInterface.STATUS_NOT_FOUND) {
          status = sProvisionalInstance.mCoreStatus;
        }
        Log.d(TAG, "core status: " + status);
        return status;
      }
    }
    return sProvisionalInstance.mCoreStatus;
  }
Пример #4
0
 public static void activateXWalkCore() {
   Log.d(TAG, "Activate xwalk core");
   sInstance.initXWalkView();
 }