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

The following examples show how to use com.nineoldandroids.view.ViewHelper#setY() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: XERUNG   File: Slider.java    License: Apache License 2.0 5 votes vote down vote up
@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 2
Source Project: XERUNG   File: Slider.java    License: Apache License 2.0 5 votes vote down vote up
@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 3
Source Project: LLApp   File: Instrument.java    License: Apache License 2.0 5 votes vote down vote up
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 4
Source Project: CloudReader   File: Instrument.java    License: Apache License 2.0 5 votes vote down vote up
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 5
Source Project: MoeGallery   File: Slider.java    License: GNU General Public License v3.0 5 votes vote down vote up
@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 6
Source Project: MousePaint   File: ArcAnimator.java    License: MIT License 5 votes vote down vote up
void setDegree(float degree){
    mValue = degree;
    View clipView = mTarget.get();
    float x = mArcMetric.getAxisPoint().x + mArcMetric.mRadius
            * Utils.cos(degree);
    float y = mArcMetric.getAxisPoint().y - mArcMetric.mRadius
            * Utils.sin(degree);
    ViewHelper.setX(clipView,x - clipView.getWidth() / 2);
    ViewHelper.setY(clipView,y - clipView.getHeight() / 2);
}
 
Example 7
Source Project: meiShi   File: Slider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if (numberIndicatorResize == false) {
        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(getNumberIndicatorValue(value));
    }
    invalidate();
}
 
Example 8
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {

    fabTotalHeight = fab.getHeight() +
            fabMargin + /*bottom margin*/
            fabMargin;  /*top margin*/

    initialYPosition = getInitialYPosition();

    if (overflowGestureListener.isOpened() && !changed) {
        ViewHelper.setY(this, 0f);
    } else {
        ViewHelper.setY(this, initialYPosition);
    }

    overflowGestureListener.setInitialYPosition(initialYPosition);

    if (!isInEditMode()) {
        //measured on device
        contentFrame.setPadding(0, fabTotalHeight / 2, 0, 0);
    } else {
        //measured on visual editor
        contentFrame.setPadding(0, fabTotalHeight, 0, 0);
    }

    super.onLayout(changed, left, top, right, bottom);
}
 
Example 9
Source Project: MaterialDesignLibrary   File: Slider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (numberIndicatorResize == false) {
        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();
}