package com.develop.food.base.widgets

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.RelativeLayout
import androidx.annotation.StringRes
import com.develop.base.R
import com.develop.base.databinding.TimeShowViewBinding
import com.develop.base.databinding.TopTitleViewBinding
import com.develop.food.base.utils.TimerUtils

class TopTitleView : RelativeLayout {

    private var binding: TopTitleViewBinding

    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    ) {
    }

    init {
        val root = View.inflate(context, R.layout.top_title_view, this)
        binding = TopTitleViewBinding.bind(root)
    }

    fun setTopBarTitle(@StringRes resId: Int) {
        binding.tvTopTitle.setText(resId)
    }

    fun setTopBarTitle(text: String) {
        binding.tvTopTitle.text = text
    }

    fun listenBackClick(listener: OnClickListener) {
        binding.ivBack.setOnClickListener(listener)
    }

}