Fixed radio button acting up
This commit is contained in:
@@ -78,6 +78,15 @@ class DownloadLocationDialogFragment : DialogFragment(), DIAware {
|
||||
if (key == null) entries[key]!!.locationAvailable.text = downloadFolder
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val downloadFolder = DownloadManager.getInstance(context ?: return@registerForActivityResult).downloadFolder.canonicalPath
|
||||
val key = entries.keys.firstOrNull { it?.canonicalPath == downloadFolder }
|
||||
if (key == null)
|
||||
entries[key]!!.locationAvailable.text = downloadFolder
|
||||
else {
|
||||
entries[null]!!.button.isChecked = false
|
||||
entries[key]!!.button.isChecked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,8 +106,8 @@ class DownloadLocationDialogFragment : DialogFragment(), DIAware {
|
||||
byteToString(dir.freeSpace)
|
||||
)
|
||||
root.setOnClickListener {
|
||||
entries.values.forEach { _ ->
|
||||
button.isChecked = false
|
||||
entries.values.forEach { entry ->
|
||||
entry.button.isChecked = false
|
||||
}
|
||||
button.performClick()
|
||||
Preferences["download_folder"] = dir.toUri().toString()
|
||||
@@ -110,8 +119,8 @@ class DownloadLocationDialogFragment : DialogFragment(), DIAware {
|
||||
DownloadLocationItemBinding.inflate(layoutInflater, binding.root, true).apply {
|
||||
locationType.text = requireContext().getString(R.string.settings_download_folder_custom)
|
||||
root.setOnClickListener {
|
||||
entries.values.forEach {
|
||||
it.button.isChecked = false
|
||||
entries.values.forEach { entry ->
|
||||
entry.button.isChecked = false
|
||||
}
|
||||
button.performClick()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user