package xn.xxp.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import xn.xxp.R
import xn.xxp.databinding.WidgetNavViewBinding

/**
 * 导航
 *
 * @author ReiChin_
 */
class NavView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) :
    LinearLayout(context, attrs, defStyleAttr) {

    private val viewBinding =
        WidgetNavViewBinding.inflate(LayoutInflater.from(context), this, true)

    init {
        val typeArray = context.obtainStyledAttributes(attrs, R.styleable.NavView)
        viewBinding.location.text = typeArray.getString(R.styleable.NavView_location)
        typeArray.recycle()
    }

    fun setParentText(text: String) {
        viewBinding.parent.text = text
    }

    fun setLocationText(text: String) {
        viewBinding.location.text = text
    }

}