package com.yzx.ebrand.widget

import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.yzx.ebrand.R
import com.yzx.ebrand.model.TimeShow
import kotlinx.android.synthetic.main.view_time.view.*

class TimeView(context: Context, attrs: AttributeSet) :
    FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.view_time, null)
        addView(view)
    }

    @SuppressLint("SetTextI18n")
    fun setTime(timeShow: TimeShow) {
        hour.text = timeShow.hour
        min.text = timeShow.min
        sec.text = timeShow.sec
        week.text = timeShow.week
        year.text = "${timeShow.year}年${timeShow.month}月${timeShow.day}日"
    }
}