@@ -35,6 +35,7 @@ import androidx.appcompat.view.menu.SubMenuBuilder
3535import androidx.appcompat.widget.ActionMenuView
3636import androidx.appcompat.widget.AppCompatImageButton
3737import androidx.constraintlayout.widget.ConstraintLayout
38+ import androidx.constraintlayout.widget.ConstraintSet
3839import androidx.coordinatorlayout.widget.CoordinatorLayout
3940import androidx.core.content.getSystemService
4041import androidx.core.view.ViewCompat
@@ -251,17 +252,24 @@ class ReviewerFragment :
251252
252253 private fun setupAnswerButtons (view : View ) {
253254 val prefs = sharedPrefs()
254- val answerButtonsLayout = view.findViewById<LinearLayout >(R .id.answer_buttons)
255255 val answerArea = view.findViewById<FrameLayout >(R .id.answer_area)
256256 if (prefs.getBoolean(getString(R .string.hide_answer_buttons_key), false )) {
257+ answerArea.isVisible = false
257258 if (! resources.isWindowCompact()) {
259+ val constraintLayout = view.findViewById<ConstraintLayout >(R .id.bottom_bar)
258260 // Expand the menu if there is no answer buttons in big screens
259- view.findViewById<ReviewerMenuView >(R .id.reviewer_menu_view).updateLayoutParams<ConstraintLayout .LayoutParams > {
260- matchConstraintMaxWidth = 0
261+ with (ConstraintSet ()) {
262+ clone(constraintLayout)
263+ clear(R .id.reviewer_menu_view, ConstraintSet .START )
264+ connect(
265+ R .id.reviewer_menu_view,
266+ ConstraintSet .START ,
267+ R .id.guideline_counts,
268+ ConstraintSet .END ,
269+ )
270+ applyTo(constraintLayout)
261271 }
262272 }
263- answerButtonsLayout?.isVisible = false
264- answerArea?.isVisible = false
265273 return
266274 }
267275
@@ -307,6 +315,7 @@ class ReviewerFragment :
307315 viewModel.onShowAnswer(typedAnswer = typedAnswer)
308316 }
309317 }
318+ val answerButtonsLayout = view.findViewById<LinearLayout >(R .id.answer_buttons)
310319
311320 viewModel.showingAnswer.collectLatestIn(lifecycleScope) { isAnswerShown ->
312321 if (isAnswerShown) {
0 commit comments