@@ -11,6 +11,7 @@ import android.view.View
1111import android.widget.Toast
1212import androidx.core.text.buildSpannedString
1313import androidx.core.text.color
14+ import androidx.drawerlayout.widget.DrawerLayout
1415import androidx.fragment.app.viewModels
1516import androidx.lifecycle.Lifecycle
1617import androidx.lifecycle.LiveData
@@ -204,25 +205,6 @@ class FlowFieldFragment :
204205 viewModel.setLiveDataObservers()
205206 }
206207
207- private fun ViewModel.setLiveDataObservers () {
208- hideButtonsLive.observe(viewLifecycleOwner) { hideForeground ->
209- binding.highAlphaForegroundLayout.let {
210- if (hideForeground) {
211- if (lifecycle.currentState == Lifecycle .State .STARTED )
212- it.hide()
213- else {
214- buttonFadeAnimation?.stop()
215- buttonFadeAnimation = it.fadeOut()
216- }
217- }
218- else {
219- buttonFadeAnimation?.stop()
220- buttonFadeAnimation = it.fadeIn()
221- }
222- }
223- }
224- }
225-
226208 private fun FragmentFlowfieldBinding.showLayoutElements () {
227209 val savedAnyCrops: Boolean = viewModel.accumulatedIoResults?.let { it.nSavedCrops != 0 }
228210 ? : false
@@ -272,6 +254,27 @@ class FlowFieldFragment :
272254 }
273255 }
274256
257+ private fun ViewModel.setLiveDataObservers () {
258+ hideButtonsLive.observe(viewLifecycleOwner) { hideForeground ->
259+ if (hideForeground) {
260+ binding.drawerLayout.setDrawerLockMode(DrawerLayout .LOCK_MODE_LOCKED_CLOSED )
261+
262+ if (lifecycle.currentState == Lifecycle .State .STARTED )
263+ binding.highAlphaForegroundLayout.hide()
264+ else {
265+ buttonFadeAnimation?.stop()
266+ buttonFadeAnimation = binding.highAlphaForegroundLayout.fadeOut()
267+ }
268+ }
269+ else {
270+ binding.drawerLayout.setDrawerLockMode(DrawerLayout .LOCK_MODE_UNLOCKED )
271+
272+ buttonFadeAnimation?.stop()
273+ buttonFadeAnimation = binding.highAlphaForegroundLayout.fadeIn()
274+ }
275+ }
276+ }
277+
275278 /* *
276279 * ActivityCallContractAdministrators
277280 */
0 commit comments