@@ -35,6 +35,7 @@ import com.owncloud.android.domain.capabilities.model.OCCapability
3535import com.owncloud.android.domain.links.model.OCLinkType
3636import com.owncloud.android.domain.spaces.model.OCSpace
3737import com.owncloud.android.extensions.collectLatestLifecycleFlow
38+ import com.owncloud.android.extensions.hideSoftKeyboard
3839import com.owncloud.android.extensions.showErrorInSnackbar
3940import com.owncloud.android.presentation.capabilities.CapabilityViewModel
4041import com.owncloud.android.presentation.common.UIResult
@@ -190,6 +191,7 @@ class AddPublicLinkFragment: Fragment(), SetPasswordDialogFragment.SetPasswordLi
190191 }
191192
192193 private fun selectRadioButton (selectedRadioButton : RadioButton ) {
194+ hideKeyboardAndClearFocus()
193195 binding.publicLinkPermissions.apply {
194196 canViewPublicLinkRadioButton.isChecked = false
195197 canEditPublicLinkRadioButton.isChecked = false
@@ -203,6 +205,7 @@ class AddPublicLinkFragment: Fragment(), SetPasswordDialogFragment.SetPasswordLi
203205
204206 private fun bindDatePickerDialog (expirationDate : String? ) {
205207 binding.expirationDateLayout.expirationDateSwitch.setOnCheckedChangeListener { _, isChecked ->
208+ hideKeyboardAndClearFocus()
206209 if (isChecked) {
207210 openDatePickerDialog(expirationDate)
208211 } else {
@@ -249,14 +252,21 @@ class AddPublicLinkFragment: Fragment(), SetPasswordDialogFragment.SetPasswordLi
249252 }
250253
251254 private fun showPasswordDialog (password : String? = null) {
255+ binding.publicLinkNameEditText.clearFocus()
252256 val dialog = SetPasswordDialogFragment .newInstance(accountName, password, this )
253257 dialog.show(parentFragmentManager, DIALOG_SET_PASSWORD )
254258 }
255259
256260 private fun removePassword () {
261+ hideKeyboardAndClearFocus()
257262 spaceLinksViewModel.onPasswordSelected(null )
258263 }
259264
265+ private fun hideKeyboardAndClearFocus () {
266+ hideSoftKeyboard()
267+ binding.publicLinkNameEditText.clearFocus()
268+ }
269+
260270 companion object {
261271 private const val DIALOG_SET_PASSWORD = " DIALOG_SET_PASSWORD"
262272 private const val ARG_ACCOUNT_NAME = " ARG_ACCOUNT_NAME"
0 commit comments