diff --git a/stream-chat-android-ui-components/detekt-baseline.xml b/stream-chat-android-ui-components/detekt-baseline.xml index a2e866c4c03..c1a422c5ab8 100644 --- a/stream-chat-android-ui-components/detekt-baseline.xml +++ b/stream-chat-android-ui-components/detekt-baseline.xml @@ -12,8 +12,7 @@ ComplexMethod:AttachmentDestination.kt$AttachmentDestination$public fun showAttachment(message: Message, attachment: Attachment) ComplexMethod:DefaultMessageComposerCenterOverlapContent.kt$DefaultMessageComposerOverlappingContent$@SuppressLint("ClickableViewAccessibility") override fun onTouchEvent(event: MotionEvent): Boolean ComplexMethod:DefaultMessageComposerTrailingContent.kt$DefaultMessageComposerTrailingContent$override fun renderState(state: MessageComposerState) - ComplexMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$internal operator fun invoke(context: Context, attrs: AttributeSet?): MessageComposerViewStyle - ComplexMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$private fun createAttachmentPickerDialogStyle(context: Context, a: TypedArray): AttachmentsPickerDialogStyle + ComplexMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$@Suppress("MaxLineLength") private fun createAttachmentPickerDialogStyle(context: Context, a: TypedArray): AttachmentsPickerDialogStyle ComplexMethod:MessageListItemDiffCallback.kt$MessageListItemDiffCallback$override fun areContentsTheSame(oldItem: MessageListItem, newItem: MessageListItem): Boolean ComplexMethod:MessageListItemViewHolderFactory.kt$MessageListItemViewHolderFactory$public open fun createViewHolder( parentView: ViewGroup, viewType: Int, ): BaseMessageItemViewHolder<out MessageListItem> ComplexMethod:MessageOptionItemsFactory.kt$DefaultMessageOptionItemsFactory$override fun createMessageOptionItems( selectedMessage: Message, currentUser: User?, isInThread: Boolean, ownCapabilities: Set<String>, style: MessageListViewStyle, ): List<MessageOptionItem> @@ -35,8 +34,7 @@ LongMethod:GiphyViewHolderStyle.kt$GiphyViewHolderStyle.Companion$operator fun invoke(context: Context, attributes: TypedArray): GiphyViewHolderStyle LongMethod:MediaAttachmentGridViewStyle.kt$MediaAttachmentGridViewStyle.Companion$operator fun invoke(context: Context, it: TypedArray): MediaAttachmentGridViewStyle LongMethod:MentionListViewStyle.kt$MentionListViewStyle.Companion$operator fun invoke(context: Context, attrs: AttributeSet?): MentionListViewStyle - LongMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$internal operator fun invoke(context: Context, attrs: AttributeSet?): MessageComposerViewStyle - LongMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$private fun createAttachmentPickerDialogStyle(context: Context, a: TypedArray): AttachmentsPickerDialogStyle + LongMethod:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$@Suppress("MaxLineLength") private fun createAttachmentPickerDialogStyle(context: Context, a: TypedArray): AttachmentsPickerDialogStyle LongMethod:MessageListHeaderViewStyle.kt$MessageListHeaderViewStyle.Companion$operator fun invoke(context: Context, attrs: AttributeSet?): MessageListHeaderViewStyle LongMethod:MessageListItemStyle.kt$MessageListItemStyle.Builder$fun build(): MessageListItemStyle LongMethod:MessageListViewModelBinding.kt$@JvmName("bind") public fun MessageListViewModel.bindView( view: MessageListView, lifecycleOwner: LifecycleOwner, ) @@ -102,7 +100,6 @@ MaxLineLength:Context.kt$theme.resolveAttribute(R.attr.streamUiTheme, typedValue, true) -> ContextThemeWrapper(this, typedValue.resourceId) MaxLineLength:DefaultMessageComposerCenterOverlapContent.kt$DefaultMessageComposerOverlappingContent$logger.w { "[onTouchEvent] centerContentHeight: $centerContentHeight, ${displayMetrics().density}, ${displayMetrics().widthPixels}" } MaxLineLength:DefaultMessageComposerLeadingContent.kt$DefaultMessageComposerLeadingContent$binding.attachmentsButton.isVisible = style.attachmentsButtonVisible && canSendMessage && canUploadFile && !isInEditMode - MaxLineLength:DefaultMessageComposerTrailingContent.kt$DefaultMessageComposerTrailingContent$recordAudioButton.isEnabled = style.sendMessageButtonEnabled && canSendMessage && canUploadRecording && canUploadFile MaxLineLength:FileAttachmentsViewHolder.kt$FileAttachmentsViewHolder$* MaxLineLength:FileAttachmentsViewHolder.kt$FileAttachmentsViewHolder$AttachmentDownloadClickListener(container.attachmentDownloadClickListener::onAttachmentDownloadClick) MaxLineLength:FootnoteDecorator.kt$FootnoteDecorator$SyncStatus.IN_PROGRESS @@ -114,58 +111,6 @@ MaxLineLength:MediaAttachmentDialogFragment.kt$MediaAttachmentDialogFragment$viewModel.attachmentGalleryItemsLiveData.observe(viewLifecycleOwner, mediaAttachmentGridView::setAttachments) MaxLineLength:MessageBackgroundFactoryImpl.kt$MessageBackgroundFactoryImpl$// however, if a user has specified a background color attribute, we use it for _all_ message backgrounds. MaxLineLength:MessageComposerViewModel.kt$MessageComposerViewModel$* - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle$* - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerAllowAccessButtonTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerAttachmentTabToggleButtonStateList - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemCheckboxDeselectedDrawable - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemCheckboxSelectedDrawable - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemCheckboxTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemNameTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemNameTextFont - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemNameTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemNameTextSize - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemNameTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemSizeTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemSizeTextFont - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemSizeTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemSizeTextSize - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentItemSizeTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentsNoFilesTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentsNoFilesTextFont - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentsNoFilesTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentsNoFilesTextSize - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerFileAttachmentsNoFilesTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerMediaAttachmentNoMediaTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerMediaAttachmentNoMediaTextFont - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerMediaAttachmentNoMediaTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerMediaAttachmentNoMediaTextSize - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerMediaAttachmentNoMediaTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerSubmitAttachmentsButtonIconDrawable - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingFloatingButtonBackgroundDrawable - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingFloatingButtonBackgroundDrawableTint - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingHoldToRecordBackgroundDrawableTint - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingSlideToCancelTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandDescriptionTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandDescriptionTextFont - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandDescriptionTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandDescriptionTextSize - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandDescriptionTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandNameTextColor - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandNameTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerCommandSuggestionItemCommandNameTextStyle - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMentionSuggestionItemMentionTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMentionSuggestionItemUsernameTextFontAssets - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawablePadding - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawablePaddingBottom - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawablePaddingEnd - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawablePaddingStart - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawablePaddingTop - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$a.getColorOrNull(R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerVideoIconDrawableTint) - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$a.getColorOrNull(R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconBackgroundColor) - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$a.getColorOrNull(R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawableTint) - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$a.getDrawable(R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawable) - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$audioRecordingFloatingButtonBackgroundDrawableTint = audioRecordingFloatingButtonBackgroundDrawableTint - MaxLineLength:MessageComposerViewStyle.kt$MessageComposerViewStyle.Companion$messageInputVideoAttachmentIconDrawablePaddingBottom MaxLineLength:MessageListHeaderViewStyle.kt$MessageListHeaderViewStyle$* MaxLineLength:MessageListItemDecoratorProvider.kt$MessageListItemDecoratorProvider$* MaxLineLength:MessageListItemDiffCallback.kt$MessageListItemDiffCallback$is MessageListItem.DateSeparatorItem -> oldItem.date == (newItem as? MessageListItem.DateSeparatorItem)?.date diff --git a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/MessageComposerViewStyle.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/MessageComposerViewStyle.kt index 693f4318e6a..77e602439c5 100644 --- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/MessageComposerViewStyle.kt +++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/MessageComposerViewStyle.kt @@ -89,22 +89,33 @@ import io.getstream.chat.android.ui.utils.extensions.use * and its parent card. * @param audioRecordingButtonVisible If the button to record audio is displayed. * @param audioRecordingButtonEnabled If the button to record audio is enabled. - * @param audioRecordingButtonPreferred If the button to record audio is displayed over send button while input is empty. + * @param audioRecordingButtonPreferred If the button to record audio is displayed over send button while input is + * empty. * @param audioRecordingHoldToRecordText The info text that will be shown if touch event on audio button was too short. * @param audioRecordingHoldToRecordTextStyle The text style that will be used for the "hold to record" text. - * @param audioRecordingHoldToRecordBackgroundDrawable The drawable will be used as a background for the "hold to record" text. - * @param audioRecordingHoldToRecordBackgroundDrawableTint The tint color will be used for background drawable of the "hold to record" text. + * @param audioRecordingHoldToRecordBackgroundDrawable The drawable will be used as a background for the "hold to + * record" text. + * @param audioRecordingHoldToRecordBackgroundDrawableTint The tint color will be used for background drawable of + * the "hold to record" text. * @param audioRecordingSlideToCancelText The info text that will be shown while holding mic button. * @param audioRecordingSlideToCancelTextStyle The text style that will be used for the "slide to cancel" text. - * @param audioRecordingSlideToCancelStartDrawable The icon that will be displayed in front of the "slide to cancel" text. - * @param audioRecordingSlideToCancelStartDrawableTint The tint color that will be used for the icon in front of the "slide to cancel" text. - * @param audioRecordingFloatingButtonIconDrawable The icon that will be displayed in inside the floating draggable button while recording. - * @param audioRecordingFloatingButtonIconDrawableTint The tint color that will be used for the the mic icon inside the floating draggable button. - * @param audioRecordingFloatingButtonBackgroundDrawable The background drawable that will be applied to the floating draggable button while recording. - * @param audioRecordingFloatingButtonBackgroundDrawableTint The tint color that will be used for the background drawable in the floating draggable button. - * @param audioRecordingFloatingLockIconDrawable The floating icon that will be displayed above floating button while unlocked. + * @param audioRecordingSlideToCancelStartDrawable The icon that will be displayed in front of the + * "slide to cancel" text. + * @param audioRecordingSlideToCancelStartDrawableTint The tint color that will be used for the icon in front of the + * "slide to cancel" text. + * @param audioRecordingFloatingButtonIconDrawable The icon that will be displayed in inside the floating draggable + * button while recording. + * @param audioRecordingFloatingButtonIconDrawableTint The tint color that will be used for the the mic icon inside + * the floating draggable button. + * @param audioRecordingFloatingButtonBackgroundDrawable The background drawable that will be applied to the floating + * draggable button while recording. + * @param audioRecordingFloatingButtonBackgroundDrawableTint The tint color that will be used for the background + * drawable in the floating draggable button. + * @param audioRecordingFloatingLockIconDrawable The floating icon that will be displayed above floating button + * while unlocked. * @param audioRecordingFloatingLockIconDrawableTint The tint color that will be used for the the lock icon. - * @param audioRecordingFloatingLockedIconDrawable The floating icon that will be displayed above recording view when locked. + * @param audioRecordingFloatingLockedIconDrawable The floating icon that will be displayed above recording view + * when locked. * @param audioRecordingFloatingLockedIconDrawableTint The tint color that will be used for the the locked icon. * @param attachmentsButtonVisible If the button to pick attachments is displayed. * @param attachmentsButtonIconDrawable The icon for the attachments button. @@ -257,6 +268,8 @@ public data class MessageComposerViewStyle( ) public companion object { + + @Suppress("MaxLineLength", "ComplexMethod", "LongMethod") internal operator fun invoke(context: Context, attrs: AttributeSet?): MessageComposerViewStyle { context.obtainStyledAttributes( attrs, @@ -376,7 +389,8 @@ public data class MessageComposerViewStyle( context.getColorCompat(R.color.stream_ui_text_color_primary) ) .font( - R.styleable.MessageComposerView_streamUiMessageComposerMentionSuggestionItemUsernameTextFontAssets, + R.styleable + .MessageComposerView_streamUiMessageComposerMentionSuggestionItemUsernameTextFontAssets, R.styleable.MessageComposerView_streamUiMessageComposerMentionSuggestionItemUsernameTextFont ) .style( @@ -722,7 +736,9 @@ public data class MessageComposerViewStyle( ) val messageInputVideoAttachmentIconDrawable = - a.getDrawable(R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawable) + a.getDrawable( + R.styleable.MessageComposerView_streamUiMessageComposerMessageInputVideoAttachmentIconDrawable + ) ?: ContextCompat.getDrawable(context, R.drawable.stream_ui_ic_play)!! val messageInputVideoAttachmentIconDrawableTint = @@ -943,6 +959,7 @@ public data class MessageComposerViewStyle( } } + @Suppress("MaxLineLength") private fun createAttachmentPickerDialogStyle(context: Context, a: TypedArray): AttachmentsPickerDialogStyle { val attachmentsPickerBackgroundColor = a.getColor( R.styleable.MessageComposerView_streamUiMessageComposerAttachmentsPickerBackgroundColor, diff --git a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerTrailingContent.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerTrailingContent.kt index 5b940234540..d7a9a28ea58 100644 --- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerTrailingContent.kt +++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerTrailingContent.kt @@ -153,7 +153,10 @@ public class DefaultMessageComposerTrailingContent : FrameLayout, MessageCompose else -> true } sendMessageButton.isEnabled = style.sendMessageButtonEnabled && canSendMessage && hasValidContent - recordAudioButton.isEnabled = style.sendMessageButtonEnabled && canSendMessage && canUploadRecording && canUploadFile + recordAudioButton.isEnabled = style.sendMessageButtonEnabled && + canSendMessage && + canUploadRecording && + canUploadFile recordAudioButton.isVisible = when (style.audioRecordingButtonVisible) { true -> when (style.audioRecordingButtonPreferred) { true -> canUploadFile && canUploadRecording && canSendMessage && !isInEditMode && !hasTextInput