mirror of https://github.com/axmolengine/axmol.git
fix textfield and editbox can not input emoticon
fix textfield and editbox can not input emoticon and improve the api comments
This commit is contained in:
parent
9a257d8136
commit
42ed314463
|
@ -80,7 +80,7 @@ CC_DLL bool UTF16ToUTF8(const std::u16string& utf16, std::string& outUtf8);
|
||||||
* because getStringUTFChars can not pass special emoticon
|
* because getStringUTFChars can not pass special emoticon
|
||||||
* @param env The JNI Env
|
* @param env The JNI Env
|
||||||
* @param srcjStr The jstring which want to convert
|
* @param srcjStr The jstring which want to convert
|
||||||
* @param ret True if convert success, if ret not null
|
* @param ret True if the conversion succeeds and the ret pointer isn't null
|
||||||
* @returns the result of utf8 string
|
* @returns the result of utf8 string
|
||||||
*/
|
*/
|
||||||
CC_DLL std::string getStringUTFCharsJNI(JNIEnv* env, jstring srcjStr, bool* ret = nullptr);
|
CC_DLL std::string getStringUTFCharsJNI(JNIEnv* env, jstring srcjStr, bool* ret = nullptr);
|
||||||
|
@ -90,7 +90,7 @@ CC_DLL std::string getStringUTFCharsJNI(JNIEnv* env, jstring srcjStr, bool* ret
|
||||||
* because newStringUTF can not convert special emoticon
|
* because newStringUTF can not convert special emoticon
|
||||||
* @param env The JNI Env
|
* @param env The JNI Env
|
||||||
* @param srcjStr The std::string which want to convert
|
* @param srcjStr The std::string which want to convert
|
||||||
* @param ret True if convert success, if ret not null
|
* @param ret True if the conversion succeeds and the ret pointer isn't null
|
||||||
* @returns the result of jstring,the jstring need to DeleteLocalRef(jstring);
|
* @returns the result of jstring,the jstring need to DeleteLocalRef(jstring);
|
||||||
*/
|
*/
|
||||||
CC_DLL jstring newStringUTFJNI(JNIEnv* env, std::string utf8Str, bool* ret = nullptr);
|
CC_DLL jstring newStringUTFJNI(JNIEnv* env, std::string utf8Str, bool* ret = nullptr);
|
||||||
|
|
|
@ -32,6 +32,8 @@ THE SOFTWARE.
|
||||||
#include "deprecated/CCString.h"
|
#include "deprecated/CCString.h"
|
||||||
#include "Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
#include "Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||||
|
|
||||||
|
#include "base/ccUTF8.h"
|
||||||
|
|
||||||
#define LOG_TAG "Java_org_cocos2dx_lib_Cocos2dxHelper.cpp"
|
#define LOG_TAG "Java_org_cocos2dx_lib_Cocos2dxHelper.cpp"
|
||||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||||
|
|
||||||
|
@ -117,12 +119,13 @@ void showEditTextDialogJNI(const char* title, const char* message, int inputMode
|
||||||
jstring stringArg1;
|
jstring stringArg1;
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
|
|
||||||
stringArg1 = t.env->NewStringUTF("");
|
stringArg1 = t.env->NewStringUTF("");
|
||||||
} else {
|
} else {
|
||||||
stringArg1 = t.env->NewStringUTF(title);
|
stringArg1 = cocos2d::StringUtils::newStringUTFJNI(t.env, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring stringArg2 = t.env->NewStringUTF(message);
|
jstring stringArg2 = cocos2d::StringUtils::newStringUTFJNI(t.env, message);
|
||||||
|
|
||||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1, stringArg2,inputMode, inputFlag, returnType, maxLength);
|
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1, stringArg2,inputMode, inputFlag, returnType, maxLength);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,6 @@ extern "C" {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string pszText = cocos2d::IMEDispatcher::sharedDispatcher()->getContentText();
|
std::string pszText = cocos2d::IMEDispatcher::sharedDispatcher()->getContentText();
|
||||||
return env->NewStringUTF(pszText.c_str());
|
return cocos2d::StringUtils::newStringUTFJNI(env, pszText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue