• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.airbnb.lottie.samples.views
2 
3 import android.content.Context
4 import android.util.AttributeSet
5 import android.widget.LinearLayout
6 import com.airbnb.lottie.samples.R
7 import com.airbnb.lottie.samples.getText
8 import com.airbnb.lottie.samples.inflate
9 import kotlinx.android.synthetic.main.tab_item.view.*
10 
11 class TabBarItemView @JvmOverloads constructor(
12         context: Context,
13         attrs: AttributeSet? = null,
14         defStyleAttr: Int = 0
15 ) : LinearLayout(context, attrs, defStyleAttr) {
16 
17     init {
18         inflate(R.layout.tab_item)
19         orientation = VERTICAL
20 
<lambda>null21         attrs?.let {
22             val ta = context.obtainStyledAttributes(it, R.styleable.TabBarItemView, 0, 0)
23 
24             val titleRes = ta.getResourceId(R.styleable.TabBarItemView_titleText, 0)
25             if (titleRes != 0) {
26                 titleView.text = getText(titleRes)
27             }
28 
29             ta.recycle()
30         }
31     }
32 }