Request focus to transfer destination and show soft keyboard
when transfer dialog is displayed
This commit is contained in:
@@ -1058,7 +1058,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun callTransfer(ua: UserAgent) {
|
private fun callTransfer(ua: UserAgent) {
|
||||||
val layout = LayoutInflater.from(this)
|
val layout = LayoutInflater.from(this)
|
||||||
.inflate(R.layout.call_transfer_dialog, findViewById(android.R.id.content) as ViewGroup,
|
.inflate(R.layout.call_transfer_dialog, findViewById<ViewGroup>(android.R.id.content),
|
||||||
false)
|
false)
|
||||||
val titleView = layout.findViewById(R.id.title) as TextView
|
val titleView = layout.findViewById(R.id.title) as TextView
|
||||||
titleView.text = getString(R.string.call_transfer)
|
titleView.text = getString(R.string.call_transfer)
|
||||||
@@ -1066,12 +1066,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
transferUri.setAdapter(ArrayAdapter(this, android.R.layout.select_dialog_item,
|
transferUri.setAdapter(ArrayAdapter(this, android.R.layout.select_dialog_item,
|
||||||
Contact.contacts().map { Contact -> Contact.name }))
|
Contact.contacts().map { Contact -> Contact.name }))
|
||||||
transferUri.threshold = 2
|
transferUri.threshold = 2
|
||||||
with(AlertDialog.Builder(this)) {
|
transferUri.requestFocus()
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
with(builder) {
|
||||||
setView(layout)
|
setView(layout)
|
||||||
setPositiveButton(R.string.transfer) { dialog, _ ->
|
setPositiveButton(R.string.transfer) { dialog, _ ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
val uriText = transferUri.text.toString().trim()
|
val uriText = transferUri.text.toString().trim()
|
||||||
if (uriText.length > 0) {
|
if (uriText.isNotEmpty()) {
|
||||||
var uri = ContactsActivity.findContactURI(uriText)
|
var uri = ContactsActivity.findContactURI(uriText)
|
||||||
if (!uri.startsWith("sip:")) {
|
if (!uri.startsWith("sip:")) {
|
||||||
uri = "sip:$uri"
|
uri = "sip:$uri"
|
||||||
@@ -1095,8 +1097,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
setNegativeButton(android.R.string.cancel) { dialog, _ ->
|
||||||
dialog.cancel()
|
dialog.cancel()
|
||||||
}
|
}
|
||||||
show()
|
|
||||||
}
|
}
|
||||||
|
val alertDialog = builder.create()
|
||||||
|
// This needs to be done after dialog has been created and before it is shown
|
||||||
|
alertDialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
|
alertDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askPassword(title: String, ua: UserAgent? = null) {
|
private fun askPassword(title: String, ua: UserAgent? = null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user