Refactor View.selected usage to View.activated

The View documentation recommends using activated to indicate whether or not a view is selected: https://developer.android.com/reference/android/view/View#setActivated(boolean)
This commit is contained in:
Moez Bhatti
2018-08-14 16:49:44 +02:00
parent a646291c51
commit 7be398ee06
8 changed files with 19 additions and 19 deletions
@@ -71,13 +71,13 @@ class PagerTitleView @JvmOverloads constructor(context: Context, attrs: Attribut
}
childCount.forEach { index ->
getChildAt(index).isSelected = index == pager?.currentItem
getChildAt(index).isActivated = index == pager?.currentItem
}
pager?.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
childCount.forEach { index ->
getChildAt(index).isSelected = index == position
getChildAt(index).isActivated = index == position
}
}
})
@@ -87,8 +87,8 @@ class PagerTitleView @JvmOverloads constructor(context: Context, attrs: Attribut
super.onAttachedToWindow()
val states = arrayOf(
intArrayOf(android.R.attr.state_selected),
intArrayOf(-android.R.attr.state_selected))
intArrayOf(android.R.attr.state_activated),
intArrayOf(-android.R.attr.state_activated))
threadId
.distinctUntilChanged()