Java Code Examples for com.nineoldandroids.view.ViewHelper.getX()

The following are Jave code examples for showing how to use getX() of the com.nineoldandroids.view.ViewHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: XERUNG   File: Switch.java   View Source Code Vote up 5 votes
private void placeBall() {
	ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
	ball.xIni = ViewHelper.getX(ball);
	ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
	ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
	placedBall = true;
	ball.animateCheck();
}
 
Example 2
Project: XERUNG   File: Slider.java   View Source Code Vote up 5 votes
private void placeBall() {
	ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
	ball.xIni = ViewHelper.getX(ball);
	ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
	ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
	placedBall = true;
}
 
Example 3
Project: XERUNG   File: Switch.java   View Source Code Vote up 5 votes
private void placeBall() {
	ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
	ball.xIni = ViewHelper.getX(ball);
	ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
	ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
	placedBall = true;
	ball.animateCheck();
}
 
Example 4
Project: XERUNG   File: Slider.java   View Source Code Vote up 5 votes
private void placeBall() {
	ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
	ball.xIni = ViewHelper.getX(ball);
	ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
	ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
	placedBall = true;
}
 
Example 5
Project: DMAudioStreamer   File: Slider.java   View Source Code Vote up 5 votes
private void placeBall() {
    ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
    ball.xIni = ViewHelper.getX(ball);
    ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
    ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
    placedBall = true;
}
 
Example 6
Project: browser   File: SwipeListViewTouchListener.java   View Source Code Vote up 4 votes
/**
 * Moves the view
 *
 * @param deltaX delta
 */
public void move(float deltaX) {
    swipeListView.onMove(downPosition, deltaX);
    float posX = ViewHelper.getX(frontView);
    if (opened.get(downPosition)) {
        posX += openedRight.get(downPosition) ? -viewWidth + rightOffset : viewWidth - leftOffset;
    }
    if (posX > 0 && !swipingRight) {
        Log.d("SwipeListView", "change to right");
        swipingRight = !swipingRight;
        swipeCurrentAction = swipeActionRight;
        if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
            backView.setVisibility(View.GONE);
        } else {
            backView.setVisibility(View.VISIBLE);
        }
    }
    if (posX < 0 && swipingRight) {
        Log.d("SwipeListView", "change to left");
        swipingRight = !swipingRight;
        swipeCurrentAction = swipeActionLeft;
        if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
            backView.setVisibility(View.GONE);
        } else {
            backView.setVisibility(View.VISIBLE);
        }
    }
    if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_DISMISS) {
        setTranslationX(parentView, deltaX);
        setAlpha(parentView, Math.max(0f, Math.min(1f,
                1f - 2f * Math.abs(deltaX) / viewWidth)));
    } else if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
        if ((swipingRight && deltaX > 0 && posX < DISPLACE_CHOICE)
                || (!swipingRight && deltaX < 0 && posX > -DISPLACE_CHOICE)
                || (swipingRight && deltaX < DISPLACE_CHOICE)
                || (!swipingRight && deltaX > -DISPLACE_CHOICE)) {
            setTranslationX(frontView, deltaX);
        }
    } else {
        setTranslationX(frontView, deltaX);
    }
}
 
Example 7
Project: youkes_browser   File: SwipeListViewTouchListener.java   View Source Code Vote up 4 votes
/**
 * Moves the view
 *
 * @param deltaX delta
 */
public void move(float deltaX) {
    swipeListView.onMove(downPosition, deltaX);
    float posX = ViewHelper.getX(frontView);
    if (opened.get(downPosition)) {
        posX += openedRight.get(downPosition) ? -viewWidth + rightOffset : viewWidth - leftOffset;
    }
    if (posX > 0 && !swipingRight) {
        Log.d("SwipeListView", "change to right");
        swipingRight = !swipingRight;
        swipeCurrentAction = swipeActionRight;
        if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
            backView.setVisibility(View.GONE);
        } else {
            backView.setVisibility(View.VISIBLE);
        }
    }
    if (posX < 0 && swipingRight) {
        Log.d("SwipeListView", "change to left");
        swipingRight = !swipingRight;
        swipeCurrentAction = swipeActionLeft;
        if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
            backView.setVisibility(View.GONE);
        } else {
            backView.setVisibility(View.VISIBLE);
        }
    }
    if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_DISMISS) {
        setTranslationX(parentView, deltaX);
        setAlpha(parentView, Math.max(0f, Math.min(1f,
                1f - 2f * Math.abs(deltaX) / viewWidth)));
    } else if (swipeCurrentAction == SwipeListView.SWIPE_ACTION_CHOICE) {
        if ((swipingRight && deltaX > 0 && posX < DISPLACE_CHOICE)
                || (!swipingRight && deltaX < 0 && posX > -DISPLACE_CHOICE)
                || (swipingRight && deltaX < DISPLACE_CHOICE)
                || (!swipingRight && deltaX > -DISPLACE_CHOICE)) {
            setTranslationX(frontView, deltaX);
        }
    } else {
        setTranslationX(frontView, deltaX);
    }
}