Skip to content

Commit ae2957c

Browse files
committed
Removed redundant oldCardID attribute, and corresponding simplifications.
1 parent 7b4a64a commit ae2957c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ open class CardBrowser :
155155
private lateinit var deckSpinnerSelection: DeckSpinnerSelection
156156
private var lastSelectedPosition = 0
157157
private var oldCardTopOffset: Int = 0
158-
private var oldCardId: Long? = null
159158

160159
@VisibleForTesting
161160
lateinit var cardsListView: RecyclerView
@@ -356,14 +355,12 @@ open class CardBrowser :
356355
if (viewModel.isInMultiSelectMode && viewModel.lastSelectedId != null) {
357356
viewModel.selectRowsBetween(viewModel.lastSelectedId!!, id)
358357
} else {
359-
launchCatchingTask {
360-
val position = cardsAdapter.getPositionForId(id)
358+
val position = cardsAdapter.getPositionForId(id)
361359

362-
lastSelectedPosition = position
363-
saveScrollingState(position)
360+
lastSelectedPosition = position
361+
saveScrollingState(position)
364362

365-
viewModel.toggleRowSelection(id)
366-
}
363+
viewModel.toggleRowSelection(id)
367364
}
368365
}
369366

@@ -1921,9 +1918,8 @@ open class CardBrowser :
19211918
): Intent = NoteEditorLauncher.AddNoteFromCardBrowser(viewModel).getIntent(context)
19221919
}
19231920

1924-
private suspend fun saveScrollingState(position: Int) {
1925-
// Save the current card id and the top offset of the card
1926-
oldCardId = viewModel.queryCardIdAtPosition(position)
1921+
private fun saveScrollingState(position: Int) {
1922+
// Save the top offset of the card
19271923
oldCardTopOffset = viewModel.calculateTopOffset(cardsListView, position)
19281924
}
19291925

0 commit comments

Comments
 (0)