Skip to content

Commit

Permalink
removed reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
zagum committed Jan 12, 2017
1 parent aac583b commit 4618533
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 52 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -266,23 +266,22 @@ private void updateColor(float fraction) {

private void updateAlpha(float fraction) {
int alpha = (int) ((disabledStateAlpha + (1f - fraction) * (1f - disabledStateAlpha)) * 255);
updateImageAlphaWithoutInvalidate(alpha);
updateImageAlpha(alpha);
dashPaint.setAlpha(alpha);
}

private void updateImageAlphaWithoutInvalidate(int alpha) {
alpha &= 0xFF;
ReflectionUtils.setValue(this, "mAlpha", alpha);
ReflectionUtils.setValue(this, "mColorMod", true);
Class<?> noParams[] = {};
ReflectionUtils.callMethod(this, "applyColorMod", noParams);
}

private void updateImageColor(int color) {
colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN);
ReflectionUtils.setValue(this, "mColorFilter", colorFilter);
Class<?> noParams[] = {};
ReflectionUtils.callMethod(this, "applyColorMod", noParams);
setColorFilter(colorFilter);
}

@SuppressWarnings("deprecation")
private void updateImageAlpha(int alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
setImageAlpha(alpha);
} else {
setAlpha(alpha);
}
}

private void postInvalidateOnAnimationCompat() {
Expand Down

0 comments on commit 4618533

Please sign in to comment.