@@ -23,7 +23,6 @@ package com.ichi2.anki
2323
2424import android.annotation.SuppressLint
2525import android.content.ActivityNotFoundException
26- import android.content.ClipboardManager
2726import android.content.Context
2827import android.content.Intent
2928import android.content.SharedPreferences
@@ -149,7 +148,6 @@ import com.ichi2.libanki.undoableOp
149148import com.ichi2.themes.Themes
150149import com.ichi2.themes.Themes.getResFromAttr
151150import com.ichi2.ui.FixedEditText
152- import com.ichi2.utils.ClipboardUtil.getText
153151import com.ichi2.utils.HandlerUtils.newHandler
154152import com.ichi2.utils.HashUtil.hashSetInit
155153import com.ichi2.utils.Stopwatch
@@ -243,7 +241,6 @@ abstract class AbstractFlashcardViewer :
243241 internal var easeButton3: EaseButton ? = null
244242 internal var easeButton4: EaseButton ? = null
245243 protected var topBarLayout: RelativeLayout ? = null
246- private val clipboard: ClipboardManager ? = null
247244 private var previousAnswerIndicator: PreviousAnswerIndicator ? = null
248245
249246 private var currentEase: Ease ? = null
@@ -282,9 +279,6 @@ abstract class AbstractFlashcardViewer :
282279 var cardContent: String? = null
283280 private set
284281
285- private var viewerUrl: String? = null
286- private val fadeDuration = 300
287-
288282 @VisibleForTesting(otherwise = VisibleForTesting .PROTECTED )
289283 internal lateinit var cardMediaPlayer: CardMediaPlayer
290284
@@ -403,7 +397,7 @@ abstract class AbstractFlashcardViewer :
403397 val diffX = abs(event.rawX - touchX)
404398 val diffY = abs(event.rawY - touchY)
405399 // If a click is not coming then we reset the touch
406- if (diffX > Companion . CLICK_ACTION_THRESHOLD || diffY > Companion . CLICK_ACTION_THRESHOLD ) {
400+ if (diffX > CLICK_ACTION_THRESHOLD || diffY > CLICK_ACTION_THRESHOLD ) {
407401 hasBeenTouched = false
408402 }
409403 }
@@ -734,19 +728,6 @@ abstract class AbstractFlashcardViewer :
734728
735729 protected open fun answerFieldIsFocused (): Boolean = answerField != null && answerField!! .isFocused
736730
737- protected fun clipboardHasText (): Boolean = ! getText(clipboard).isNullOrEmpty()
738-
739- /* *
740- * Returns the text stored in the clipboard or the empty string if the clipboard is empty or contains something that
741- * cannot be converted to text.
742- *
743- * @return the text in clipboard or the empty string.
744- */
745- private fun clipboardGetText (): CharSequence {
746- val text = getText(clipboard)
747- return text ? : " "
748- }
749-
750731 val deckOptionsLauncher =
751732 registerForActivityResult(ActivityResultContracts .StartActivityForResult ()) { _ ->
752733 Timber .i(" Returned from deck options -> Restarting activity" )
@@ -2073,7 +2054,7 @@ abstract class AbstractFlashcardViewer :
20732054 private fun isTouchingEdge (e1 : MotionEvent ): Boolean {
20742055 val height = touchLayer!! .height
20752056 val width = touchLayer!! .width
2076- val margin = Companion . NO_GESTURE_BORDER_DIP * resources.displayMetrics.density + 0.5f
2057+ val margin = NO_GESTURE_BORDER_DIP * resources.displayMetrics.density + 0.5f
20772058 return e1.x < margin || e1.y < margin || height - e1.y < margin || width - e1.x < margin
20782059 }
20792060
@@ -2143,7 +2124,7 @@ abstract class AbstractFlashcardViewer :
21432124 private fun initShakeDetector () {
21442125 Timber .d(" Initializing shake detector" )
21452126 if (gestureProcessor.isBound(Gesture .SHAKE )) {
2146- val sensorManager = getSystemService(Context . SENSOR_SERVICE ) as SensorManager
2127+ val sensorManager = getSystemService(SENSOR_SERVICE ) as SensorManager
21472128 shakeDetector =
21482129 ShakeDetector (this ).apply {
21492130 start(sensorManager, SensorManager .SENSOR_DELAY_UI )
@@ -2456,7 +2437,7 @@ abstract class AbstractFlashcardViewer :
24562437 return true
24572438 }
24582439
2459- when (val signalOrdinal = url.toSignal()) {
2440+ when (url.toSignal()) {
24602441 Signal .SIGNAL_UNHANDLED -> {}
24612442 Signal .SIGNAL_NOOP -> return true
24622443 Signal .TYPE_FOCUS -> return true
0 commit comments