mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +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.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.TextView.OnEditorActionListener
|
||||
import android.widget.Toast
|
||||
import kotlinx.android.synthetic.main.activity_display_name.*
|
||||
import network.loki.messenger.R
|
||||
@ -21,6 +24,19 @@ class DisplayNameActivity : BaseActionBarActivity() {
|
||||
setUpActionBarSessionLogo()
|
||||
setContentView(R.layout.activity_display_name)
|
||||
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() }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user