當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。