mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 03:52:15 +02:00
refactor!: Convert AddContentApi to Kotlin
com.ichi2.anki.api.AddContentApi The conversion caused breaking changes WRT nullability of parameters AND changing `fun` to `val` This is NOT the final nullability which we desire, we perform the conversion in a single commit to reduce the chance of bugs being introduced Changes from a 'pure' conversion': - addNotes: - fieldsList: changed to List<Array<String>?> - tagsList: changed to List<Set<String>?>? - addNewCustomModel changed from auto conversion: - fields: -> Array<String> - cards -> Array<String> - qfmt -> Array<String> - afmt -> Array<String> - splitFields(flds).length -> splitFields(flds).size suppress lint for name shadowing: - `var preferredName = preferredName` add `!!` - `val fname = File(returnUri!!.path).toString()` - `val fname = File(returnUri!!.path!!).toString()` remove `private`: - `private get() = if (apiHostSpecVersion < 2) CompatV1() else CompatV2()` - `get() = if (apiHostSpecVersion < 2) CompatV1() else CompatV2()` remove imports: - NoteInfo.Companion.buildFromCursor - Utils.fieldChecksum - Utils.joinFields - Utils.joinTags - Utils.splitFields add imports: FlashCardsContract - Card - CardTemplate - Deck - Model - Note many spacing changes: - sample: values.put(Note.TAGS, Utils.joinTags(tagsList[i])) - moved back to a single line Moved api docs from <pre> to ``` ---- Converted with disabled git hooks + tested manually
This commit is contained in:
parent
fe9892704b
commit
cbba9e3b6f
@ -43,7 +43,7 @@ permission notice:
|
||||
// Example of class name: "/com/ichi2/anki/UIUtils.kt"
|
||||
// Ensure that it starts with '/' (slash)
|
||||
def source = Source.MAIN
|
||||
def className = "/com/ichi2/anki/api/AddContentApi.kt"
|
||||
def className = ""
|
||||
|
||||
enum Source {
|
||||
MAIN("/src/main/java"),
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user