@@ -8,8 +8,8 @@ import android.view.LayoutInflater
88import android.widget.LinearLayout
99import android.widget.TextView
1010import androidx.annotation.DrawableRes
11- import kotlinx.android.synthetic.main.player_seek_seconds_view.view.*
1211import org.schabi.newpipe.R
12+ import org.schabi.newpipe.databinding.PlayerSeekSecondsViewBinding
1313
1414class SecondsView (context : Context , attrs : AttributeSet ? ) : LinearLayout(context, attrs) {
1515
@@ -29,34 +29,35 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
2929
3030 var seconds: Int = 0
3131 set(value) {
32- tv_seconds .text = context.resources.getQuantityString(
32+ binding.tvSeconds .text = context.resources.getQuantityString(
3333 R .plurals.seconds, value, value
3434 )
3535 field = value
3636 }
3737
3838 var isForward: Boolean = true
3939 set(value) {
40- triangle_container .rotation = if (value) 0f else 180f
40+ binding.triangleContainer .rotation = if (value) 0f else 180f
4141 field = value
4242 }
4343
44+ val binding = PlayerSeekSecondsViewBinding .inflate(LayoutInflater .from(context), this )
45+
4446 val textView: TextView
45- get() = tv_seconds
47+ get() = binding.tvSeconds
4648
4749 @DrawableRes
4850 var icon: Int = R .drawable.ic_play_seek_triangle
4951 set(value) {
5052 if (value > 0 ) {
51- icon_1 .setImageResource(value)
52- icon_2 .setImageResource(value)
53- icon_3 .setImageResource(value)
53+ binding.icon1 .setImageResource(value)
54+ binding.icon2 .setImageResource(value)
55+ binding.icon3 .setImageResource(value)
5456 }
5557 field = value
5658 }
5759
5860 init {
59- LayoutInflater .from(context).inflate(R .layout.player_seek_seconds_view, this , true )
6061 orientation = VERTICAL
6162 layoutParams = LayoutParams (LayoutParams .MATCH_PARENT , LayoutParams .WRAP_CONTENT )
6263 }
@@ -77,19 +78,19 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
7778 }
7879
7980 private fun reset () {
80- icon_1 .alpha = 0f
81- icon_2 .alpha = 0f
82- icon_3 .alpha = 0f
81+ binding.icon1 .alpha = 0f
82+ binding.icon2 .alpha = 0f
83+ binding.icon3 .alpha = 0f
8384 }
8485
8586 private val firstAnimator: ValueAnimator = CustomValueAnimator (
8687 {
87- icon_1 .alpha = 0f
88- icon_2 .alpha = 0f
89- icon_3 .alpha = 0f
88+ binding.icon1 .alpha = 0f
89+ binding.icon2 .alpha = 0f
90+ binding.icon3 .alpha = 0f
9091 },
9192 {
92- icon_1 .alpha = it
93+ binding.icon1 .alpha = it
9394 },
9495 {
9596 secondAnimator.start()
@@ -98,12 +99,12 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
9899
99100 private val secondAnimator: ValueAnimator = CustomValueAnimator (
100101 {
101- icon_1 .alpha = 1f
102- icon_2 .alpha = 0f
103- icon_3 .alpha = 0f
102+ binding.icon1 .alpha = 1f
103+ binding.icon2 .alpha = 0f
104+ binding.icon3 .alpha = 0f
104105 },
105106 {
106- icon_2 .alpha = it
107+ binding.icon2 .alpha = it
107108 },
108109 {
109110 thirdAnimator.start()
@@ -112,13 +113,13 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
112113
113114 private val thirdAnimator: ValueAnimator = CustomValueAnimator (
114115 {
115- icon_1 .alpha = 1f
116- icon_2 .alpha = 1f
117- icon_3 .alpha = 0f
116+ binding.icon1 .alpha = 1f
117+ binding.icon2 .alpha = 1f
118+ binding.icon3 .alpha = 0f
118119 },
119120 {
120- icon_1. alpha = 1f - icon_3 .alpha
121- icon_3 .alpha = it
121+ binding.icon1. alpha = 1f - binding.icon3 .alpha
122+ binding.icon3 .alpha = it
122123 },
123124 {
124125 fourthAnimator.start()
@@ -127,12 +128,12 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
127128
128129 private val fourthAnimator: ValueAnimator = CustomValueAnimator (
129130 {
130- icon_1 .alpha = 0f
131- icon_2 .alpha = 1f
132- icon_3 .alpha = 1f
131+ binding.icon1 .alpha = 0f
132+ binding.icon2 .alpha = 1f
133+ binding.icon3 .alpha = 1f
133134 },
134135 {
135- icon_2 .alpha = 1f - it
136+ binding.icon2 .alpha = 1f - it
136137 },
137138 {
138139 fifthAnimator.start()
@@ -141,12 +142,12 @@ class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context
141142
142143 private val fifthAnimator: ValueAnimator = CustomValueAnimator (
143144 {
144- icon_1 .alpha = 0f
145- icon_2 .alpha = 0f
146- icon_3 .alpha = 1f
145+ binding.icon1 .alpha = 0f
146+ binding.icon2 .alpha = 0f
147+ binding.icon3 .alpha = 1f
147148 },
148149 {
149- icon_3 .alpha = 1f - it
150+ binding.icon3 .alpha = 1f - it
150151 },
151152 {
152153 firstAnimator.start()
0 commit comments