Skip to content

Commit fd69c24

Browse files
committed
refactor: move password listeners to a private fun to avoid Detekt warnings
1 parent dc7c6a8 commit fd69c24

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/links/AddPublicLinkFragment.kt‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,7 @@ class AddPublicLinkFragment: Fragment(), SetPasswordDialogFragment.SetPasswordLi
168168

169169
bindRadioButtonsListeners()
170170

171-
binding.passwordLayout.apply {
172-
setPasswordButton.setOnClickListener {
173-
showPasswordDialog()
174-
}
175-
removePasswordButton.setOnClickListener {
176-
removePassword()
177-
}
178-
setPasswordSwitch.setOnClickListener {
179-
if (setPasswordSwitch.isChecked) showPasswordDialog() else removePassword()
180-
}
181-
}
171+
bindPasswordListeners()
182172

183173
binding.createPublicLinkButton.setOnClickListener {
184174
val displayName = binding.publicLinkNameEditText.text.toString().ifEmpty { getString(R.string.public_link_default_display_name) }
@@ -282,6 +272,20 @@ class AddPublicLinkFragment: Fragment(), SetPasswordDialogFragment.SetPasswordLi
282272
}
283273
}
284274

275+
private fun bindPasswordListeners() {
276+
binding.passwordLayout.apply {
277+
setPasswordButton.setOnClickListener {
278+
showPasswordDialog()
279+
}
280+
removePasswordButton.setOnClickListener {
281+
removePassword()
282+
}
283+
setPasswordSwitch.setOnClickListener {
284+
if (setPasswordSwitch.isChecked) showPasswordDialog() else removePassword()
285+
}
286+
}
287+
}
288+
285289
private fun showPasswordDialog(password: String? = null) {
286290
binding.publicLinkNameEditText.clearFocus()
287291
val dialog = SetPasswordDialogFragment.newInstance(accountName, password, this)

0 commit comments

Comments
 (0)