Created
June 5, 2018 09:20
-
-
Save amalhanaja/eadefa0f6ec060df4d2a49eed70bb87b to your computer and use it in GitHub Desktop.
Slide Transisi Warna
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun setParentBackgroundColor(offset: Float, position: Int): Int { | |
| val bgColorList = listOf( | |
| ContextCompat.getColor(baseActivity, R.color.blue), | |
| ContextCompat.getColor(baseActivity, R.color.green) | |
| ) | |
| return ArgbEvaluator().evaluate( | |
| offset, | |
| bgColorList[if (position > bgColorList.size - 1) 0 else position], | |
| bgColorList[when { | |
| position > bgColorList.size - 1 -> 0 | |
| position == bgColorList.size - 1 -> 0 | |
| else -> position + 1 | |
| }] | |
| ) as Int | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment