common/README.md
AnkiDroid Common is a Gradle module containing utility functions, and definitions for core functionality used by other modules within AnkiDroid. Common should be the base of the AnkiDroid dependency tree.
Common is used by libAnki (which has no Android dependencies), so dependencies on the Android
framework should be in packages named android.
This module is expected to define interfaces which are initialized in the AnkiDroid module
com.ichi2.anki.commonDefinitions/interfaces exposing core functionality e.g. CrashReportService, UsageAnalytics
These are to be initialized higher up the dependency tree, typically in AnkiDroid
com.ichi2.anki.common.utilsUtility classes and methods without an Android dependency
com.ichi2.anki.common.utils.extExtension methods, universally applicable to the classes they extend
Examples:
Int.kt - ifNotZeroInputStream.kt - convertToStringcom.ichi2.anki.common.utils.androidUtilities with a dependency on Android
This is a work in progress. As discussed in
#12582, AnkiDroid decided to split the
codebase into two modules, libAnki (business logic) and AnkiDroid (code interacting with
Android APIs).
At the time of writing, this split is not yet done. We expect to do it with the following steps:
com.ichi2.compat was deemed to be an easy module to split out to trial this refactor
but this had circular dependenciescommon module was proposed to fix thislibAnki should have no dependencies on Android
libAnki from using Android dependenciesThe following were blockers for compat to be split out
isRobolectricCrashReportServiceshowThemedToastTimeManager (maybe)@KotlinCleanup (maybe)Discussed on Discord: https://discord.gg/qjzcRTx