Code example for ObjectAnimator

Methods: isRunning, isStarted, start

0
            case ON_SCREEN:
                // * Hide quick return bar if first visible child is the same AND it's Y position decreases 
                // * Hide quick return bar if first visible child changes to a later sibling 
                // * AND only if the quick return bar isn't already going away 
                if (wasPreviousFirstVisibleChildScrolledUpAndQuickReturnBarIsNotGoingAway(first_visible_child, y_position))
                    _quick_return_bar_hide_animator.start();
                break; 
 
            case RETURNING:
                // * Cancel return of quick return bar if first visible child is the same AND it's Y position decreases 
                // * Cancel return of quick return bar if first visible child changes to a later sibling 
                if (wasPreviousFirstVisibleChildScrolledUp(first_visible_child, y_position)) {
                    _quick_return_bar_return_animator.cancel();
                    _quick_return_bar_hide_animator.start();
                } 
                break; 
 
            case HIDING:
                // * Cancel hide of quick return bar if first visible child is the same AND it's Y position increases 
                // * Cancel hide of quick return bar if first visible child changes to a previous sibling 
                if (wasPreviousFirstVisibleChildScrolledDown(first_visible_child, y_position)) {
                    _quick_return_bar_hide_animator.cancel();
                    _quick_return_bar_return_animator.start();
                } 
                break; 
        } 
        _last_first_child = first_visible_child;
        _last_y = y_position;
    } 
 
    @Override 
    public void onScrollStateChanged(AbsListView _, int __) { }
 
/* Transition status checks */ 
    /** 
     * <p>Checks if the quick return bar is transitioning back onto the screen.</p> 
     * @return {@code true} indicates that the quick return bar is returning 
     */ 
    private boolean quickReturnBarIsReturning() { 
        // This should be equivalent to checking that the quick return bar is RETURNING 
        return _quick_return_bar_return_animator.isRunning() || _quick_return_bar_return_animator.isStarted();
    } 
 
    /** 
     * <p>Checks if the quick return bar is transitioning off of the screen.</p> 
     * @return {@code true} indicates that the quick return bar is going away 
     */ 
    private boolean quickReturnBarIsGoingAway() { 
        return _quick_return_bar_hide_animator.isRunning() || _quick_return_bar_hide_animator.isStarted();
    } 
 
    private boolean wasPreviousFirstVisibleChildScrolledUp(int first_visible_child, int y_position) {
        return first_visible_child == _last_first_child && y_position < _last_y
                || first_visible_child > _last_first_child;