Skip to content

Commit ba17024

Browse files
committed
fix: whiteboard control icon & label do not match
- For the "Toggle whiteboard" label in Controls settings page, replace the current "Show/Hide whiteboard" icon with "Enable whiteboard" icon - Add a new control item for "Show/Hide whiteboard"
1 parent 7133b31 commit ba17024

File tree

8 files changed

+30
-4
lines changed

8 files changed

+30
-4
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,11 @@ abstract class AbstractFlashcardViewer :
17341734
true
17351735
}
17361736

1737+
ViewerCommand.TOGGLE_WHITEBOARD_VISIBILITY -> {
1738+
toggleWhiteboardVisibility()
1739+
true
1740+
}
1741+
17371742
ViewerCommand.CLEAR_WHITEBOARD -> {
17381743
clearWhiteboard()
17391744
true
@@ -1801,6 +1806,10 @@ abstract class AbstractFlashcardViewer :
18011806
// intentionally blank
18021807
}
18031808

1809+
protected open fun toggleWhiteboardVisibility() {
1810+
// intentionally blank
1811+
}
1812+
18041813
protected open fun clearWhiteboard() {
18051814
// intentionally blank
18061815
}

AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,7 @@ open class Reviewer :
478478
}
479479
R.id.action_hide_whiteboard -> { // toggle whiteboard visibility
480480
Timber.i("Reviewer:: Whiteboard visibility set to %b", !showWhiteboard)
481-
setWhiteboardVisibility(!showWhiteboard)
482-
refreshActionBar()
481+
toggleWhiteboardVisibility()
483482
}
484483
R.id.action_toggle_stylus -> { // toggle stylus mode
485484
Timber.i("Reviewer:: Stylus set to %b", !toggleStylus)
@@ -538,6 +537,13 @@ open class Reviewer :
538537
refreshActionBar()
539538
}
540539

540+
public override fun toggleWhiteboardVisibility() {
541+
if (whiteboard != null) {
542+
setWhiteboardVisibility(!showWhiteboard)
543+
refreshActionBar()
544+
}
545+
}
546+
541547
public override fun clearWhiteboard() {
542548
if (whiteboard != null) {
543549
whiteboard!!.clear()

AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ object UsageAnalytics {
550550
R.string.replay_voice_command_key,
551551
R.string.save_voice_command_key,
552552
R.string.toggle_whiteboard_command_key,
553+
R.string.toggle_whiteboard_visibility_command_key,
553554
R.string.clear_whiteboard_command_key,
554555
R.string.change_whiteboard_pen_color_command_key,
555556
R.string.toggle_auto_advance_command_key,

AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ enum class ViewerCommand {
6060
SAVE_VOICE,
6161
REPLAY_VOICE,
6262
TOGGLE_WHITEBOARD,
63+
TOGGLE_WHITEBOARD_VISIBILITY,
6364
CLEAR_WHITEBOARD,
6465
CHANGE_WHITEBOARD_PEN_COLOR,
6566
SHOW_HINT,
@@ -173,7 +174,8 @@ enum class ViewerCommand {
173174
TAG,
174175
CARD_INFO,
175176
ABORT_AND_SYNC,
176-
TOGGLE_WHITEBOARD,
177+
TOGGLE_WHITEBOARD, // enable/disable whiteboard
178+
TOGGLE_WHITEBOARD_VISIBILITY, // show/hide whiteboard
177179
CLEAR_WHITEBOARD,
178180
CHANGE_WHITEBOARD_PEN_COLOR,
179181
RESCHEDULE_NOTE,

AnkiDroid/src/main/res/values/11-arrays.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<string name="gesture_page_down" maxLength="41">Page Down</string>
8484
<string name="gesture_abort_sync" maxLength="41">Close reviewer and Sync</string>
8585
<string name="gesture_toggle_whiteboard" maxLength="41">Toggle Whiteboard</string>
86+
<string name="gesture_toggle_whiteboard_visibility" maxLength="41">Show/Hide whiteboard</string>
8687
<string name="gesture_show_hint" maxLength="41">Show Hint</string>
8788
<string name="gesture_show_all_hints" maxLength="41">Show All Hints</string>
8889
<string name="record_voice" maxLength="41">Record Voice</string>

AnkiDroid/src/main/res/values/preferences.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<string name="replay_voice_command_key">binding_REPLAY_VOICE</string>
120120
<string name="save_voice_command_key">binding_SAVE_VOICE</string>
121121
<string name="toggle_whiteboard_command_key">binding_TOGGLE_WHITEBOARD</string>
122+
<string name="toggle_whiteboard_visibility_command_key">binding_TOGGLE_WHITEBOARD_VISIBILITY</string>
122123
<string name="clear_whiteboard_command_key">binding_CLEAR_WHITEBOARD</string>
123124
<string name="change_whiteboard_pen_color_command_key">binding_CHANGE_WHITEBOARD_PEN_COLOR</string>
124125
<string name="show_hint_command_key">binding_SHOW_HINT</string>

AnkiDroid/src/main/res/xml/preferences_controls.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@
233233
<com.ichi2.preferences.ReviewerControlPreference
234234
android:key="@string/toggle_whiteboard_command_key"
235235
android:title="@string/gesture_toggle_whiteboard"
236+
android:icon="@drawable/ic_enable_whiteboard"
237+
/>
238+
<com.ichi2.preferences.ReviewerControlPreference
239+
android:key="@string/toggle_whiteboard_visibility_command_key"
240+
android:title="@string/gesture_toggle_whiteboard_visibility"
236241
android:icon="@drawable/ic_gesture_white"
237242
/>
238243
<com.ichi2.preferences.ReviewerControlPreference

AnkiDroid/src/test/java/com/ichi2/anki/cardviewer/ViewerCommandTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class ViewerCommandTest {
6161
"binding_RECORD_VOICE",
6262
"binding_SAVE_VOICE",
6363
"binding_REPLAY_VOICE",
64-
"binding_TOGGLE_WHITEBOARD",
64+
"binding_TOGGLE_WHITEBOARD", // enable/disable whiteboard
65+
"binding_TOGGLE_WHITEBOARD_VISIBILITY", // show/hide whiteboard
6566
"binding_CLEAR_WHITEBOARD",
6667
"binding_CHANGE_WHITEBOARD_PEN_COLOR",
6768
"binding_SHOW_HINT",

0 commit comments

Comments
 (0)