Skip to content
Snippets Groups Projects
Commit 48d00251 authored by Pierre Nicolas's avatar Pierre Nicolas :joy: Committed by Adrien Béraud
Browse files

account_settings: close keyboard after done clicked

GitLab: #1736
Change-Id: Iad67501e989e17aeccb1f23b92e60c5fced503fc
parent 9a608784
Branches
Tags
No related merge requests found
...@@ -32,6 +32,8 @@ import android.util.Log ...@@ -32,6 +32,8 @@ import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.* import android.widget.*
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.activity.result.PickVisualMediaRequest import androidx.activity.result.PickVisualMediaRequest
...@@ -249,6 +251,17 @@ class JamiAccountSummaryFragment : ...@@ -249,6 +251,17 @@ class JamiAccountSummaryFragment :
QRCodeFragment.newInstance(QRCodeFragment.INDEX_CODE) QRCodeFragment.newInstance(QRCodeFragment.INDEX_CODE)
.show(parentFragmentManager, QRCodeFragment.TAG) .show(parentFragmentManager, QRCodeFragment.TAG)
} }
binding.username.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
val inputMethodManager = requireContext()
.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(
requireActivity().currentFocus!!.windowToken, 0
)
binding.username.clearFocus()
}
false
}
binding.username.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus: Boolean -> binding.username.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus: Boolean ->
val name = binding.username.text val name = binding.username.text
if (!hasFocus) { if (!hasFocus) {
......
...@@ -116,6 +116,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -116,6 +116,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textPersonName" android:inputType="textPersonName"
android:maxLines="1" android:maxLines="1"
android:imeOptions="actionDone"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/text_color" android:textColor="@color/text_color"
android:textStyle="bold" /> android:textStyle="bold" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment