diff --git a/docusaurus/docs/Android/compose/general-customization/chat-theme.mdx b/docusaurus/docs/Android/compose/general-customization/chat-theme.mdx index 08a1bd75f0f..42b6a0b21e3 100644 --- a/docusaurus/docs/Android/compose/general-customization/chat-theme.mdx +++ b/docusaurus/docs/Android/compose/general-customization/chat-theme.mdx @@ -12,12 +12,13 @@ The `ChatTheme` component is a wrapper that **you should use as the root** of al * `attachmentPreviewHandlers`: Used to provide previews for all supported attachment types. If you do not wish to use the default previews, you can customize this. * `quotedAttachmentFactories`: Used to process messages and show different types of attachment UI, when quoting a message that contains an attachment. * `reactionIconFactory`: Used to create a reaction icon for the given reaction type. You can use the default factory that supports a predefined set of reactions, or provide a custom one. +* `reactionOptionsTheme`: Used to define the appearance of the reaction option list in the selected message menu. For theming the message option list in the same menu, see `messageOptionsTheme` below. * `dateFormatter`: Used to define the timestamp formatting in the app. You can use the default formatting, or customize it to your needs. * `channelNameFormatter`: Used to define the channel name formatting in the app. You can use the default implementation, or customize it according to your needs. * `messagePreviewFormatter`: Used to define the message preview formatting in the app. You can use the default implementation, or customize the display of message previews according to your needs. * `imageLoaderFactory`: Used to create Coil image loader instances. You can use the default image loader factory, or provide a custom one. * `messageAlignmentProvider`: Used to provide an alignment for a particular message. You can use the default implementation which aligns the messages of the current user to end, or customize it according to your needs. -* `messageOptionsTheme`: Used to define the appearance of the message option list in the selected message menu. +* `messageOptionsTheme`: Used to define the appearance of the message option list in the selected message menu. For theming the reaction option list in the same menu, see `reactionOptionsTheme` above. * `messageOptionsUserReactionAlignment`: Used to define how message reactions are aligned when browsing all reactions for a given message. * `permissionHandlers`: Used to handle permissions inside the app. Default implementation of the download permission handler automatically downloads files after the permission has been granted. * `attachmentsPickerTabFactories`: Used to display different tabs in the attachments picker dialog. @@ -171,6 +172,12 @@ You can find their definitions in the [class documentation](https://github.com/G Reactions are easily customizable by passing in your own `ReactionIconFactory` which contains reactions and overriding `ChatTheme.reactionIconFactory` with it. +### ReactionOptionsTheme + +Defines the appearance of the reaction option list in the selected message menu. Allows you to show/hide options through the `areReactionOptionsVisible` parameter. + +See the [class documentation](https://github.com/GetStream/stream-chat-android/blob/0817af6b82cd72d541ed5e816fef8a3a27441e69/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme.kt) for more details. + ### DateFormatter Used for formatting various times and dates such as the timestamp you see when a message is displayed. The default date formatter in `ChatTheme` is Stream's `DefaultDateFormatter`. diff --git a/docusaurus/docs/Android/compose/message-components/selected-message-menu.mdx b/docusaurus/docs/Android/compose/message-components/selected-message-menu.mdx index feff757f4c8..ed999853ece 100644 --- a/docusaurus/docs/Android/compose/message-components/selected-message-menu.mdx +++ b/docusaurus/docs/Android/compose/message-components/selected-message-menu.mdx @@ -151,6 +151,8 @@ By default, the `reactionTypes` parameter uses [`ChatTheme.reactionIconFactory`] The best way to customize reactions is by overriding `ChatTheme.reactionIconFactory` with your own implementation of `ReactionIconFactory` so that all of your components wrapped inside of `ChatTheme` draw from the same source. +You can also control the reaction list visibility by using your own implementation of `ReactionOptionsTheme` for the [`ChatTheme.reactionOptionsTheme`](../general-customization/chat-theme.mdx#reactionoptionstheme) parameter. + #### Customizing the Appearance By default `SelectedMessageMenu` looks like a bottom sheet. However you can customize it to look like a completely different component, such as a dialog, a drawer or whatever helps you retain the look and feel of your app. diff --git a/stream-chat-android-compose/api/stream-chat-android-compose.api b/stream-chat-android-compose/api/stream-chat-android-compose.api index 6d740b5d620..fe25ab4685b 100644 --- a/stream-chat-android-compose/api/stream-chat-android-compose.api +++ b/stream-chat-android-compose/api/stream-chat-android-compose.api @@ -1521,6 +1521,7 @@ public final class io/getstream/chat/android/compose/ui/theme/ChatTheme { public final fun getQuotedAttachmentFactories (Landroidx/compose/runtime/Composer;I)Ljava/util/List; public final fun getQuotedMessageTextFormatter (Landroidx/compose/runtime/Composer;I)Lio/getstream/chat/android/compose/ui/util/QuotedMessageTextFormatter; public final fun getReactionIconFactory (Landroidx/compose/runtime/Composer;I)Lio/getstream/chat/android/compose/ui/util/ReactionIconFactory; + public final fun getReactionOptionsTheme (Landroidx/compose/runtime/Composer;I)Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme; public final fun getReadCountEnabled (Landroidx/compose/runtime/Composer;I)Z public final fun getSearchResultNameFormatter (Landroidx/compose/runtime/Composer;I)Lio/getstream/chat/android/compose/ui/util/SearchResultNameFormatter; public final fun getShapes (Landroidx/compose/runtime/Composer;I)Lio/getstream/chat/android/compose/ui/theme/StreamShapes; @@ -1532,7 +1533,7 @@ public final class io/getstream/chat/android/compose/ui/theme/ChatTheme { } public final class io/getstream/chat/android/compose/ui/theme/ChatThemeKt { - public static final fun ChatTheme (ZZZLio/getstream/chat/android/compose/ui/theme/StreamColors;Lio/getstream/chat/android/compose/ui/theme/StreamDimens;Lio/getstream/chat/android/compose/ui/theme/StreamTypography;Lio/getstream/chat/android/compose/ui/theme/StreamShapes;Landroidx/compose/material/ripple/RippleTheme;Ljava/util/List;Ljava/util/List;Ljava/util/List;Lio/getstream/chat/android/compose/ui/util/ReactionIconFactory;ZLio/getstream/chat/android/ui/common/helper/DateFormatter;Lio/getstream/chat/android/ui/common/utils/ChannelNameFormatter;Lio/getstream/chat/android/compose/ui/util/MessagePreviewFormatter;Lio/getstream/chat/android/compose/ui/util/SearchResultNameFormatter;Lio/getstream/chat/android/compose/ui/util/StreamCoilImageLoaderFactory;Lio/getstream/chat/android/compose/ui/util/MessageAlignmentProvider;Lio/getstream/chat/android/compose/ui/theme/MessageOptionsTheme;Lio/getstream/chat/android/ui/common/state/messages/list/MessageOptionsUserReactionAlignment;Ljava/util/List;ZLio/getstream/chat/android/ui/common/images/resizing/StreamCdnImageResizing;ZLio/getstream/chat/android/compose/ui/theme/MessageTheme;Lio/getstream/chat/android/compose/ui/theme/MessageTheme;Lio/getstream/chat/android/compose/ui/theme/MessageDateSeparatorTheme;Lio/getstream/chat/android/compose/ui/theme/MessageUnreadSeparatorTheme;Lio/getstream/chat/android/compose/ui/theme/MessageComposerTheme;Lio/getstream/chat/android/compose/ui/util/MessageTextFormatter;Lio/getstream/chat/android/compose/ui/util/QuotedMessageTextFormatter;Lio/getstream/sdk/chat/audio/recording/StreamMediaRecorder;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;IIIIII)V + public static final fun ChatTheme (ZZZLio/getstream/chat/android/compose/ui/theme/StreamColors;Lio/getstream/chat/android/compose/ui/theme/StreamDimens;Lio/getstream/chat/android/compose/ui/theme/StreamTypography;Lio/getstream/chat/android/compose/ui/theme/StreamShapes;Landroidx/compose/material/ripple/RippleTheme;Ljava/util/List;Ljava/util/List;Ljava/util/List;Lio/getstream/chat/android/compose/ui/util/ReactionIconFactory;Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme;ZLio/getstream/chat/android/ui/common/helper/DateFormatter;Lio/getstream/chat/android/ui/common/utils/ChannelNameFormatter;Lio/getstream/chat/android/compose/ui/util/MessagePreviewFormatter;Lio/getstream/chat/android/compose/ui/util/SearchResultNameFormatter;Lio/getstream/chat/android/compose/ui/util/StreamCoilImageLoaderFactory;Lio/getstream/chat/android/compose/ui/util/MessageAlignmentProvider;Lio/getstream/chat/android/compose/ui/theme/MessageOptionsTheme;Lio/getstream/chat/android/ui/common/state/messages/list/MessageOptionsUserReactionAlignment;Ljava/util/List;ZLio/getstream/chat/android/ui/common/images/resizing/StreamCdnImageResizing;ZLio/getstream/chat/android/compose/ui/theme/MessageTheme;Lio/getstream/chat/android/compose/ui/theme/MessageTheme;Lio/getstream/chat/android/compose/ui/theme/MessageDateSeparatorTheme;Lio/getstream/chat/android/compose/ui/theme/MessageUnreadSeparatorTheme;Lio/getstream/chat/android/compose/ui/theme/MessageComposerTheme;Lio/getstream/chat/android/compose/ui/util/MessageTextFormatter;Lio/getstream/chat/android/compose/ui/util/QuotedMessageTextFormatter;Lio/getstream/sdk/chat/audio/recording/StreamMediaRecorder;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;IIIIII)V } public final class io/getstream/chat/android/compose/ui/theme/ComponentSize { @@ -1733,6 +1734,24 @@ public final class io/getstream/chat/android/compose/ui/theme/MessageUnreadSepar public final fun defaultTheme (Lio/getstream/chat/android/compose/ui/theme/StreamTypography;Lio/getstream/chat/android/compose/ui/theme/StreamColors;Landroidx/compose/runtime/Composer;II)Lio/getstream/chat/android/compose/ui/theme/MessageUnreadSeparatorTheme; } +public final class io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme { + public static final field $stable I + public static final field Companion Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme$Companion; + public fun (Z)V + public final fun component1 ()Z + public final fun copy (Z)Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme; + public static synthetic fun copy$default (Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme;ZILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme; + public fun equals (Ljava/lang/Object;)Z + public final fun getAreReactionOptionsVisible ()Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme$Companion { + public final fun defaultTheme (Z)Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme; + public static synthetic fun defaultTheme$default (Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme$Companion;ZILjava/lang/Object;)Lio/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme; +} + public final class io/getstream/chat/android/compose/ui/theme/StreamColors { public static final field $stable I public static final field Companion Lio/getstream/chat/android/compose/ui/theme/StreamColors$Companion; diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt index 1c5cc19b9fb..bf7a5c1e64a 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt @@ -187,6 +187,7 @@ private val LocalStreamMediaRecorder = compositionLocalOf { * @param quotedAttachmentFactories Quoted attachment factories that we provide. * @param reactionIconFactory Used to create an icon [Painter] for the given reaction type. * @param reactionOptionsTheme [ReactionOptionsTheme] Theme for the reaction option list in the selected message menu. + * For theming the message option list in the same menu, use [messageOptionsTheme]. * @param allowUIAutomationTest Allow to simulate ui automation with given test tags. * @param dateFormatter [DateFormatter] Used throughout the app for date and time information. * @param channelNameFormatter [ChannelNameFormatter] Used throughout the app for channel names. @@ -194,6 +195,7 @@ private val LocalStreamMediaRecorder = compositionLocalOf { * @param imageLoaderFactory A factory that creates new Coil [ImageLoader] instances. * @param messageAlignmentProvider [MessageAlignmentProvider] Used to provide message alignment for the given message. * @param messageOptionsTheme [MessageOptionsTheme] Theme for the message option list in the selected message menu. + * For theming the reaction option list in the same menu, use [reactionOptionsTheme]. * @param messageOptionsUserReactionAlignment Alignment of the user reaction inside the message options. * @param attachmentsPickerTabFactories Attachments picker tab factories that we provide. * @param videoThumbnailsEnabled Dictates whether video thumbnails will be displayed inside video previews. diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageOptionsTheme.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageOptionsTheme.kt index 20eee77b71a..bdba75a59bf 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageOptionsTheme.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/MessageOptionsTheme.kt @@ -20,7 +20,8 @@ import androidx.compose.runtime.Immutable import io.getstream.chat.android.compose.ui.components.messageoptions.MessageOptionItemVisibility /** - * Represents the theme for the message options. + * Represents the theme for the message option list in the selected message menu. + * For reaction option list theming, see [ReactionOptionsTheme]. * * @param optionVisibility The visibility of the message options. * diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme.kt index dff3f9795f8..965ab6a1db4 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ReactionOptionsTheme.kt @@ -19,7 +19,8 @@ package io.getstream.chat.android.compose.ui.theme import androidx.compose.runtime.Immutable /** - * Represents the theme for the reaction options. + * Represents the theme for the reaction option list in the selected message menu. + * For message option list theming, see [MessageOptionsTheme]. * * @param areReactionOptionsVisible The visibility of the reaction options. */