当前位置: 首页>>代码示例>>Java>>正文


Java Point.offset方法代码示例

本文整理汇总了Java中android.graphics.Point.offset方法的典型用法代码示例。如果您正苦于以下问题:Java Point.offset方法的具体用法?Java Point.offset怎么用?Java Point.offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Point的用法示例。


在下文中一共展示了Point.offset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSelectedNoteLocation

import android.graphics.Point; //导入方法依赖的package包/类
public Point getSelectedNoteLocation()
{
	int numPages = getPageCount();
	for (int i = 0; i < numPages; i++)
	{
		DocPageView cv = (DocPageView) getOrCreateChild(i);
		if (cv.hasNoteAnnotationSelected())
		{
			Point p = cv.getSelectedNoteLocation();
			if (p != null)
			{
				//  offset to 0,0
				p.offset(cv.getLeft(), cv.getTop());

				//  offset to position in the scrolling view (this)
				p.offset(-getScrollX(), -getScrollY());

				return p;
			}
		}
	}

	return null;
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:25,代码来源:DocView.java

示例2: positionHandle

import android.graphics.Point; //导入方法依赖的package包/类
protected void positionHandle(DragHandle handle, DocPageView dpv, int pageX, int pageY)
{
	if (handle != null)
	{
		//  convert to DocPageView-based coords
		Point p = dpv.pageToView(pageX, pageY);

		//  offset to 0,0
		p.offset(dpv.getLeft(), dpv.getTop());

		//  offset to position in the scrolling view (this)
		p.offset(-getScrollX(), -getScrollY());

		//  offset based on handle size and padding
		p.offset(-selectionHandlePadPx - selectionHandleSizePx / 2, -selectionHandlePadPx - selectionHandleSizePx / 2);

		//  move it
		handle.moveTo(p.x, p.y);
	}
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:21,代码来源:DocView.java

示例3: animateActionOut

import android.graphics.Point; //导入方法依赖的package包/类
@Override
public int animateActionOut(Action action, int index, ActionView view, Point center) {
    Point actionCenter = view.getCircleCenterPoint();
    actionCenter.offset(view.getLeft(), view.getTop());
    ViewPropertyAnimator translateViewPropertyAnimator = view.animate()
            .translationY(center.y - actionCenter.y)
            .translationX(center.x - actionCenter.x)
            .setInterpolator(mOvershootInterpolator)
            .setStartDelay(0)
            .setDuration(150);

    ViewPropertyAnimator alphaViewPropertyAnimator = view.animate()
            .alpha(0)
            .setStartDelay(0)
            .setDuration(150);
    if (mStaggered) {
        translateViewPropertyAnimator.setStartDelay(index * 100);
        alphaViewPropertyAnimator.setStartDelay(index * 100);
    }

    return (index * 100) + 150;
}
 
开发者ID:ovenbits,项目名称:QuickActionView,代码行数:23,代码来源:SlideFromCenterAnimator.java

示例4: show

import android.graphics.Point; //导入方法依赖的package包/类
private void show(View anchor, Point offset) {
    if (mShown) {
        throw new RuntimeException("Show cannot be called when the QuickActionView is already visible");
    }
    mShown = true;

    ViewParent parent = anchor.getParent();
    if (parent instanceof View) {
        parent.requestDisallowInterceptTouchEvent(true);
    }

    mClickedView = anchor;

    int[] loc = new int[2];
    anchor.getLocationInWindow(loc);
    Point point = new Point(offset);
    point.offset(loc[0], loc[1]);
    display(point);
}
 
开发者ID:ovenbits,项目名称:QuickActionView,代码行数:20,代码来源:QuickActionView.java

示例5: jumpPoint

import android.graphics.Point; //导入方法依赖的package包/类
/**
 * marker点击时跳动一下
 */
public void jumpPoint(final Marker marker) {
    final Handler handler = new Handler();
    final long start = SystemClock.uptimeMillis();
    //获取地图投影坐标转换器
    Projection proj = amap.getProjection();
    final LatLng markerLatlng = marker.getPosition();
    Point markerPoint = proj.toScreenLocation(markerLatlng);
    markerPoint.offset(0, -50);
    final LatLng startLatLng = proj.fromScreenLocation(markerPoint);
    final long duration = 500;

    final Interpolator interpolator = new BounceInterpolator();
    handler.post(new Runnable() {
        @Override
        public void run() {
            long elapsed = SystemClock.uptimeMillis() - start;
            float t = interpolator.getInterpolation((float) elapsed
                    / duration);
            double lng = t * markerLatlng.longitude + (1 - t)
                    * startLatLng.longitude;
            double lat = t * markerLatlng.latitude + (1 - t)
                    * startLatLng.latitude;
            marker.setPosition(new LatLng(lat, lng));
            if (t < 1.0) {
                handler.postDelayed(this, 16);
            }
        }
    });
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:33,代码来源:PiclocationActivity.java

示例6: viewToScreen

import android.graphics.Point; //导入方法依赖的package包/类
private Point viewToScreen(Point p)
{
	Point newPoint = new Point(p);

	Rect r = new Rect();
	this.getGlobalVisibleRect(r);

	newPoint.offset(r.left, r.top);

	return newPoint;
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:12,代码来源:DocView.java

示例7: animateActionIn

import android.graphics.Point; //导入方法依赖的package包/类
@Override
public void animateActionIn(Action action, int index, ActionView view, Point center) {
    Point actionCenter = view.getCircleCenterPoint();
    actionCenter.offset(view.getLeft(), view.getTop());
    view.setTranslationY(center.y - actionCenter.y);
    view.setTranslationX(center.x - actionCenter.x);
    ViewPropertyAnimator viewPropertyAnimator = view.animate()
            .translationX(0)
            .translationY(0)
            .setInterpolator(mOvershootInterpolator)
            .setDuration(150);
    if (mStaggered) {
        viewPropertyAnimator.setStartDelay(index * 100);
    }
}
 
开发者ID:ovenbits,项目名称:QuickActionView,代码行数:16,代码来源:SlideFromCenterAnimator.java

示例8: onDrag

import android.graphics.Point; //导入方法依赖的package包/类
@Override
public void onDrag(DragHandle handle)
{
	if (handle == mSelectionHandleTopLeft)
	{
		Point p1 = mSelectionHandleTopLeft.getPosition();
		p1.offset(selectionHandlePadPx + selectionHandleSizePx / 2, selectionHandlePadPx + selectionHandleSizePx / 2);
		p1 = viewToScreen(p1);
		DocPageView pageView1 = findPageViewContainingPoint(p1.x, p1.y, false);
		if (pageView1 != null)
		{
			selectionStartPage = pageView1;
			p1 = pageView1.screenToPage(p1);
			selectionStartLoc.set(p1.x, p1.y);
			onChangeSelection();
		}
	}

	if (handle == mSelectionHandleBottomRight)
	{
		Point p2 = mSelectionHandleBottomRight.getPosition();
		p2.offset(selectionHandlePadPx + selectionHandleSizePx / 2, selectionHandlePadPx + selectionHandleSizePx / 2);
		p2 = viewToScreen(p2);
		DocPageView pageView2 = findPageViewContainingPoint(p2.x, p2.y, false);
		if (pageView2 != null)
		{
			selectionEndPage = pageView2;
			p2 = pageView2.screenToPage(p2);
			selectionEndLoc.set(p2.x, p2.y);
			onChangeSelection();
		}
	}

	//  TODO: for now, we're dealing with one page at a time
	int numPages = getPageCount();
	for (int i = 0; i < numPages; i++)
	{
		DocPageView cv = (DocPageView) getOrCreateChild(i);
		if (cv.isReallyVisible() && cv == selectionStartPage && cv == selectionEndPage)
		{
			cv.setSelection(selectionStartLoc, selectionEndLoc);
		}
		else
		{
			cv.removeSelection();
		}
		cv.invalidate();
	}
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:50,代码来源:DocView.java


注:本文中的android.graphics.Point.offset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。