Skip to content

Commit 13b8940

Browse files
committed
fix(study-screen): timer on big screens
if `Show answer buttons` was disable, the timer was visible even if disabled
1 parent 44931bc commit 13b8940

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/settings/Prefs.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ open class PrefsRepository(
339339
get() = getBoolean(R.string.dev_options_enabled_by_user_key, false) || BuildConfig.DEBUG
340340
set(value) = putBoolean(R.string.dev_options_enabled_by_user_key, value)
341341

342-
val isNewStudyScreenEnabled by booleanPref(R.string.new_reviewer_options_key, false)
342+
var isNewStudyScreenEnabled by booleanPref(R.string.new_reviewer_options_key, false)
343343

344344
val devIsCardBrowserFragmented: Boolean
345345
get() = getBoolean(R.string.dev_card_browser_fragmented, false)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class ReviewerFragment :
483483
connect(
484484
R.id.reviewer_menu_view,
485485
ConstraintSet.START,
486-
R.id.counts_flow,
486+
R.id.counts_barrier,
487487
ConstraintSet.END,
488488
)
489489
applyTo(binding.toolsLayout)

AnkiDroid/src/main/res/layout-sw720dp/reviewer2.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@
152152
android:id="@+id/study_counts"
153153
android:layout_width="wrap_content"
154154
android:layout_height="wrap_content"
155+
app:layout_constraintTop_toTopOf="parent"
156+
app:layout_constraintStart_toEndOf="@id/back_button"
157+
app:layout_constraintBottom_toTopOf="@id/timer"
155158
/>
156159

157160
<!-- Timer below counts means UI elements may jump if timer is selectively enabled.
@@ -161,23 +164,20 @@
161164
android:id="@+id/timer"
162165
android:layout_width="wrap_content"
163166
android:layout_height="wrap_content"
167+
app:layout_constraintStart_toEndOf="@id/back_button"
168+
app:layout_constraintEnd_toEndOf="@id/counts_barrier"
169+
app:layout_constraintTop_toBottomOf="@id/study_counts"
170+
app:layout_constraintBottom_toBottomOf="parent"
164171
android:visibility="gone"
165172
tools:visibility="visible"
166173
/>
167174

168-
<androidx.constraintlayout.helper.widget.Flow
169-
android:id="@+id/counts_flow"
175+
<androidx.constraintlayout.widget.Barrier
176+
android:id="@+id/counts_barrier"
170177
android:layout_width="wrap_content"
171178
android:layout_height="wrap_content"
172-
app:constraint_referenced_ids="study_counts,timer"
173-
app:flow_wrapMode="chain"
174-
app:flow_verticalStyle="packed"
175-
app:flow_verticalGap="4dp"
176-
app:flow_maxElementsWrap="1"
177-
app:layout_constraintTop_toTopOf="parent"
178-
app:layout_constraintBottom_toBottomOf="parent"
179-
app:layout_constraintStart_toEndOf="@id/back_button"
180-
/>
179+
app:barrierDirection="end"
180+
app:constraint_referenced_ids="study_counts, timer"/>
181181

182182
<com.ichi2.anki.ui.windows.reviewer.AnswerAreaView
183183
android:id="@+id/answer_area"

AnkiDroid/src/main/res/layout/reviewer2.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
android:id="@+id/study_counts"
4444
android:layout_width="wrap_content"
4545
android:layout_height="wrap_content"
46+
app:layout_constraintTop_toTopOf="parent"
47+
app:layout_constraintStart_toEndOf="@id/back_button"
48+
app:layout_constraintBottom_toTopOf="@id/timer"
4649
/>
4750

4851
<!-- Timer below counts means UI elements may jump if timer is selectively enabled.
@@ -52,31 +55,28 @@
5255
android:id="@+id/timer"
5356
android:layout_width="wrap_content"
5457
android:layout_height="wrap_content"
58+
app:layout_constraintStart_toEndOf="@id/back_button"
59+
app:layout_constraintEnd_toStartOf="@id/counts_barrier"
60+
app:layout_constraintTop_toBottomOf="@id/study_counts"
61+
app:layout_constraintBottom_toBottomOf="parent"
5562
android:visibility="gone"
5663
tools:visibility="visible"
5764
/>
5865

59-
<androidx.constraintlayout.helper.widget.Flow
60-
android:id="@+id/counts_flow"
66+
<androidx.constraintlayout.widget.Barrier
67+
android:id="@+id/counts_barrier"
6168
android:layout_width="wrap_content"
6269
android:layout_height="wrap_content"
63-
app:constraint_referenced_ids="study_counts,timer"
64-
app:flow_wrapMode="chain"
65-
app:flow_verticalStyle="packed"
66-
app:flow_verticalGap="4dp"
67-
app:flow_maxElementsWrap="1"
68-
app:layout_constraintTop_toTopOf="parent"
69-
app:layout_constraintBottom_toBottomOf="parent"
70-
app:layout_constraintStart_toEndOf="@id/back_button"
71-
/>
70+
app:barrierDirection="end"
71+
app:constraint_referenced_ids="study_counts, timer"/>
7272

7373
<com.ichi2.anki.preferences.reviewer.ReviewerMenuView
7474
android:id="@+id/reviewer_menu_view"
7575
android:layout_width="0dp"
7676
android:layout_height="0dp"
7777
app:layout_constraintBottom_toBottomOf="parent"
7878
app:layout_constraintEnd_toEndOf="parent"
79-
app:layout_constraintStart_toEndOf="@id/counts_flow"
79+
app:layout_constraintStart_toEndOf="@id/counts_barrier"
8080
app:layout_constraintTop_toTopOf="parent"
8181
android:layout_marginStart="12dp"/>
8282

AnkiDroid/src/test/java/com/ichi2/anki/ui/windows/reviewer/StudyScreenScreenshotTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith
2929
import org.robolectric.ParameterizedRobolectricTestRunner
3030
import org.robolectric.RuntimeEnvironment
3131

32-
@Ignore("screenshots tests should be separated from the general unit tests task")
3332
@RunWith(ParameterizedRobolectricTestRunner::class)
3433
class StudyScreenScreenshotTest(
3534
private val config: TestConfig,
3635
) : ScreenshotTest() {
3736
init {
37+
Prefs.isNewStudyScreenEnabled = true
3838
Prefs.toolbarPosition = config.toolbarPosition
3939
Prefs.showAnswerButtons = config.showAnswerButtons
4040
Prefs.frameStyle = config.frameStyle
@@ -65,8 +65,8 @@ class StudyScreenScreenshotTest(
6565
val buttonStates = listOf(true, false)
6666
// val buttonStates = listOf(true)
6767

68-
val styles = FrameStyle.entries
69-
// val styles = listOf(FrameStyle.BOX)
68+
// val styles = FrameStyle.entries
69+
val styles = listOf(FrameStyle.BOX)
7070

7171
val devices =
7272
listOf(

0 commit comments

Comments
 (0)