Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: audio autoplay in template previewer #17725

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import com.ichi2.anki.launchCatchingIO
import com.ichi2.anki.pages.AnkiServer
import com.ichi2.anki.reviewer.CardSide
import com.ichi2.libanki.Card
import com.ichi2.libanki.Consts.DEFAULT_DECK_ID
import com.ichi2.libanki.DeckId
import com.ichi2.libanki.Note
import com.ichi2.libanki.NoteId
import com.ichi2.libanki.NotetypeJson
Expand Down Expand Up @@ -84,6 +86,7 @@ class TemplatePreviewerViewModel(
ord = ordFlow.value,
customNoteType = notetype,
fillEmpty = fillEmpty,
deckId = arguments.deckId,
)
}
}
Expand Down Expand Up @@ -231,6 +234,7 @@ data class TemplatePreviewerArguments(
val id: NoteId = 0,
val ord: Int = 0,
val fillEmpty: Boolean = false,
val deckId: DeckId = DEFAULT_DECK_ID,
) : Parcelable {
val notetype: NotetypeJson get() = notetypeFile.getNotetype()
}
3 changes: 2 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/Note.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ class Note : Cloneable {
customNoteType: NotetypeJson? = null,
customTemplate: CardTemplate? = null,
fillEmpty: Boolean = false,
deckId: DeckId = DEFAULT_DECK_ID,
): Card {
val card = Card(col, id = null)
card.ord = ord
card.did = DEFAULT_DECK_ID
card.did = deckId

val model = customNoteType ?: notetype
val template =
Expand Down
Loading