當前位置: 首頁>>代碼示例>>Java>>正文


Java Point.equals方法代碼示例

本文整理匯總了Java中android.graphics.Point.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Point.equals方法的具體用法?Java Point.equals怎麽用?Java Point.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Point的用法示例。


在下文中一共展示了Point.equals方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkTouchBlock

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * 檢查小球是否撞擊到矩形塊
 * @param x 小球坐標X值
 * @param y 小球坐標Y值
 * @return 撞擊到:true,反之:false
 */
private boolean checkTouchBlock(float x, float y) {
    int columnX = (int) ((x - blockLeft - BALL_RADIUS - speed ) / blockWidth);
    columnX = columnX == blockHorizontalNum ? columnX - 1 : columnX;
    int rowY = (int) (y / blockHeight);
    rowY = rowY == BLOCK_VERTICAL_NUM ? rowY - 1 : rowY;
    Point p = new Point();
    p.set(columnX, rowY);

    boolean flag = false;
    for (Point point : pointList) {
        if (point.equals(p.x, p.y)) {
            flag = true;
            break;
        }
    }

    if (!flag) {
        pointList.add(p);
    }
    return !flag;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:FunGameHitBlockHeader.java

示例2: drawColorBlock

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * 繪製矩形色塊
 * @param canvas 默認畫布
 */
private void drawColorBlock(Canvas canvas) {
    float left, top;
    int column, row;
    for (int i = 0; i < blockHorizontalNum * BLOCK_VERTICAL_NUM; i++) {
        row = i / blockHorizontalNum;
        column = i % blockHorizontalNum;

        boolean flag = false;
        for (Point point : pointList) {
            if (point.equals(column, row)) {
                flag = true;
                break;
            }
        }
        if (flag) {
            continue;
        }

        blockPaint.setColor(ColorUtils.setAlphaComponent(lModelColor, 255 / (column + 1)));

        left = blockLeft + column * (blockWidth + DIVIDING_LINE_SIZE);
        top = DIVIDING_LINE_SIZE + row * (blockHeight + DIVIDING_LINE_SIZE);
        canvas.drawRect(left, top, left + blockWidth, top + blockHeight, blockPaint);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:FunGameHitBlockHeader.java

示例3: resizeSurfaceView

import android.graphics.Point; //導入方法依賴的package包/類
private void resizeSurfaceView() {
    Point point;
    if (cameraId == 0) {
        point = backCameraSize.getFirst();
    } else {
        point = frontCameraSize.getFirst();
    }
    if (currentUsePoint != null && point.equals(currentUsePoint)) {
        return;
    } else {
        currentUsePoint = point;
        int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
        int surfaceHeight = screenWidth * point.x / point.y;
        if (surfaceview != null) {
            RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) surfaceview.getLayoutParams();
            lp.width = screenWidth;
            lp.height = surfaceHeight;
            lp.addRule(13);
            surfaceview.setLayoutParams(lp);
        }
    }
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:23,代碼來源:CaptureVideoActivity.java

示例4: dragToWorkspace

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * Drags an icon to the center of homescreen.
 */
protected void dragToWorkspace(UiObject2 icon) {
    Point center = icon.getVisibleCenter();

    // Action Down
    sendPointer(MotionEvent.ACTION_DOWN, center);

    // Wait until "Remove/Delete target is visible
    assertNotNull(findViewById(R.id.delete_target_text));

    Point moveLocation = findViewById(R.id.drag_layer).getVisibleCenter();

    // Move to center
    while(!moveLocation.equals(center)) {
        center.x = getNextMoveValue(moveLocation.x, center.x);
        center.y = getNextMoveValue(moveLocation.y, center.y);
        sendPointer(MotionEvent.ACTION_MOVE, center);
    }
    sendPointer(MotionEvent.ACTION_UP, center);

    // Wait until remove target is gone.
    mDevice.wait(Until.gone(getSelectorForId(R.id.delete_target_text)), DEFAULT_UI_TIMEOUT);
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:26,代碼來源:LauncherInstrumentationTestCase.java

示例5: migrate

import android.graphics.Point; //導入方法依賴的package包/類
boolean migrate(Point sourceSize, Point targetSize) throws Exception {
    boolean dbChanged = false;
    if (!targetSize.equals(sourceSize)) {
        if (sourceSize.x < targetSize.x) {
            // Source is smaller that target, just expand the grid without actual migration.
            sourceSize.x = targetSize.x;
        }
        if (sourceSize.y < targetSize.y) {
            // Source is smaller that target, just expand the grid without actual migration.
            sourceSize.y = targetSize.y;
        }

        // Migrate the workspace grid, such that the points differ by max 1 in x and y
        // each on every step.
        while (!targetSize.equals(sourceSize)) {
            // Get the next size, such that the points differ by max 1 in x and y each
            Point nextSize = new Point(sourceSize);
            if (targetSize.x < nextSize.x) {
                nextSize.x--;
            }
            if (targetSize.y < nextSize.y) {
                nextSize.y--;
            }
            if (runStepTask(sourceSize, nextSize)) {
                dbChanged = true;
            }
            sourceSize.set(nextSize.x, nextSize.y);
        }
    }
    return dbChanged;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:32,代碼來源:GridSizeMigrationTask.java

示例6: getThumbnailsCache

import android.graphics.Point; //導入方法依賴的package包/類
public static ThumbnailCache getThumbnailsCache(Context context, Point size) {
    final DocumentsApplication app = (DocumentsApplication) context.getApplicationContext();
    final ThumbnailCache thumbnails = app.mThumbnails;
    if (!size.equals(app.mThumbnailsSize)) {
        thumbnails.evictAll();
        app.mThumbnailsSize = size;
    }
    return thumbnails;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:10,代碼來源:DocumentsApplication.java

示例7: migrate

import android.graphics.Point; //導入方法依賴的package包/類
public boolean migrate(Point sourceSize, Point targetSize) throws Exception {
    boolean dbChanged = false;
    if (!targetSize.equals(sourceSize)) {
        if (sourceSize.x < targetSize.x) {
            // Source is smaller that target, just expand the grid without actual migration.
            sourceSize.x = targetSize.x;
        }
        if (sourceSize.y < targetSize.y) {
            // Source is smaller that target, just expand the grid without actual migration.
            sourceSize.y = targetSize.y;
        }

        // Migrate the workspace grid, such that the points differ by max 1 in x and y
        // each on every step.
        while (!targetSize.equals(sourceSize)) {
            // Get the next size, such that the points differ by max 1 in x and y each
            Point nextSize = new Point(sourceSize);
            if (targetSize.x < nextSize.x) {
                nextSize.x--;
            }
            if (targetSize.y < nextSize.y) {
                nextSize.y--;
            }
            if (runStepTask(sourceSize, nextSize)) {
                dbChanged = true;
            }
            sourceSize.set(nextSize.x, nextSize.y);
        }
    }
    return dbChanged;
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:32,代碼來源:GridSizeMigrationTask.java

示例8: updateHq

import android.graphics.Point; //導入方法依賴的package包/類
public void updateHq(boolean update) {
	Rect viewArea = new Rect(getLeft(),getTop(),getRight(),getBottom());
	if (viewArea.width() == mSize.x || viewArea.height() == mSize.y) {
		// If the viewArea's size matches the unzoomed size, there is no need for an hq patch
		if (mPatch != null) {
			mPatch.setImageBitmap(null);
			mPatch.invalidate();
		}
	} else {
		final Point patchViewSize = new Point(viewArea.width(), viewArea.height());
		final Rect patchArea = new Rect(0, 0, mParentSize.x, mParentSize.y);

		// Intersect and test that there is an intersection
		if (!patchArea.intersect(viewArea))
			return;

		// Offset patch area to be relative to the view top left
		patchArea.offset(-viewArea.left, -viewArea.top);

		boolean area_unchanged = patchArea.equals(mPatchArea) && patchViewSize.equals(mPatchViewSize);

		// If being asked for the same area as last time and not because of an update then nothing to do
		if (area_unchanged && !update)
			return;

		boolean completeRedraw = !(area_unchanged && update);

		// Stop the drawing of previous patch if still going
		if (mDrawPatch != null) {
			mDrawPatch.cancel();
			mDrawPatch = null;
		}

		// Create and add the image view if not already done
		if (mPatch == null) {
			mPatch = new OpaqueImageView(mContext);
			mPatch.setScaleType(ImageView.ScaleType.MATRIX);
			addView(mPatch);
			mSearchView.bringToFront();
		}

		CancellableTaskDefinition<Void, Void> task;

		if (completeRedraw)
			task = getDrawPageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
							patchArea.left, patchArea.top,
							patchArea.width(), patchArea.height());
		else
			task = getUpdatePageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
					patchArea.left, patchArea.top,
					patchArea.width(), patchArea.height());

		mDrawPatch = new CancellableAsyncTask<Void,Void>(task) {

			public void onPostExecute(Void result) {
				mPatchViewSize = patchViewSize;
				mPatchArea = patchArea;
				mPatch.setImageBitmap(mPatchBm);
				mPatch.invalidate();
				//requestLayout();
				// Calling requestLayout here doesn't lead to a later call to layout. No idea
				// why, but apparently others have run into the problem.
				mPatch.layout(mPatchArea.left, mPatchArea.top, mPatchArea.right, mPatchArea.bottom);
			}
		};

		mDrawPatch.execute();
	}
}
 
開發者ID:ArtifexSoftware,項目名稱:mupdf-android-viewer-old,代碼行數:70,代碼來源:PageView.java


注:本文中的android.graphics.Point.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。