Created
December 18, 2014 11:54
-
-
Save Sefford/213d011b38ace2a6c6ad to your computer and use it in GitHub Desktop.
Helper method to gradually crossfade two tabs
This file contains 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
void selectTab(Float scroll, int direction) { | |
float localOffset = scroll - scroll.intValue(); | |
int intValue = scroll.intValue(); | |
switch (direction) { | |
case 1: | |
views[intValue].setTextColor((int) argbEvaluator.evaluate(localOffset, selectedColor, unselectedColor)); | |
if (intValue + 1 <= views.length - 1) { | |
views[intValue + 1].setTextColor((int) argbEvaluator.evaluate(localOffset, unselectedColor, selectedColor)); | |
} | |
return; | |
case 0: | |
views[intValue].setTextColor((int) argbEvaluator.evaluate(1 - localOffset, unselectedColor, selectedColor)); | |
views[intValue + 1].setTextColor((int) argbEvaluator.evaluate(1 - localOffset, selectedColor, unselectedColor)); | |
return; | |
default: | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment