Refactor to use view visibility helper
This commit is contained in:
parent
9da575b4d0
commit
74591f5261
|
@ -20,6 +20,7 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
|
@ -47,9 +48,9 @@ class AttachmentTypeSelectorBottomSheet : VectorBaseBottomSheetDialogFragment<Bo
|
|||
|
||||
override fun invalidate() = withState(viewModel, timelineViewModel) { viewState, timelineState ->
|
||||
super.invalidate()
|
||||
views.location.visibility = if (viewState.isLocationVisible) View.VISIBLE else View.GONE
|
||||
views.voiceBroadcast.visibility = if (viewState.isVoiceBroadcastVisible) View.VISIBLE else View.GONE
|
||||
views.poll.visibility = if (!timelineState.isThreadTimeline()) View.VISIBLE else View.GONE
|
||||
views.location.isVisible = viewState.isLocationVisible
|
||||
views.voiceBroadcast.isVisible = viewState.isVoiceBroadcastVisible
|
||||
views.poll.isVisible = !timelineState.isThreadTimeline()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
Loading…
Reference in New Issue