Skip to content

Commit 0e3924b

Browse files
committed
Move lambdas argument out of parentheses in LayoutPreviewFragment
1 parent daf41c8 commit 0e3924b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

WordPress/src/main/java/org/wordpress/android/ui/layoutpicker/LayoutPreviewFragment.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ abstract class LayoutPreviewFragment : FullscreenBottomSheetDialogFragment() {
7575
private fun initViewModel() {
7676
this.viewModel = getViewModel()
7777

78-
viewModel.previewState.observe(viewLifecycleOwner, { state ->
78+
viewModel.previewState.observe(viewLifecycleOwner) { state ->
7979
when (state) {
8080
is Loading -> {
8181
binding?.desktopPreviewHint?.setVisible(false)
@@ -84,6 +84,7 @@ abstract class LayoutPreviewFragment : FullscreenBottomSheetDialogFragment() {
8484
binding?.errorView?.setVisible(false)
8585
binding?.webView?.loadUrl(state.url)
8686
}
87+
8788
is Loaded -> {
8889
binding?.progressBar?.setVisible(false)
8990
binding?.webView?.setVisible(true)
@@ -97,21 +98,22 @@ abstract class LayoutPreviewFragment : FullscreenBottomSheetDialogFragment() {
9798
)
9899
AniUtils.animateBottomBar(binding?.desktopPreviewHint, true)
99100
}
101+
100102
is Error -> {
101103
binding?.progressBar?.setVisible(false)
102104
binding?.webView?.setVisible(false)
103105
binding?.errorView?.setVisible(true)
104106
state.toast?.let { ToastUtils.showToast(requireContext(), it) }
105107
}
106108
}
107-
})
109+
}
108110

109111
// We're skipping the first emitted value since it derives from the view model initialization (`start` method)
110-
viewModel.previewMode.skip(1).observe(viewLifecycleOwner, { load() })
112+
viewModel.previewMode.skip(1).observe(viewLifecycleOwner) { load() }
111113

112-
viewModel.onPreviewModeButtonPressed.observe(viewLifecycleOwner, {
114+
viewModel.onPreviewModeButtonPressed.observe(viewLifecycleOwner) {
113115
previewModeSelectorPopup.show(viewModel)
114-
})
116+
}
115117

116118
binding?.previewTypeSelectorButton?.let {
117119
previewModeSelectorPopup = PreviewModeSelectorPopup(requireActivity(), it)

0 commit comments

Comments
 (0)