-
Notifications
You must be signed in to change notification settings - Fork 6
/
TextTabActivity.kt
41 lines (36 loc) · 1.21 KB
/
TextTabActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package jp.co.cyberagent.android.tabanimationsample
import android.graphics.Color
import android.view.View
import androidx.core.content.ContextCompat
import jp.co.cyberagent.android.tabanimation.SimpleTab
import jp.co.cyberagent.android.tabanimation.ViewIdAnimationInfoSet
import jp.co.cyberagent.android.tabanimation.property
import jp.co.cyberagent.android.tabanimation.viewIdAnimationInfo
class TextTabActivity : BaseActivity() {
companion object {
private const val TAB_SELECTED_SCALE = 1f
private const val TAB_UNSELECTED_SCALE = 0.9f
}
override val animationInfo: ViewIdAnimationInfoSet =
viewIdAnimationInfo {
animateText<Float> {
property(View.SCALE_X)
startValue(TAB_UNSELECTED_SCALE)
endValue(TAB_SELECTED_SCALE)
}
animateText<Float> {
property(View.SCALE_Y)
startValue(TAB_UNSELECTED_SCALE)
endValue(TAB_SELECTED_SCALE)
}
animateText<Int> {
property(
getter = { currentTextColor },
setter = { setTextColor(it) }
)
startValue(Color.GRAY)
endValue { ContextCompat.getColor(it.context, R.color.colorAccent) }
}
}
override val tabType: SimpleTab = SimpleTab.TEXT
}