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

main.com.sceyt.chatuikit.styles.channel_info.link.ChannelInfoLinkStyle.kt Maven / Gradle / Ivy

There is a newer version: 1.7.2
Show newest version
package com.sceyt.chatuikit.styles.channel_info.link

import android.content.Context
import android.util.AttributeSet
import androidx.annotation.ColorInt
import com.sceyt.chatuikit.SceytChatUIKit
import com.sceyt.chatuikit.extensions.getCompatColor
import com.sceyt.chatuikit.presentation.components.channel_info.links.ChannelInfoLinksFragment
import com.sceyt.chatuikit.styles.StyleCustomizer
import com.sceyt.chatuikit.styles.channel_info.ChannelInfoDateSeparatorStyle
import com.sceyt.chatuikit.theme.Colors

/**
 * Style for [ChannelInfoLinksFragment] page.
 * @property backgroundColor - background color, default is [Colors.backgroundColor]
 * @property itemStyle - style for link item
 * @property dateSeparatorStyle - style for date separator
 * */
data class ChannelInfoLinkStyle(
        @ColorInt val backgroundColor: Int,
        val itemStyle: ChannelInfoLinkItemStyle,
        val dateSeparatorStyle: ChannelInfoDateSeparatorStyle
) {
    companion object {
        var styleCustomizer = StyleCustomizer { _, style -> style }
    }

    internal class Builder(
            private val context: Context,
            private val attributeSet: AttributeSet?
    ) {
        fun build(): ChannelInfoLinkStyle {
            val backgroundColor = context.getCompatColor(SceytChatUIKit.theme.colors.backgroundColor)

            val itemStyle = ChannelInfoLinkItemStyle.Builder(context, attributeSet).build()
            val dateSeparatorStyle = ChannelInfoDateSeparatorStyle.Builder(context, attributeSet)
                .build()


            return ChannelInfoLinkStyle(
                backgroundColor = backgroundColor,
                itemStyle = itemStyle,
                dateSeparatorStyle = dateSeparatorStyle
            ).let { styleCustomizer.apply(context, it) }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy