本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}