Skip to content

Commit

Permalink
fixeeeess
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Dec 25, 2024
1 parent 398f3bf commit 4ab55c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 4 additions & 2 deletions AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import com.ichi2.anki.reviewer.AnswerButtons.Companion.getBackgroundColors
import com.ichi2.anki.reviewer.AnswerButtons.Companion.getTextColors
import com.ichi2.anki.reviewer.AnswerTimer
import com.ichi2.anki.reviewer.AutomaticAnswerAction
import com.ichi2.anki.reviewer.Binding
import com.ichi2.anki.reviewer.BindingProcessor
import com.ichi2.anki.reviewer.CardMarker
import com.ichi2.anki.reviewer.CardSide
Expand Down Expand Up @@ -201,7 +202,7 @@ open class Reviewer :
private lateinit var toolbar: Toolbar

@VisibleForTesting
protected lateinit var processor: ScreenKeyMap<ReviewerBinding, ViewerCommand>
protected open lateinit var processor: ScreenKeyMap<ReviewerBinding, ViewerCommand>

private val addNoteLauncher =
registerForActivityResult(
Expand Down Expand Up @@ -1671,6 +1672,7 @@ open class Reviewer :
binding: ReviewerBinding,
): Boolean {
if (binding.side != CardSide.BOTH && CardSide.fromAnswer(isDisplayingAnswer) != binding.side) return false
return executeCommand(action, null)
val gesture = (binding.binding as? Binding.GestureInput)?.gesture
return executeCommand(action, gesture)
}
}
3 changes: 2 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/reviewer/Binding.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ sealed interface Binding {
append(unicodeCharacter)
}

override fun equals(other: Any?): Boolean = super.equals(other)
override fun equals(other: Any?): Boolean =
(other is UnicodeCharacter && unicodeCharacter == other.unicodeCharacter && modifierKeys == other.modifierKeys)

override fun hashCode(): Int = Objects.hash(unicodeCharacter, modifierKeys)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.ichi2.anki.reviewer.Binding.Companion.keyCode
import com.ichi2.anki.reviewer.Binding.ModifierKeys
import com.ichi2.anki.reviewer.CardSide
import com.ichi2.anki.reviewer.ReviewerBinding
import com.ichi2.anki.reviewer.ScreenKeyMap
import com.ichi2.libanki.Card
import kotlinx.coroutines.Job
import org.hamcrest.MatcherAssert.assertThat
Expand All @@ -56,6 +57,10 @@ import org.mockito.Mockito
import org.mockito.kotlin.whenever
import timber.log.Timber

// ReviewerKeyboardInputTest
// PreferencesAnalyticsTest
// PeripheralKeymapTest

@RunWith(AndroidJUnit4::class)
class ReviewerKeyboardInputTest : RobolectricTest() {
@Test
Expand Down Expand Up @@ -250,6 +255,9 @@ class ReviewerKeyboardInputTest : RobolectricTest() {
var replayAudioCalled = false
private set

override var processor: ScreenKeyMap<ReviewerBinding, ViewerCommand> =
ScreenKeyMap(sharedPrefs(), ViewerCommand.entries, this)

private val cardFlips = mutableListOf<String>()
override val isDrawerOpen: Boolean
get() = false
Expand Down

0 comments on commit 4ab55c6

Please sign in to comment.