Class ChatUIDateUtils

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static int judgeDate(Context context, Date date)
      static boolean isTime24Hour(Context context)
      static String getConversationListFormatDate(long dateMillis, Context context)
      static String getConversationFormatDate(long dateMillis, Context context)
      static boolean isShowChatTime(Context context, long currentTime, long preTime, int interval)
      static void preloadDateFormats(Context context) Preloads commonly used date formatters to avoid ANR caused by first-time creation on the main thread.
      static String formatDate(Context context, Date date, String fromat)
      • Methods inherited from class java.lang.Object

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

      • ChatUIDateUtils

        ChatUIDateUtils()
    • Method Detail

      • judgeDate

         static int judgeDate(Context context, Date date)
      • isTime24Hour

         static boolean isTime24Hour(Context context)
      • isShowChatTime

         static boolean isShowChatTime(Context context, long currentTime, long preTime, int interval)
        Parameters:
        currentTime - current time
        preTime - a previous time
        interval - time interval
        Returns:

        true if the gap is greater than interval seconds, false otherwise

      • preloadDateFormats

         static void preloadDateFormats(Context context)

        Preloads commonly used date formatters to avoid ANR caused by first-time creation on the main thread. Recommended to be called during initialization. Supports multiple invocations; only the first preload is actually executed.

        Parameters:
        context - Context
      • formatDate

         static String formatDate(Context context, Date date, String fromat)