use of android.graphics.PointF in project ViewPagerIndicator by LuckyJayce.
the class RecyclerIndicatorView method smoothScrollToPosition.
private void smoothScrollToPosition(int position, final int offeset) {
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(getContext()) {
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
PointF pointF = linearLayoutManager.computeScrollVectorForPosition(targetPosition);
pointF.x += offeset;
return pointF;
}
};
linearSmoothScroller.setTargetPosition(position);
linearLayoutManager.startSmoothScroll(linearSmoothScroller);
}
use of android.graphics.PointF in project TouchImageView by MikeOrtiz.
the class SingleTouchImageViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_touchimageview);
//
// DecimalFormat rounds to 2 decimal places.
//
df = new DecimalFormat("#.##");
scrollPositionTextView = (TextView) findViewById(R.id.scroll_position);
zoomedRectTextView = (TextView) findViewById(R.id.zoomed_rect);
currentZoomTextView = (TextView) findViewById(R.id.current_zoom);
image = (TouchImageView) findViewById(R.id.img);
//
// Set the OnTouchImageViewListener which updates edit texts
// with zoom and scroll diagnostics.
//
image.setOnTouchImageViewListener(new OnTouchImageViewListener() {
@Override
public void onMove() {
PointF point = image.getScrollPosition();
RectF rect = image.getZoomedRect();
float currentZoom = image.getCurrentZoom();
boolean isZoomed = image.isZoomed();
scrollPositionTextView.setText("x: " + df.format(point.x) + " y: " + df.format(point.y));
zoomedRectTextView.setText("left: " + df.format(rect.left) + " top: " + df.format(rect.top) + "\nright: " + df.format(rect.right) + " bottom: " + df.format(rect.bottom));
currentZoomTextView.setText("getCurrentZoom(): " + currentZoom + " isZoomed(): " + isZoomed);
}
});
}
use of android.graphics.PointF in project TouchImageView by MikeOrtiz.
the class TouchImageView method setZoom.
/**
* Set zoom parameters equal to another TouchImageView. Including scale, position,
* and ScaleType.
* @param TouchImageView
*/
public void setZoom(TouchImageView img) {
PointF center = img.getScrollPosition();
setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
}
use of android.graphics.PointF in project TouchImageView by MikeOrtiz.
the class TouchImageView method getZoomedRect.
/**
* Return a Rect representing the zoomed image.
* @return rect representing zoomed image
*/
public RectF getZoomedRect() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
}
PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);
float w = getDrawable().getIntrinsicWidth();
float h = getDrawable().getIntrinsicHeight();
return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
}
use of android.graphics.PointF in project BoomMenu by Nightonke.
the class TextOutsideCircleButton method init.
private void init(Builder builder) {
LayoutInflater.from(context).inflate(R.layout.bmb_text_outside_circle_button, this, true);
initAttrs(builder);
initTextOutsideCircleButtonLayout();
initShadow(buttonRadius + shadowRadius);
initCircleButton();
initText(layout);
initImage();
centerPoint = new PointF(trueRadius, trueRadius);
}
Aggregations