Skip to content

Commit

Permalink
fix ide issues (ankidroid#15042)
Browse files Browse the repository at this point in the history
* ide issue in CardTemplatePreviewer
* ide issue in CollectionManager
* ide issue in CustomMaterialTapTargetPromptBuilder
* ide issue in DeckSpinnerSelection
* ide issue in Preferences
* ide issue in MediaRegistration
* ide issue in SharedDecksActivity
* ide issue in StudyOptionsActivity
* ide issue in Whiteboard
  • Loading branch information
MorenoTropical authored Dec 21, 2023
1 parent 925d1b9 commit a61c42e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
14 changes: 6 additions & 8 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardTemplatePreviewer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ open class CardTemplatePreviewer : AbstractFlashcardViewer() {
finishWithAnimation(ActivityTransitionAnimation.Direction.END)
}

@Suppress("DEPRECATION", "Deprecated in API34+dependencies for predictive back feature")
@Deprecated("Deprecated in Java")
@Suppress("Deprecated in API34+dependencies for predictive back feature")
override fun onBackPressed() {
Timber.i("CardTemplatePreviewer:: onBackPressed()")
super.onBackPressed()
Expand Down Expand Up @@ -392,14 +393,11 @@ open class CardTemplatePreviewer : AbstractFlashcardViewer() {
}

/** Override certain aspects of Card behavior so we may display unsaved data */
inner class PreviewerCard : Card {
private val mNote: Note?
inner class PreviewerCard(col: Collection, id: Long) : Card(col, id) {
private val mNote: Note? = null

constructor(col: Collection, id: Long) : super(col, id) {
mNote = null
}

/* if we have an unsaved note saved, use it instead of a collection lookup */ override fun note(
/* if we have an unsaved note saved, use it instead of a collection lookup */
override fun note(
reload: Boolean
): Note {
return mNote ?: super.note(reload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ object CollectionManager {
}

fun compareAnswer(expected: String, given: String): String {
// bypass the lock, as the type answer code is heavily nested in non-suspend funs
// bypass the lock, as the type answer code is heavily nested in non-suspend functions
return getBackend().compareAnswer(expected, given)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import uk.co.samuelwall.materialtaptargetprompt.extras.backgrounds.RectangleProm
import uk.co.samuelwall.materialtaptargetprompt.extras.focals.CirclePromptFocal
import uk.co.samuelwall.materialtaptargetprompt.extras.focals.RectanglePromptFocal

class CustomMaterialTapTargetPromptBuilder<T>(val activity: Activity, val featureIdentifier: T) : MaterialTapTargetPrompt.Builder(activity) where T : Enum<T>, T : OnboardingFlag {
class CustomMaterialTapTargetPromptBuilder<T>(val activity: Activity, private val featureIdentifier: T) : MaterialTapTargetPrompt.Builder(activity) where T : Enum<T>, T : OnboardingFlag {

fun createRectangle(): CustomMaterialTapTargetPromptBuilder<T> {
private fun createRectangle(): CustomMaterialTapTargetPromptBuilder<T> {
promptFocal = RectanglePromptFocal()
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ class DeckSpinnerSelection(

private val mFragmentManagerSupplier: FragmentManagerSupplier = context.asFragmentManagerSupplier()

lateinit var dropDownDecks: List<DeckNameId>
private set
private lateinit var dropDownDecks: List<DeckNameId>
private var mDeckDropDownAdapter: DeckDropDownAdapter? = null

fun initializeActionBarDeckSpinner(actionBar: ActionBar) {
Expand Down Expand Up @@ -116,7 +115,7 @@ class DeckSpinnerSelection(
return collection.decks.allNamesAndIds(includeFiltered = includeFiltered)
}

fun setSpinnerListener() {
private fun setSpinnerListener() {
spinner.setOnTouchListener { _: View?, motionEvent: MotionEvent ->
if (motionEvent.action == MotionEvent.ACTION_UP) {
displayDeckSelectionDialog(collection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class MediaRegistration(private val context: Context) {
companion object {
private const val MEDIA_MAX_SIZE = 5 * 1000 * 1000
private const val COLOR_GREY = 0
const val COLOR_TRUE = 2
private const val COLOR_TRUE = 2
private const val COLOR_INDEX = 3
private const val COLOR_GREY_ALPHA = 4
private const val COLOR_TRUE_ALPHA = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class SharedDecksActivity : AnkiActivity() {
* If user can go back in WebView, navigate to previous webpage.
* Otherwise, close the WebView.
*/
@Deprecated("Deprecated in Java")
@Suppress("deprecation") // onBackPressed
override fun onBackPressed() {
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class StudyOptionsActivity : NavigationDrawerActivity(), StudyOptionsListener, C
finishWithAnimation(ActivityTransitionAnimation.Direction.END)
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
if (isDrawerOpen) {
super.onBackPressed()
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/Whiteboard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Whiteboard(activity: AnkiActivity, handleMultiTouch: Boolean, inverted: Bo
private val mColorPalette: LinearLayout
private val mHandleMultiTouch: Boolean = handleMultiTouch
private var mOnPaintColorChangeListener: OnPaintColorChangeListener? = null
val currentStrokeWidth: Int
private val currentStrokeWidth: Int
get() = mAnkiActivity.sharedPrefs().getInt("whiteBoardStrokeWidth", 6)

override fun onDraw(canvas: Canvas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import com.ichi2.libanki.utils.TimeManager
import com.ichi2.themes.setTransparentStatusBar
import com.ichi2.utils.getInstanceFromClassName
import timber.log.Timber
import java.util.*
import kotlin.reflect.jvm.jvmName

class Preferences :
Expand Down

0 comments on commit a61c42e

Please sign in to comment.