All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.sceyt.chatuikit.formatters.defaults.DefaultChannelDateFormatter.kt Maven / Gradle / Ivy

There is a newer version: 1.7.2
Show newest version
package com.sceyt.chatuikit.formatters.defaults

import android.content.Context
import com.sceyt.chatuikit.formatters.Formatter
import com.sceyt.chatuikit.formatters.date.DateFormatData
import com.sceyt.chatuikit.formatters.date.SceytDateFormatter
import java.util.Date

open class DefaultChannelDateFormatter : Formatter {

    override fun format(context: Context, from: Date): String {
        return dateFormatter.getDateTimeStringWithDateFormatter(context, from.time)
    }

    protected open val dateFormatter = object : SceytDateFormatter() {
        override fun today(context: Context) = DateFormatData(format = "HH:mm")
        override fun thisYear(context: Context) = DateFormatData(format = "dd MMM")
        override fun olderThisYear(context: Context) = DateFormatData(format = "dd.MM.yy")
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy