Fixed radio button acting up
This commit is contained in:
@@ -75,6 +75,15 @@ class DownloadLocationDialogFragment : DialogFragment() {
|
|||||||
if (key == null) entries[key]!!.locationAvailable.text = downloadFolder
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +129,8 @@ class DownloadLocationDialogFragment : DialogFragment() {
|
|||||||
byteToString(dir.freeSpace)
|
byteToString(dir.freeSpace)
|
||||||
)
|
)
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
entries.values.forEach { _ ->
|
entries.values.forEach { entry ->
|
||||||
button.isChecked = false
|
entry.button.isChecked = false
|
||||||
}
|
}
|
||||||
button.performClick()
|
button.performClick()
|
||||||
Preferences["download_folder"] = dir.toUri().toString()
|
Preferences["download_folder"] = dir.toUri().toString()
|
||||||
@@ -133,8 +142,8 @@ class DownloadLocationDialogFragment : DialogFragment() {
|
|||||||
DownloadLocationItemBinding.inflate(layoutInflater, binding.root, true).apply {
|
DownloadLocationItemBinding.inflate(layoutInflater, binding.root, true).apply {
|
||||||
locationType.text = requireContext().getString(R.string.settings_download_folder_custom)
|
locationType.text = requireContext().getString(R.string.settings_download_folder_custom)
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
entries.values.forEach {
|
entries.values.forEach { entry ->
|
||||||
it.button.isChecked = false
|
entry.button.isChecked = false
|
||||||
}
|
}
|
||||||
button.performClick()
|
button.performClick()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user