mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Add KDoc to six small library API modules
Cover the remaining interfaces of libraries/troubleshoot, libraries/matrixmedia, libraries/dateformatter, libraries/featureflag, libraries/workmanager and libraries/mediaviewer, along with their members and parameters. Behaviours worth recording: NotificationTroubleshootTest reports its outcome through its state flow rather than by returning, and its quickFix throws unless the test offers one; DateFormatter.format turns a null timestamp into an empty string so callers need no null check; ImageLoaderHolder keeps one loader per session because decrypting room media needs that session's client. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+16
@@ -11,8 +11,24 @@ import coil3.ImageLoader
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
|
||||
/**
|
||||
* Caches one Coil image loader per session, since loading Matrix media requires the session's own client to fetch and decrypt it.
|
||||
*/
|
||||
interface ImageLoaderHolder {
|
||||
/** Returns a loader that can only fetch ordinary URLs, for images that do not come from a Matrix room. */
|
||||
fun get(): ImageLoader
|
||||
|
||||
/**
|
||||
* Returns the loader of a session, creating it on first use.
|
||||
*
|
||||
* @param client the session whose media the loader will fetch.
|
||||
*/
|
||||
fun get(client: MatrixClient): ImageLoader
|
||||
|
||||
/**
|
||||
* Drops the cached loader of a session, to be called when that session goes away.
|
||||
*
|
||||
* @param sessionId the session whose loader is dropped.
|
||||
*/
|
||||
fun remove(sessionId: SessionId)
|
||||
}
|
||||
|
||||
+9
@@ -14,6 +14,15 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarData
|
||||
* Generates a bitmap for an initials avatar based on the provided [io.element.android.libraries.designsystem.components.avatar.AvatarData].
|
||||
*/
|
||||
interface InitialsAvatarBitmapGenerator {
|
||||
/**
|
||||
* Draws the initials avatar, used where a bitmap is required rather than a Composable, such as in notifications and shortcuts.
|
||||
*
|
||||
* @param size the width and height of the bitmap in pixels.
|
||||
* @param avatarData the name and id the initials and the background colour are derived from.
|
||||
* @param useDarkTheme whether to draw the dark theme variant.
|
||||
* @param fontSizePercentage the text height as a fraction of [size].
|
||||
* @return the bitmap, or `null` when it could not be drawn.
|
||||
*/
|
||||
fun generateBitmap(
|
||||
size: Int,
|
||||
avatarData: AvatarData,
|
||||
|
||||
Reference in New Issue
Block a user