ANDROID: Make clipboards work with U32Strings.
This commit is contained in:
parent
f0ad817716
commit
a9c5e930f0
4 changed files with 18 additions and 12 deletions
|
@ -537,11 +537,11 @@ bool OSystem_Android::hasTextInClipboard() {
|
|||
return JNI::hasTextInClipboard();
|
||||
}
|
||||
|
||||
Common::String OSystem_Android::getTextFromClipboard() {
|
||||
Common::U32String OSystem_Android::getTextFromClipboard() {
|
||||
return JNI::getTextFromClipboard();
|
||||
}
|
||||
|
||||
bool OSystem_Android::setTextInClipboard(const Common::String &text) {
|
||||
bool OSystem_Android::setTextInClipboard(const Common::U32String &text) {
|
||||
return JNI::setTextInClipboard(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "common/fs.h"
|
||||
#include "common/archive.h"
|
||||
#include "common/mutex.h"
|
||||
#include "common/ustr.h"
|
||||
#include "audio/mixer_intern.h"
|
||||
#include "backends/modular-backend.h"
|
||||
#include "backends/plugins/posix/posix-provider.h"
|
||||
|
@ -133,8 +134,8 @@ public:
|
|||
int priority = 0);
|
||||
virtual bool openUrl(const Common::String &url);
|
||||
virtual bool hasTextInClipboard();
|
||||
virtual Common::String getTextFromClipboard();
|
||||
virtual bool setTextInClipboard(const Common::String &text);
|
||||
virtual Common::U32String getTextFromClipboard();
|
||||
virtual bool setTextInClipboard(const Common::U32String &text);
|
||||
virtual bool isConnectionLimited();
|
||||
virtual Common::String getSystemLanguage() const;
|
||||
virtual char *convertEncoding(const char *to, const char *from, const char *string, size_t length);
|
||||
|
|
|
@ -283,7 +283,7 @@ bool JNI::hasTextInClipboard() {
|
|||
return hasText;
|
||||
}
|
||||
|
||||
Common::String JNI::getTextFromClipboard() {
|
||||
Common::U32String JNI::getTextFromClipboard() {
|
||||
JNIEnv *env = JNI::getEnv();
|
||||
|
||||
jstring javaText = (jstring)env->CallObjectMethod(_jobj, _MID_getTextFromClipboard);
|
||||
|
@ -294,18 +294,22 @@ Common::String JNI::getTextFromClipboard() {
|
|||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
|
||||
return Common::String();
|
||||
return Common::U32String();
|
||||
}
|
||||
|
||||
Common::String text = convertFromJString(env, javaText, getCurrentCharset());
|
||||
Common::String text = convertFromJString(env, javaText, "UTF-8");
|
||||
env->DeleteLocalRef(javaText);
|
||||
|
||||
return text;
|
||||
if (getCurrentCharset() == "UTF-32") {
|
||||
return text.decode();
|
||||
}
|
||||
|
||||
bool JNI::setTextInClipboard(const Common::String &text) {
|
||||
return Common::U32String(text);
|
||||
}
|
||||
|
||||
bool JNI::setTextInClipboard(const Common::U32String &text) {
|
||||
JNIEnv *env = JNI::getEnv();
|
||||
jstring javaText = convertToJString(env, text, getCurrentCharset());
|
||||
jstring javaText = convertToJString(env, text.encode(), "UTF-8");
|
||||
|
||||
bool success = env->CallBooleanMethod(_jobj, _MID_setTextInClipboard, javaText);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "common/fs.h"
|
||||
#include "common/archive.h"
|
||||
#include "common/array.h"
|
||||
#include "common/ustr.h"
|
||||
#include "engines/engine.h"
|
||||
|
||||
class OSystem_Android;
|
||||
|
@ -62,8 +63,8 @@ public:
|
|||
static void displayMessageOnOSD(const Common::String &msg);
|
||||
static bool openUrl(const Common::String &url);
|
||||
static bool hasTextInClipboard();
|
||||
static Common::String getTextFromClipboard();
|
||||
static bool setTextInClipboard(const Common::String &text);
|
||||
static Common::U32String getTextFromClipboard();
|
||||
static bool setTextInClipboard(const Common::U32String &text);
|
||||
static bool isConnectionLimited();
|
||||
static void showVirtualKeyboard(bool enable);
|
||||
static void showKeyboardControl(bool enable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue