Skip to content

Instantly share code, notes, and snippets.

@amalhanaja
Created June 5, 2018 09:20
Show Gist options
  • Select an option

  • Save amalhanaja/eadefa0f6ec060df4d2a49eed70bb87b to your computer and use it in GitHub Desktop.

Select an option

Save amalhanaja/eadefa0f6ec060df4d2a49eed70bb87b to your computer and use it in GitHub Desktop.
Slide Transisi Warna
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