Class QuoteCardView

  • All Implemented Interfaces:

    
    public class QuoteCardView
    
                        

    V2 引用消息卡片 View(对标 iOS RCReferencedContentView)。

    四种互斥布局模式:

    • INLINE:左侧 compact 竖线 + 单 TextView 显示 "昵称: 内容",最多两行。 适用于文本/语音/位置/小视频/未知/已编辑的引用。
    • IMAGE_PREVIEW:顶部 sender 行 + 缩略图。适用于图片且非删除/撤回。
    • FILE_CARD:顶部 sender 行 + 白底带边框文件卡片(icon + name + size)。
    • STATUS:与 INLINE 相同,但内容固定为"已撤回/已删除",颜色用次级色。
    Since:

    5.36.0

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      QuoteCardView(Context context)
      QuoteCardView(Context context, AttributeSet attrs)
      QuoteCardView(Context context, AttributeSet attrs, int defStyleAttr)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static boolean shouldShowQuoteCard(Message message) 判断消息是否应该显示 V2 引用卡片。 条件:quoteInfo.messageUId 非空 &&消息内容不是 V1 ReferenceMessage。 不再依赖 RongConfigCenter.featureConfig().isQuoteV2Enable():该开关仅控制发送侧是否走 V2 协议, 收到的消息只要带 quoteInfo 就需要渲染卡片。
      void setMessage(Message message) 绑定消息数据并触发被引用消息查询。 需在 RecyclerView.
      void setMessage(Message message, boolean forceReload) 绑定消息数据并触发被引用消息查询。
      Message getQuotedMessage() 获取已查到的被引用消息,可能为 null(加载中/不可用)。
      void setReferenceMessage(Message wrappingMessage) V1 路径:直接根据 ReferenceMessage 自带的本地引用内容渲染卡片,不查询 DB。 这样 V1 引用消息 cell 与 V2 引用卡片视觉一致,对齐 iOS 的"两端共用 RCReferencedContentView"。
      void reset() 重置为空白状态(RecyclerView 复用时调用)。
      void setFileCardMinWidthOverride(int widthPx) 文件消息本体带引用时,引用文件卡需要与下方文件卡保持同宽。
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QuoteCardView

        QuoteCardView(Context context)
      • QuoteCardView

        QuoteCardView(Context context, AttributeSet attrs)
      • QuoteCardView

        QuoteCardView(Context context, AttributeSet attrs, int defStyleAttr)
    • Method Detail

      • shouldShowQuoteCard

         static boolean shouldShowQuoteCard(Message message)

        判断消息是否应该显示 V2 引用卡片。

        条件:quoteInfo.messageUId 非空 &&消息内容不是 V1 ReferenceMessage。

        不再依赖 RongConfigCenter.featureConfig().isQuoteV2Enable():该开关仅控制发送侧是否走 V2 协议, 收到的消息只要带 quoteInfo 就需要渲染卡片。

      • setMessage

         void setMessage(Message message)

        绑定消息数据并触发被引用消息查询。 需在 RecyclerView.onBindViewHolder 中调用。

      • setMessage

         void setMessage(Message message, boolean forceReload)

        绑定消息数据并触发被引用消息查询。

        Parameters:
        forceReload - true 时忽略相同 quoted uid 的缓存结果,重新查询被引用消息状态。
      • getQuotedMessage

         Message getQuotedMessage()

        获取已查到的被引用消息,可能为 null(加载中/不可用)。

      • setReferenceMessage

         void setReferenceMessage(Message wrappingMessage)

        V1 路径:直接根据 ReferenceMessage 自带的本地引用内容渲染卡片,不查询 DB。

        这样 V1 引用消息 cell 与 V2 引用卡片视觉一致,对齐 iOS 的"两端共用 RCReferencedContentView"。

      • reset

         void reset()

        重置为空白状态(RecyclerView 复用时调用)。

      • setFileCardMinWidthOverride

         void setFileCardMinWidthOverride(int widthPx)

        文件消息本体带引用时,引用文件卡需要与下方文件卡保持同宽。