From d651298d3e24097eed9545df0ff62247dfea9610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felippe=20Dur=C3=A1n?= Date: Wed, 1 Nov 2017 07:33:31 -0200 Subject: [PATCH] Fix bug of returning UNKNOWN event for return type key SEARCH/SEND in EditBox for Android and SEARCH for iOS. (#18192) --- .../java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java | 3 ++- cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java index 24acb3c3e1..8aac1138ef 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java @@ -204,7 +204,8 @@ public class Cocos2dxEditBoxHelper { editBox.endAction = Cocos2dxEditBox.kEndActionNext; Cocos2dxEditBoxHelper.closeKeyboardOnUiThread(index); return true; - } else if (actionId == EditorInfo.IME_ACTION_DONE) { + } else if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_SEARCH) { + editBox.endAction = Cocos2dxEditBox.kEndActionReturn; Cocos2dxEditBoxHelper.closeKeyboardOnUiThread(index); } return false; diff --git a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm index 3146fbac73..a7393ad4cd 100644 --- a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm +++ b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm @@ -293,7 +293,8 @@ if (self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::NEXT) { action = cocos2d::ui::EditBoxDelegate::EditBoxEndAction::TAB_TO_NEXT; } else if (self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::GO || - self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::SEND) { + self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::SEND || + self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::SEARCH) { action = cocos2d::ui::EditBoxDelegate::EditBoxEndAction::RETURN; } }