Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sceyt/sceyt-chat-android-uikit/llms.txt
Use this file to discover all available pages before exploring further.
StyleRegistry is a ConcurrentHashMap-backed singleton located at com.sceyt.chatuikit.styles. It is used internally by the UIKit to pass style objects across Activity creation cycles — storing a style by its string ID before launching a child Activity, and retrieving it inside that Activity’s onCreate — without embedding Parcelable data in Intents or leaking Context references. Because the map is a ConcurrentHashMap, reads and writes are safe from any thread.
Most application developers will never call
StyleRegistry directly. It is an internal transport mechanism. The primary entry point for style customization is StyleCustomizer. Advanced use-cases such as pre-registering styles for custom Activities or Fragments are described at the bottom of this page.SceytComponentStyle base type
All styles stored in the registry must extend SceytComponentStyle:
styleId by default. This ID is what you pass between components — store it in a Bundle argument or Intent extra, then look up the matching style object in the registry on the other side.
API reference
Retrieves a style by its string ID. Returns
null if no style with that ID has been registered.Stores a style under the given string ID, replacing any previously registered style with the same ID.
Type-safe retrieval. Returns the style cast to
T, or null if the ID is null, not found, or the stored value is a different type. The reified type parameter eliminates the need for an explicit Class argument.getOrDefault<T : SceytComponentStyle>(id: String?, defaultProvider: () -> T): T
inline reified function
Returns the stored style cast to
T if the ID is valid and the type matches. If the ID is null, not found, or the type does not match, the defaultProvider lambda is invoked and its return value is used instead. This is the pattern UIKit components use internally when reading their own style from the registry.Type-safe retrieval that throws
IllegalArgumentException if the style is not found or is the wrong type. Use this when you are certain the style must be present — it provides a clear error message that includes both the expected and actual type names.Stores the style using the provided
id. If id is omitted, style.styleId is used as the key. This is the preferred alternative to the operator set when you want to store a style under its own self-assigned ID.Removes the style registered under the given
id and returns the removed instance, or null if the ID was null or not found. Call this in onDestroy of the owning component to prevent the registry from growing unbounded.Removes multiple styles in a single call. The UIKit uses this overload in Activities that register several child-component styles at once (e.g.
ChannelInfoActivity registers media, files, links, voice, and common-groups styles together).Removes all registered styles from the registry. Intended for testing teardown. Do not call this in production code while UIKit Activities are alive.
Returns a human-readable summary of how many styles are currently registered, broken down by type. Useful during development to confirm styles are being cleaned up correctly.
How UIKit uses StyleRegistry internally
The pattern used throughout the UIKit follows these steps:- Parent registers — before launching a child Activity or Fragment, the parent registers one or more style objects and stores their
styleIdstrings. - ID is passed via Intent/Bundle — only the lightweight string ID travels across the process boundary, not the style object itself.
- Child retrieves with fallback — inside the child’s
onCreate,getOrDefaultis called with the ID. If the style was not found (e.g., after a process death), thedefaultProviderlambda builds a fresh default. - Child unregisters on destroy —
onDestroyof the child callsunregisterto free the style from memory.
Advanced: pre-registering a custom style by ID
If you are building a custom Activity that embeds a UIKit Fragment, you can pre-register your own style instance and pass its ID via the Fragment’s argument bundle:getOrDefault so it degrades gracefully: