mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 22:34:02 +01:00
fix: fixed the bug that was causing one ImageFragment testcase to fail.
This commit is contained in:
parent
1823f8359c
commit
e95cd14321
1 changed files with 17 additions and 15 deletions
|
|
@ -233,21 +233,6 @@ class ImageFragment :
|
||||||
onChangeSwitchState(isChecked)
|
onChangeSwitchState(isChecked)
|
||||||
_switchState.value = isChecked
|
_switchState.value = isChecked
|
||||||
}
|
}
|
||||||
|
|
||||||
viewLifecycleOwner.lifecycleScope.launch {
|
|
||||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
|
||||||
combine(
|
|
||||||
imageAdapter.currentImagesCount,
|
|
||||||
switchState
|
|
||||||
) { imageCount, isChecked ->
|
|
||||||
imageCount to isChecked
|
|
||||||
}.collect { (imageCount, isChecked) ->
|
|
||||||
binding?.allImagesUploadedOrMarked?.isVisible =
|
|
||||||
!isChecked && imageCount == 0 && (switch?.isVisible == true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectorRV = binding?.selectorRv
|
selectorRV = binding?.selectorRv
|
||||||
loader = binding?.loader
|
loader = binding?.loader
|
||||||
progressLayout = binding?.progressLayout
|
progressLayout = binding?.progressLayout
|
||||||
|
|
@ -267,6 +252,23 @@ class ImageFragment :
|
||||||
return binding?.root
|
return binding?.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||||
|
combine(
|
||||||
|
imageAdapter.currentImagesCount,
|
||||||
|
switchState
|
||||||
|
) { imageCount, isChecked ->
|
||||||
|
imageCount to isChecked
|
||||||
|
}.collect { (imageCount, isChecked) ->
|
||||||
|
binding?.allImagesUploadedOrMarked?.isVisible =
|
||||||
|
!isChecked && imageCount == 0 && (switch?.isVisible == true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun onChangeSwitchState(checked: Boolean) {
|
private fun onChangeSwitchState(checked: Boolean) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
showAlreadyActionedImages = true
|
showAlreadyActionedImages = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue