mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #8607 from xiushudongfang/InputBox-for-Android
Add inputbox for android
This commit is contained in:
commit
1e749b0a43
3 changed files with 19 additions and 2 deletions
|
@ -472,6 +472,8 @@ void GameSettingsScreen::CreateViews() {
|
|||
|
||||
#ifdef _WIN32
|
||||
networkingSettings->Add(new PopupTextInputChoice(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), "", 255, screenManager()));
|
||||
#elif defined(ANDROID)
|
||||
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
|
||||
#else
|
||||
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress);
|
||||
#endif
|
||||
|
@ -605,6 +607,8 @@ void GameSettingsScreen::CreateViews() {
|
|||
systemSettings->Add(new PopupTextInputChoice(&g_Config.sNickName, sy->T("Change Nickname"), "", 32, screenManager()));
|
||||
#elif defined(USING_QT_UI)
|
||||
systemSettings->Add(new Choice(sy->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
|
||||
#elif defined(ANDROID)
|
||||
systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sNickName, sy->T("Change Nickname"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
|
||||
#endif
|
||||
#if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE))
|
||||
// Screenshot functionality is not yet available on non-Windows/non-Qt
|
||||
|
@ -912,6 +916,8 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
|||
if (System_InputBoxGetString("Enter a new PSP nickname", g_Config.sNickName.c_str(), name, name_len)) {
|
||||
g_Config.sNickName = name;
|
||||
}
|
||||
#elif defined(ANDROID)
|
||||
System_SendMessage("inputbox", ("nickname:" + g_Config.sNickName).c_str());
|
||||
#endif
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -930,6 +936,8 @@ UI::EventReturn GameSettingsScreen::OnChangeproAdhocServerAddress(UI::EventParam
|
|||
}
|
||||
else
|
||||
screenManager()->push(new ProAdhocServerScreen);
|
||||
#elif defined(ANDROID)
|
||||
System_SendMessage("inputbox", ("IP:" + g_Config.proAdhocServer).c_str());
|
||||
#else
|
||||
screenManager()->push(new ProAdhocServerScreen);
|
||||
#endif
|
||||
|
|
|
@ -143,6 +143,7 @@ static recursive_mutex pendingMutex;
|
|||
static std::vector<PendingMessage> pendingMessages;
|
||||
static Thin3DContext *thin3d;
|
||||
static UIContext *uiContext;
|
||||
static std::vector<std::string> inputboxValue;
|
||||
|
||||
#ifdef _WIN32
|
||||
WindowsAudioBackend *winAudioBackend;
|
||||
|
@ -736,6 +737,14 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
|||
if (msg == "inputDeviceConnected") {
|
||||
KeyMap::NotifyPadConnected(value);
|
||||
}
|
||||
if (msg == "inputbox_completed") {
|
||||
SplitString(value, ':', inputboxValue);
|
||||
if (inputboxValue[0] == "IP")
|
||||
g_Config.proAdhocServer = inputboxValue[1];
|
||||
if (inputboxValue[0] == "nickname")
|
||||
g_Config.sNickName = inputboxValue[1];
|
||||
inputboxValue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void NativeUpdate(InputState &input) {
|
||||
|
|
|
@ -794,7 +794,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
|||
}
|
||||
|
||||
// The return value is sent elsewhere. TODO in java, in SendMessage in C++.
|
||||
public void inputBox(String title, String defaultText, String defaultAction) {
|
||||
public void inputBox(final String title, String defaultText, String defaultAction) {
|
||||
final FrameLayout fl = new FrameLayout(this);
|
||||
final EditText input = new EditText(this);
|
||||
input.setGravity(Gravity.CENTER);
|
||||
|
@ -824,7 +824,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
|||
.setPositiveButton(defaultAction, new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface d, int which) {
|
||||
NativeApp.sendMessage("inputbox_completed", input.getText().toString());
|
||||
NativeApp.sendMessage("inputbox_completed", title + ":" + input.getText().toString());
|
||||
d.dismiss();
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue