1
0
Fork 0
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:
Muhammad Rifqi Priyo Susanto 2024-01-07 19:00:04 +07:00 committed by GitHub
parent bd42cc2c77
commit 171f911237
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 259 additions and 106 deletions

View file

@ -264,14 +264,19 @@ std::string GUIPasswordChange::getNameByID(s32 id)
}
#ifdef __ANDROID__
bool GUIPasswordChange::getAndroidUIInput()
void GUIPasswordChange::getAndroidUIInput()
{
if (!hasAndroidUIInput())
return false;
porting::AndroidDialogState dialogState = getAndroidUIInputState();
if (dialogState == porting::DIALOG_SHOWN) {
return;
} else if (dialogState == porting::DIALOG_CANCELED) {
m_jni_field_name.clear();
return;
}
// still waiting
if (porting::getInputDialogState() == -1)
return true;
// It has to be a text input
if (porting::getLastInputDialogType() != porting::TEXT_INPUT)
return;
gui::IGUIElement *e = nullptr;
if (m_jni_field_name == "old_password")
@ -283,10 +288,10 @@ bool GUIPasswordChange::getAndroidUIInput()
m_jni_field_name.clear();
if (!e || e->getType() != irr::gui::EGUIET_EDIT_BOX)
return false;
return;
std::string text = porting::getInputDialogValue();
std::string text = porting::getInputDialogMessage();
e->setText(utf8_to_wide(text).c_str());
return false;
return;
}
#endif