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

The following examples show how to use com.nineoldandroids.view.ViewHelper#setY() . 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 check out the related API usage on the sidebar.
Example 1
Source File: Slider.java    From XERUNG with 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 File: Slider.java    From XERUNG with 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 File: Instrument.java    From LLApp with 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 File: Instrument.java    From CloudReader with 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 File: Slider.java    From MoeGallery with 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 File: ArcAnimator.java    From MousePaint with 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 File: Slider.java    From meiShi with 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
Source File: MaterialContentOverflow.java    From MaterialContentOverflow with Apache License 2.0 5 votes vote down vote up
@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 File: Slider.java    From MaterialDesignLibrary with 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();
}