Skip to content
Snippets Groups Projects
Unverified Commit 5e99ebb3 authored by BMItter's avatar BMItter Committed by GitHub
Browse files

Close keyboard when closing fragment (#2966)

parent b874f89c
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca ...@@ -58,7 +58,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca
DialogHelper.showDialog(deleteLocationConfirmationDialog) DialogHelper.showDialog(deleteLocationConfirmationDialog)
} }
locationSaveButton.setOnClickListener { locationSaveButton.setOnClickListener {
it.hideKeyboard()
viewModel.updateLocation( viewModel.updateLocation(
location, location,
phoneNumber = binding.locationPhoneInput.text.toString(), phoneNumber = binding.locationPhoneInput.text.toString(),
...@@ -71,7 +70,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca ...@@ -71,7 +70,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca
binding.apply { binding.apply {
locationDeleteButton.visibility = View.GONE locationDeleteButton.visibility = View.GONE
locationSaveButton.setOnClickListener { locationSaveButton.setOnClickListener {
it.hideKeyboard()
viewModel.addLocation( viewModel.addLocation(
phoneNumber = binding.locationPhoneInput.text.toString(), phoneNumber = binding.locationPhoneInput.text.toString(),
emailAddress = binding.locationEmailInput.text.toString() emailAddress = binding.locationEmailInput.text.toString()
...@@ -84,7 +82,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca ...@@ -84,7 +82,6 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca
locationNameInputEdit.focusAndShowKeyboard() locationNameInputEdit.focusAndShowKeyboard()
locationCloseButton.setOnClickListener { locationCloseButton.setOnClickListener {
it.hideKeyboard()
viewModel.closePressed() viewModel.closePressed()
} }
locationNameInputEdit.doAfterTextChanged { locationNameInputEdit.doAfterTextChanged {
...@@ -105,6 +102,7 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca ...@@ -105,6 +102,7 @@ class ContactDiaryAddLocationFragment : Fragment(R.layout.contact_diary_add_loca
} }
viewModel.shouldClose.observe2(this) { viewModel.shouldClose.observe2(this) {
binding.root.hideKeyboard()
popBackStack() popBackStack()
} }
......
...@@ -60,7 +60,6 @@ class ContactDiaryAddPersonFragment : ...@@ -60,7 +60,6 @@ class ContactDiaryAddPersonFragment :
DialogHelper.showDialog(deletePersonConfirmationDialog) DialogHelper.showDialog(deletePersonConfirmationDialog)
} }
personSaveButton.setOnClickListener { personSaveButton.setOnClickListener {
it.hideKeyboard()
viewModel.updatePerson( viewModel.updatePerson(
person, person,
phoneNumber = binding.personPhoneNumberInput.text.toString(), phoneNumber = binding.personPhoneNumberInput.text.toString(),
...@@ -72,7 +71,6 @@ class ContactDiaryAddPersonFragment : ...@@ -72,7 +71,6 @@ class ContactDiaryAddPersonFragment :
} else { } else {
binding.personDeleteButton.visibility = View.GONE binding.personDeleteButton.visibility = View.GONE
binding.personSaveButton.setOnClickListener { binding.personSaveButton.setOnClickListener {
it.hideKeyboard()
viewModel.addPerson( viewModel.addPerson(
phoneNumber = binding.personPhoneNumberInput.text.toString(), phoneNumber = binding.personPhoneNumberInput.text.toString(),
emailAddress = binding.personEmailInput.text.toString() emailAddress = binding.personEmailInput.text.toString()
...@@ -84,7 +82,6 @@ class ContactDiaryAddPersonFragment : ...@@ -84,7 +82,6 @@ class ContactDiaryAddPersonFragment :
personNameInput.focusAndShowKeyboard() personNameInput.focusAndShowKeyboard()
personCloseButton.setOnClickListener { personCloseButton.setOnClickListener {
it.hideKeyboard()
viewModel.closePressed() viewModel.closePressed()
} }
personNameInput.doAfterTextChanged { personNameInput.doAfterTextChanged {
...@@ -105,6 +102,7 @@ class ContactDiaryAddPersonFragment : ...@@ -105,6 +102,7 @@ class ContactDiaryAddPersonFragment :
} }
viewModel.shouldClose.observe2(this) { viewModel.shouldClose.observe2(this) {
binding.root.hideKeyboard()
popBackStack() popBackStack()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment