Esempio n. 1
0
  private void initXWalkView() {
    Log.d(TAG, "Init xwalk view");
    Object object = mWrapperContext;
    if (mBridgeContext != null) {
      ReflectConstructor constructor =
          new ReflectConstructor(getBridgeClass("MixedContext"), Context.class, Context.class);
      object = constructor.newInstance(mBridgeContext, mWrapperContext);
    }

    Class<?> clazz = getBridgeClass("XWalkViewDelegate");
    new ReflectMethod(clazz, "init", Context.class).invoke(object);
  }
 private static Object[] nullArgumentsFor(ReflectConstructor constructor) {
   ReflectClass[] paramTypes = constructor.getParameterTypes();
   Object[] params = new Object[paramTypes.length];
   for (int j = 0; j < params.length; j++) {
     params[j] = paramTypes[j].nullValue();
   }
   return params;
 }
  private static ReflectConstructorSpec findConstructor(
      final ReflectClass claxx, Tree sortedConstructors) {
    if (sortedConstructors == null) {
      return ReflectConstructorSpec.INVALID_CONSTRUCTOR;
    }

    Iterator4 iter = new TreeNodeIterator(sortedConstructors);
    while (iter.moveNext()) {
      Object current = iter.current();
      ReflectConstructor constructor = (ReflectConstructor) ((TreeIntObject) current)._object;
      Object[] args = nullArgumentsFor(constructor);
      Object res = constructor.newInstance(args);
      if (res != null) {
        return new ReflectConstructorSpec(constructor, args);
      }
    }
    return ReflectConstructorSpec.INVALID_CONSTRUCTOR;
  }
 public static ReflectConstructor skipConstructor(
     ConstructorAwareReflectClass claxx, boolean skipConstructor, boolean testConstructor) {
   if (!skipConstructor) {
     return null;
   }
   ReflectConstructor serializableConstructor = claxx.getSerializableConstructor();
   if (serializableConstructor == null) {
     return null;
   }
   if (!testConstructor || Deploy.csharp) {
     return serializableConstructor;
   }
   Object obj = serializableConstructor.newInstance((Object[]) null);
   if (obj != null) {
     return serializableConstructor;
   }
   return null;
 }