@@ -167,20 +167,20 @@ class MainActivity: AppCompatActivity() {
167167 wifi_RecyclerView.layoutManager.findViewByPosition(position)?.label?.setTypeface(null , Typeface .BOLD )
168168 return (wifi_RecyclerView.layoutManager.findViewByPosition(position)?.label?.text ? : " " )[0 ].toUpperCase().toString()
169169 }
170- fun unboldOldScrollPosition () {
171- wifi_RecyclerView.layoutManager.findViewByPosition(oldPos)?.label?.let {
172- it.startAnimation(AnimationUtils .loadAnimation(this @MainActivity, R .anim.textview_unbold).apply {
173- setAnimationListener(object : Animation .AnimationListener {
174- override fun onAnimationStart (animation : Animation ? ) {}
170+ private val animation by lazy {
171+ AnimationUtils .loadAnimation(this @MainActivity, R .anim.textview_unbold).apply {
172+ setAnimationListener(object : Animation .AnimationListener {
173+ override fun onAnimationStart (animation : Animation ? ) {}
175174
176- override fun onAnimationRepeat (animation : Animation ? ) {}
175+ override fun onAnimationRepeat (animation : Animation ? ) {}
177176
178- override fun onAnimationEnd (animation : Animation ? ) {
179- it.setTypeface(null , Typeface .NORMAL )
180- }
181- })
182- })
183- }
177+ override fun onAnimationEnd (animation : Animation ? ) {
178+ wifi_RecyclerView.layoutManager.findViewByPosition(oldPos)?.label?.setTypeface(null , Typeface .NORMAL )
179+ }
180+ })
181+ }}
182+ fun unboldOldScrollPosition () {
183+ wifi_RecyclerView.layoutManager.findViewByPosition(oldPos)?.label?.startAnimation(animation)
184184 }
185185 }
186186
0 commit comments