mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
trigger register on press enter
This commit is contained in:
parent
547a8bd000
commit
407f6aa3a5
@ -2,7 +2,10 @@ package org.thoughtcrime.securesms.loki.redesign.activities
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import android.widget.TextView.OnEditorActionListener
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import kotlinx.android.synthetic.main.activity_display_name.*
|
import kotlinx.android.synthetic.main.activity_display_name.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
@ -21,6 +24,19 @@ class DisplayNameActivity : BaseActionBarActivity() {
|
|||||||
setUpActionBarSessionLogo()
|
setUpActionBarSessionLogo()
|
||||||
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(
|
||||||
|
OnEditorActionListener { _, actionId, event ->
|
||||||
|
// Handle validation from keyboard to trigger registration
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH ||
|
||||||
|
actionId == EditorInfo.IME_ACTION_DONE ||
|
||||||
|
(event.action === KeyEvent.ACTION_DOWN
|
||||||
|
&& event.keyCode === KeyEvent.KEYCODE_ENTER)) {
|
||||||
|
this.register();
|
||||||
|
return@OnEditorActionListener true
|
||||||
|
}
|
||||||
|
// Return true if you have consumed the action, else false.
|
||||||
|
false
|
||||||
|
})
|
||||||
registerButton.setOnClickListener { register() }
|
registerButton.setOnClickListener { register() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user