コード例 #1
0
ファイル: ovr_activity.cpp プロジェクト: dknaan/GearVRf
GVRActivity::GVRActivity(JNIEnv& env, jobject activity, jobject vrAppSettings,
        jobject callbacks) : envMainThread_(&env), configurationHelper_(env, vrAppSettings) //use_multiview(false)
{
    activity_ = env.NewGlobalRef(activity);

    activityClass_ = GetGlobalClassReference(env, activityClassName);
    viewManagerClass_ = GetGlobalClassReference(env, viewManagerClassName);

    onDrawEyeMethodId = GetMethodId(env, viewManagerClass_, "onDrawEye", "(I)V");
    updateSensoredSceneMethodId = GetMethodId(env, activityClass_, "updateSensoredScene", "()Z");
}
コード例 #2
0
ファイル: activity.cpp プロジェクト: ViliusKraujutis/GearVRf
GVRActivity::GVRActivity(JNIEnv& env, jobject activity, jobject vrAppSettings,
        jobject callbacks) : envMainThread_(&env), configurationHelper_(env, vrAppSettings)
{
    activity_ = env.NewGlobalRef(activity);
    activityRenderingCallbacks_ = env.NewGlobalRef(callbacks);

    activityClass_ = GetGlobalClassReference(env, activityClassName);
    activityRenderingCallbacksClass_ = GetGlobalClassReference(env, activityHandlerRenderingCallbacksClassName);

    onDrawEyeMethodId = GetMethodId(env, activityRenderingCallbacksClass_, "onDrawEye", "(I)V");
    updateSensoredSceneMethodId = GetMethodId(env, activityClass_, "updateSensoredScene", "()Z");
}
コード例 #3
0
void CPPToJavaArchiveOpenVolumeCallback::Init(JNIEnv * initEnv) {
	TRACE_OBJECT_CALL("Init")

	// public Object getProperty(PropID propID);
	_getPropertyMethodID = GetMethodId(initEnv, "getProperty",
			"(" PROPID_CLASS_T ")" JAVA_OBJECT_T);

	// public IInStream getStream(String filename);
	_getStreamMethodID = GetMethodId(initEnv, "getStream",
			"(" JAVA_STRING_T ")" INSTREAM_CLASS_T);

	_propIDClass = GetClass(initEnv, PROPID_CLASS);

	_propIDGetPropIDByIndexMethodID = GetStaticMethodId(initEnv, _propIDClass,
			"getPropIDByIndex", "(I)" PROPID_CLASS_T);
}
コード例 #4
0
ファイル: android_utils.cpp プロジェクト: charlieyqin/fplutil
void JniObject::CallVoidMethod(const char* method, const char* signature, ...) {
  va_list args;
  va_start(args, signature);
  auto mid = GetMethodId(method, signature);
  env_->CallVoidMethodV(static_cast<jobject>(obj_), mid, args);
  va_end(args);
  return;
}
コード例 #5
0
void CPPToJavaArchiveExtractCallback::Init(JNIEnv * initEnv)
{
    TRACE_OBJECT_CALL("Init")

    _cryptoGetTextPasswordImpl = NULL;

    jclass cryptoGetTextPasswordClass = initEnv->FindClass(CRYPTOGETTEXTPASSWORD_CLASS);
    FATALIF(cryptoGetTextPasswordClass == NULL,
            "Can't find class " CRYPTOGETTEXTPASSWORD_CLASS);

    if (initEnv->IsInstanceOf(_javaImplementation, cryptoGetTextPasswordClass))
    {
        CMyComPtr<ICryptoGetTextPassword> cryptoGetTextPasswordComPtr =
            new CPPToJavaCryptoGetTextPassword(_nativeMethodContext, initEnv, _javaImplementation);
        _cryptoGetTextPasswordImpl = cryptoGetTextPasswordComPtr.Detach();
    }


	// public SequentialOutStream getStream(int index, ExtractAskMode extractAskMode);
	_getStreamMethodID = GetMethodId(initEnv, "getStream",
			"(I" EXTRACTASKMODE_CLASS_T ")" SEQUENTIALOUTSTREAM_CLASS_T);

	// public void prepareOperation(ExtractAskMode extractAskMode);
	_prepareOperationMethodID = GetMethodId(initEnv, "prepareOperation",
			"(" EXTRACTASKMODE_CLASS_T ")V");

	// public void setOperationResult(ExtractOperationResult extractOperationResult);
	_setOperationResultMethodID = GetMethodId(initEnv, "setOperationResult",
			"(" EXTRACTOPERATIONRESULT_CLASS_T ")V");

	_extractOperationResultClass = GetClass(initEnv, EXTRACTOPERATIONRESULT_CLASS);

	// public static ExtractOperationResult getOperationResult(int index)
	_extractOperationResultGetOperationResultMethodID =
			GetStaticMethodId(initEnv, _extractOperationResultClass,
			        "getOperationResult", "(I)" EXTRACTOPERATIONRESULT_CLASS_T);

	_extractAskModeClass = GetClass(initEnv, EXTRACTASKMODE_CLASS);

	// public static ExtractAskMode getExtractAskModeByIndex(int index)
	_extractAskModeGetExtractAskModeByIndexMethodID =
			GetStaticMethodId(initEnv, _extractAskModeClass, "getExtractAskModeByIndex",
			        "(I)" EXTRACTASKMODE_CLASS_T);
}
コード例 #6
0
ファイル: android_utils.cpp プロジェクト: charlieyqin/fplutil
std::string JniObject::CallStringMethod(const char* method,
                                        const char* signature, ...) {
  va_list args;
  va_start(args, signature);
  auto mid = GetMethodId(method, signature);
  auto jstr = env_->CallObjectMethodV(static_cast<jobject>(obj_), mid, args);
  va_end(args);
  // Convert jstring to std::string.
  auto str = env_->GetStringUTFChars(static_cast<jstring>(jstr), NULL);
  std::string ret = str;
  env_->ReleaseStringUTFChars(static_cast<jstring>(jstr), str);
  env_->DeleteLocalRef(jstr);
  return ret;
}