This commit is contained in:
nielsandriesse 2020-04-17 16:12:29 +10:00
parent 18b95c7f8a
commit 0e95c8cec3

View File

@ -23,16 +23,14 @@ class DisplayNameActivity : BaseActionBarActivity() {
setContentView(R.layout.activity_display_name) setContentView(R.layout.activity_display_name)
displayNameEditText.imeOptions = displayNameEditText.imeOptions or 16777216 // Always use incognito keyboard displayNameEditText.imeOptions = displayNameEditText.imeOptions or 16777216 // Always use incognito keyboard
displayNameEditText.setOnEditorActionListener( displayNameEditText.setOnEditorActionListener(
OnEditorActionListener { _, actionId, event -> OnEditorActionListener { _, actionID, event ->
// Handle validation from keyboard to trigger registration if (actionID == EditorInfo.IME_ACTION_SEARCH ||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionID == EditorInfo.IME_ACTION_DONE ||
actionId == EditorInfo.IME_ACTION_DONE || (event.action == KeyEvent.ACTION_DOWN &&
(event.action === KeyEvent.ACTION_DOWN event.keyCode == KeyEvent.KEYCODE_ENTER)) {
&& event.keyCode === KeyEvent.KEYCODE_ENTER)) { this.register()
this.register();
return@OnEditorActionListener true return@OnEditorActionListener true
} }
// Return true if you have consumed the action, else false.
false false
}) })
registerButton.setOnClickListener { register() } registerButton.setOnClickListener { register() }