BadgeView icon indicating copy to clipboard operation
BadgeView copied to clipboard

How to set direction up/down for animation?

Open trietbui85 opened this issue 9 years ago • 1 comments

How can I control animation direction, for example animation to scroll down instead of up?

trietbui85 avatar Oct 28 '15 03:10 trietbui85

There is no such functionality. Direction of animation depends on a value: if it is number then smaller value goes from top and vice versa, if it is text then goes from bottom. You can fix it in AbstractBadgeView by changing this:

final boolean isBigger = valueCenter.compare(newValue);
IValue<?> nextValue;
if (isBigger) {
    valueBottom = newValue;
    nextValue = valueBottom;
} else {
    valueTop = newValue;
    nextValue = valueTop;
}

To this:

final boolean isBigger = valueCenter.compare(newValue);
IValue<?> nextValue;
if (!isBigger) {// - inverse
    valueBottom = newValue;
    nextValue = valueBottom;
} else {
    valueTop = newValue;
    nextValue = valueTop;
}

By the way you could create a PR with additional custom xml attribute like inverseAnimation:boolean.

elevenetc avatar Oct 28 '15 14:10 elevenetc