mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Android: Add selection dialog (drop down/combo box) (#13814)
- The handling of IGUIComboBox uses the new setAndSendSelected() method. - getDialogState() is now getInputDialogState() and returns the state of the input dialog. - getLastDialogType() is added and returns current/last shown dialog's type. - getInputDialogState() now returns an enum instead of int. - getAndroidUIInput() now returns void instead of bool. - New data types (enum) are added: (1) GameActivity.DialogType (Java) and porting::AndroidDialogType (C++) (2) GameActivity.DialogState (Java) and porting::AndroidDialogState (C++) - When showing a text input dialog, there is no custom accept button text any more. - showDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI(). - showInputDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI(). - getDialogValue()/getInputDialogValue() is now getDialogMessage()/getInputDialogMessage(). Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
This commit is contained in:
parent
bd42cc2c77
commit
171f911237
10 changed files with 259 additions and 106 deletions
|
@ -2277,7 +2277,7 @@ void Game::openConsole(float scale, const wchar_t *line)
|
|||
assert(scale > 0.0f && scale <= 1.0f);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
porting::showInputDialog(gettext("ok"), "", "", 2);
|
||||
porting::showTextInputDialog("", "", 2);
|
||||
m_android_chat_open = true;
|
||||
#else
|
||||
if (gui_chat_console->isOpenInhibited())
|
||||
|
@ -2293,15 +2293,19 @@ void Game::openConsole(float scale, const wchar_t *line)
|
|||
#ifdef __ANDROID__
|
||||
void Game::handleAndroidChatInput()
|
||||
{
|
||||
if (m_android_chat_open && porting::getInputDialogState() == 0) {
|
||||
std::string text = porting::getInputDialogValue();
|
||||
client->typeChatMessage(utf8_to_wide(text));
|
||||
m_android_chat_open = false;
|
||||
// It has to be a text input
|
||||
if (m_android_chat_open && porting::getLastInputDialogType() == porting::TEXT_INPUT) {
|
||||
porting::AndroidDialogState dialogState = porting::getInputDialogState();
|
||||
if (dialogState == porting::DIALOG_INPUTTED) {
|
||||
std::string text = porting::getInputDialogMessage();
|
||||
client->typeChatMessage(utf8_to_wide(text));
|
||||
}
|
||||
if (dialogState != porting::DIALOG_SHOWN)
|
||||
m_android_chat_open = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Game::toggleFreeMove()
|
||||
{
|
||||
bool free_move = !g_settings->getBool("free_move");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue