//textView delegate JNIEXPORT void JNICALL Java_org_CrossApp_lib_CrossAppTextView_keyBoardHeightReturn(JNIEnv *env, jclass cls, jint key, jint height) { CATextView* textView = s_map[(int)key]; if (textView->getDelegate()) { textView->getDelegate()->keyBoardHeight(textView, (int)s_px_to_dip(height)); } }
//return call back JNIEXPORT void JNICALL Java_org_CrossApp_lib_CrossAppTextView_keyBoardReturnCallBack(JNIEnv *env, jclass cls, jint key, jint height) { CATextView* textView = s_map[(int)key]; textView->resignFirstResponder(); if (textView->getDelegate()) { textView->getDelegate()->textViewShouldReturn(textView); } }
JNIEXPORT bool JNICALL Java_org_CrossApp_lib_CrossAppTextView_textChange(JNIEnv *env, jclass cls, jint key, jstring before, jstring change, int arg0, int arg1) { const char* charBefore = env->GetStringUTFChars(before, NULL); std::string strBefore = charBefore; env->ReleaseStringUTFChars(before, charBefore); const char* charChange = env->GetStringUTFChars(change, NULL); std::string strChange = charChange; env->ReleaseStringUTFChars(change, charChange); CATextView* textView = s_map[(int)key]; if (textView->getDelegate()) { return textView->getDelegate()->textViewShouldChangeCharacters(textView, arg0, arg1, strChange.c_str()); } return true; }