mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-05 21:20:45 +00:00
Closes #5465: Added OnCheckListener to all checkboxes ,when there are no items checked delete button will be disabled (#6098)
This commit is contained in:
parent
485ccba189
commit
d223a0bd35
@ -51,6 +51,10 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
|
||||
})
|
||||
}
|
||||
|
||||
getCheckboxes().forEach {
|
||||
it.onCheckListener = { _ -> updateDeleteButton() }
|
||||
}
|
||||
|
||||
getCheckboxes().forEach { it.isChecked = true }
|
||||
|
||||
view.delete_data?.setOnClickListener {
|
||||
@ -58,6 +62,13 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDeleteButton() {
|
||||
val enabled = getCheckboxes().any { it.isChecked }
|
||||
|
||||
view?.delete_data?.isEnabled = enabled
|
||||
view?.delete_data?.alpha = if (enabled) ENABLED_ALPHA else DISABLED_ALPHA
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
(activity as AppCompatActivity).apply {
|
||||
|
Loading…
Reference in New Issue
Block a user