mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix keyboard showing/hiding issue
This commit is contained in:
parent
267a94b8ef
commit
a0e186e8f6
@ -1,14 +1,17 @@
|
||||
package org.thoughtcrime.securesms.loki.dialogs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.opengl.Visibility
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import kotlinx.android.synthetic.main.fragment_user_details_bottom_sheet.*
|
||||
import kotlinx.android.synthetic.main.view_conversation.view.*
|
||||
@ -38,15 +41,18 @@ public class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
||||
nameTextViewContainer.visibility = View.INVISIBLE
|
||||
nameEditContainer.visibility = View.VISIBLE
|
||||
nameEditText.requestFocus()
|
||||
showSoftKeyboard()
|
||||
}
|
||||
btnCancelNickNameEdit.setOnClickListener {
|
||||
nameEditText.clearFocus()
|
||||
hideSoftKeyboard()
|
||||
nameTextViewContainer.visibility = View.VISIBLE
|
||||
nameEditContainer.visibility = View.INVISIBLE
|
||||
nameEditText.text = null
|
||||
}
|
||||
btnSaveNickNameEdit.setOnClickListener {
|
||||
nameEditText.clearFocus()
|
||||
hideSoftKeyboard()
|
||||
nameTextViewContainer.visibility = View.VISIBLE
|
||||
nameEditContainer.visibility = View.INVISIBLE
|
||||
var newNickName: String? = null
|
||||
@ -65,4 +71,15 @@ public class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
||||
Toast.makeText(requireContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ServiceCast")
|
||||
fun showSoftKeyboard() {
|
||||
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||
imm?.showSoftInput(nameEditText, 0)
|
||||
}
|
||||
|
||||
fun hideSoftKeyboard() {
|
||||
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||
imm?.hideSoftInputFromWindow(nameEditText.windowToken, 0)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user