diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt b/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt index f2bd0b74801f..37e9487b3b20 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/cardviewer/ViewerCommand.kt @@ -29,8 +29,6 @@ import com.ichi2.anki.reviewer.MappableBinding import com.ichi2.anki.reviewer.MappableBinding.Companion.fromPreference import com.ichi2.anki.reviewer.MappableBinding.Companion.toPreferenceString import com.ichi2.anki.reviewer.MappableBinding.Screen -import java.util.Arrays -import java.util.stream.Collectors /** Abstraction: Discuss moving many of these to 'Reviewer' */ enum class ViewerCommand(val resourceId: Int) { @@ -88,11 +86,6 @@ enum class ViewerCommand(val resourceId: Int) { ; companion object { - val allDefaultBindings: List - get() = Arrays.stream(entries.toTypedArray()) - .flatMap { x: ViewerCommand -> x.defaultValue.stream() } - .collect(Collectors.toList()) - fun fromPreferenceKey(key: String) = entries.first { it.preferenceKey == key } } diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/reviewer/MappableBindingTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/reviewer/MappableBindingTest.kt index 50835643477a..69a04236599c 100644 --- a/AnkiDroid/src/test/java/com/ichi2/anki/reviewer/MappableBindingTest.kt +++ b/AnkiDroid/src/test/java/com/ichi2/anki/reviewer/MappableBindingTest.kt @@ -17,10 +17,13 @@ package com.ichi2.anki.reviewer import android.view.KeyEvent import com.ichi2.anki.cardviewer.ViewerCommand +import com.ichi2.anki.cardviewer.ViewerCommand.entries import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.hasItem import org.hamcrest.Matchers.not import org.junit.Test +import java.util.Arrays +import java.util.stream.Collectors class MappableBindingTest { @Test @@ -39,7 +42,9 @@ class MappableBindingTest { assertThat(allBindings, not(hasItem(keyCode(KeyEvent.KEYCODE_L)))) } - private fun getAllBindings() = ViewerCommand.allDefaultBindings + private fun getAllBindings() = Arrays.stream(entries.toTypedArray()) + .flatMap { x: ViewerCommand -> x.defaultValue.stream() } + .collect(Collectors.toList()) @Suppress("SameParameterValue") private fun keyCode(code: Int) = fromBinding(BindingTest.keyCode(code))