Skip to content

Commit 78ffe8c

Browse files
committed
style(new reviewer): update tablets layout
1 parent 4d084ef commit 78ffe8c

File tree

3 files changed

+174
-171
lines changed

3 files changed

+174
-171
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import androidx.appcompat.view.menu.SubMenuBuilder
3535
import androidx.appcompat.widget.ActionMenuView
3636
import androidx.appcompat.widget.AppCompatImageButton
3737
import androidx.constraintlayout.widget.ConstraintLayout
38+
import androidx.constraintlayout.widget.ConstraintSet
3839
import androidx.coordinatorlayout.widget.CoordinatorLayout
3940
import androidx.core.content.getSystemService
4041
import 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

Comments
 (0)