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

The following are Jave code examples for showing how to use setY() 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: GitHub   File: Instrument.java   View Source Code Vote up 6 votes
public void slidingToY(View view ,float y){
    if(view == null){
        return;
    }
    view.clearAnimation();
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        view.setY(y);
    }else{
        ViewHelper.setY(view, y);
    }
}
 
Example 2
Project: ClouldReader   File: Instrument.java   View Source Code Vote up 5 votes
public void slidingToY(View view ,float y){
    if(view == null){
        return;
    }
    view.clearAnimation();
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        view.setY(y);
    }else{
        ViewHelper.setY(view, y);
    }
}
 
Example 3
Project: XERUNG   File: Slider.java   View Source Code Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
	super.onDraw(canvas);

	if (numberIndicatorResize == false) {
		RelativeLayout.LayoutParams params = (LayoutParams) numberIndicator.
				numberIndicator.getLayoutParams();
		params.height = (int) finalSize * 2;
		params.width = (int) finalSize * 2;
		numberIndicator.numberIndicator.setLayoutParams(params);
	}

	Paint paint = new Paint();
	paint.setAntiAlias(true);
	paint.setColor(backgroundColor);
	if (animate) {
		if (y == 0)
			y = finalY + finalSize * 2;
		y -= Utils.dpToPx(6, getResources());
		size += Utils.dpToPx(2, getResources());
	}
	canvas.drawCircle(
			ViewHelper.getX(ball) + Utils.getRelativeLeft((View) ball.getParent())
					+ ball.getWidth() / 2, y, size, paint);
	if (animate && size >= finalSize)
		animate = false;
	if (animate == false) {
		ViewHelper.setX(numberIndicator.numberIndicator, 
				(ViewHelper.getX(ball) + Utils.getRelativeLeft((View) ball.getParent()) + ball.getWidth() / 2) - size);
		ViewHelper.setY(numberIndicator.numberIndicator, y - size);
		numberIndicator.numberIndicator.setText(value + "");
	}
	invalidate();
}
 
Example 4
Project: XERUNG   File: Slider.java   View Source Code Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
	super.onDraw(canvas);

	if (numberIndicatorResize == false) {
		RelativeLayout.LayoutParams params = (LayoutParams) numberIndicator.
				numberIndicator.getLayoutParams();
		params.height = (int) finalSize * 2;
		params.width = (int) finalSize * 2;
		numberIndicator.numberIndicator.setLayoutParams(params);
	}

	Paint paint = new Paint();
	paint.setAntiAlias(true);
	paint.setColor(backgroundColor);
	if (animate) {
		if (y == 0)
			y = finalY + finalSize * 2;
		y -= Utils.dpToPx(6, getResources());
		size += Utils.dpToPx(2, getResources());
	}
	canvas.drawCircle(
			ViewHelper.getX(ball) + Utils.getRelativeLeft((View) ball.getParent())
					+ ball.getWidth() / 2, y, size, paint);
	if (animate && size >= finalSize)
		animate = false;
	if (animate == false) {
		ViewHelper.setX(numberIndicator.numberIndicator, 
				(ViewHelper.getX(ball) + Utils.getRelativeLeft((View) ball.getParent()) + ball.getWidth() / 2) - size);
		ViewHelper.setY(numberIndicator.numberIndicator, y - size);
		numberIndicator.numberIndicator.setText(value + "");
	}
	invalidate();
}