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


Java RectF.contains方法代码示例

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


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

示例1: generateRectangles

import android.graphics.RectF; //导入方法依赖的package包/类
private void generateRectangles() {
    for (BackportAppointment a : dayAppointments) {
        // Default, left aligned (not shifted) rectangle
        RectF a_rect = layoutRectangle(a);

        // Check for each rects if intersection is present
        boolean check_intersect = true;
        int i = 0;
        start_intersection_check:
        while (check_intersect) {
            for (RectF r : eventRectangles.values()) {
                if (r.contains(a_rect) || RectF.intersects(r, a_rect)) {
                    if (++i > shiftX_max) shiftX_max = i;
                    // shift one unit to the right and start again
                    a_rect.offset(dp(2 * X_OFFSET + X_WIDTH), 0);
                    continue start_intersection_check;
                } // else check next
            }

            // finish
            check_intersect = false;
        }

        eventRectangles.put(a, a_rect);
    }
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:27,代码来源:WeekdayView.java

示例2: getSeriesAndPointForScreenCoordinate

import android.graphics.RectF; //导入方法依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(final Point screenPoint) {
  if (clickableAreas != null)
    for (int seriesIndex = clickableAreas.size() - 1; seriesIndex >= 0; seriesIndex--) {
      // series 0 is drawn first. Then series 1 is drawn on top, and series 2
      // on top of that.
      // we want to know what the user clicked on, so traverse them in the
      // order they appear on the screen.
      int pointIndex = 0;
      if (clickableAreas.get(seriesIndex) != null) {
        RectF rectangle;
        for (ClickableArea area : clickableAreas.get(seriesIndex)) {
          if (area != null) {
            rectangle = area.getRect();
            if (rectangle != null && rectangle.contains(screenPoint.getX(), screenPoint.getY())) {
              return new SeriesSelection(seriesIndex, pointIndex, area.getX(), area.getY());
            }
          }
          pointIndex++;
        }
      }
    }
  return super.getSeriesAndPointForScreenCoordinate(screenPoint);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:24,代码来源:XYChart.java

示例3: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;

    ImageView imageView = photoViewAttacher.getImageView();

    if (null != photoViewAttacher.getOnPhotoTapListener()) {
        final RectF displayRect = photoViewAttacher.getDisplayRect();

        if (null != displayRect) {
            final float x = e.getX(), y = e.getY();

            // Check to see if the user tapped on the photo
            if (displayRect.contains(x, y)) {

                float xResult = (x - displayRect.left)
                        / displayRect.width();
                float yResult = (y - displayRect.top)
                        / displayRect.height();

                photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                return true;
            }else{
                photoViewAttacher.getOnPhotoTapListener().onOutsidePhotoTap();
            }
        }
    }
    if (null != photoViewAttacher.getOnViewTapListener()) {
        photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
    }

    return false;
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:35,代码来源:DefaultOnDoubleTapListener.java

示例4: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;

    ImageView imageView = photoViewAttacher.getImageView();

    if (null != photoViewAttacher.getOnPhotoTapListener()) {
        final RectF displayRect = photoViewAttacher.getDisplayRect();

        if (null != displayRect) {
            final float x = e.getX(), y = e.getY();

            // Check to see if the user tapped on the photo
            if (displayRect.contains(x, y)) {

                float xResult = (x - displayRect.left)
                        / displayRect.width();
                float yResult = (y - displayRect.top)
                        / displayRect.height();

                photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                return true;
            }
        }
    }
    if (null != photoViewAttacher.getOnViewTapListener()) {
        photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
    }

    return false;
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:33,代码来源:DefaultOnDoubleTapListener.java

示例5: checkWipeOutETank

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * 判断是否消灭敌方坦克
 * @param point 单签子弹坐标点
 * @return 消灭:true, 反之:false
 */
private boolean checkWipeOutETank(Point point) {
    boolean beHit = false;
    int trackIndex = getTrackIndex(point.y);
    RectF rectF = eTankSparseArray.get(trackIndex).peek();
    if (rectF != null && rectF.contains(point.x, point.y)) { // 击中
        if (++wipeOutNum == levelNum) {
            upLevel();
        }
        eTankSparseArray.get(trackIndex).poll();
        beHit = true;
    }
    return beHit;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:FunGameBattleCityHeader.java

示例6: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public final boolean onSingleTapConfirmed(MotionEvent e) {
	ImageView imageView = getImageView();

	if (null != imageView) {
		if (null != mPhotoTapListener) {
			final RectF displayRect = getDisplayRect();

			if (null != displayRect) {
				final float x = e.getX(), y = e.getY();

				// Check to see if the user tapped on the photo
				if (displayRect.contains(x, y)) {

					float xResult = (x - displayRect.left) / displayRect.width();
					float yResult = (y - displayRect.top) / displayRect.height();

					mPhotoTapListener.onPhotoTap(imageView, xResult, yResult);
					return true;
				}
			}
		}
		if (null != mViewTapListener) {
			mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
		}
	}

	return false;
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:29,代码来源:PhotoViewAttacher.java

示例7: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;

    ImageView imageView = photoViewAttacher.getImageView();

    if (null != photoViewAttacher.getOnPhotoTapListener()) {
        final RectF displayRect = photoViewAttacher.getDisplayRect();

        if (null != displayRect) {
            final float x = e.getX(), y = e.getY();

            // Check to see if the user tapped on the photo
            if (displayRect.contains(x, y)) {

                float xResult = (x - displayRect.left)
                        / displayRect.width();
                float yResult = (y - displayRect.top)
                        / displayRect.height();

                photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                return true;
            } else {
                photoViewAttacher.getOnPhotoTapListener().onOutsidePhotoTap();
            }
        }
    }
    if (null != photoViewAttacher.getOnViewTapListener()) {
        photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
    }

    return false;
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:35,代码来源:DefaultOnDoubleTapListener.java

示例8: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public boolean onSingleTapConfirmed(MotionEvent e) {
    if(this.photoViewAttacher == null) {
        return false;
    } else {
        ImageView imageView = this.photoViewAttacher.getImageView();
        if(null != this.photoViewAttacher.getOnPhotoTapListener()) {
            RectF displayRect = this.photoViewAttacher.getDisplayRect();
            if(null != displayRect) {
                float x = e.getX();
                float y = e.getY();
                if(displayRect.contains(x, y)) {
                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();
                    this.photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                    return true;
                }

                this.photoViewAttacher.getOnPhotoTapListener().onOutsidePhotoTap();
            }
        }

        if(null != this.photoViewAttacher.getOnViewTapListener()) {
            this.photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
        }

        return false;
    }
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:29,代码来源:DefaultOnDoubleTapListener.java

示例9: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public final boolean onSingleTapConfirmed(MotionEvent e) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (null != mPhotoTapListener) {
            final RectF displayRect = getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();

                // Check to see if the user tapped on the photo
                if (displayRect.contains(x, y)) {

                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();

                    mPhotoTapListener.onPhotoTap(imageView, xResult, yResult);
                    return true;
                }
            }
        }
        if (null != mViewTapListener) {
            mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
        }
    }

    return false;
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:29,代码来源:PhotoViewAttacher.java

示例10: onTestSize

import android.graphics.RectF; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public int onTestSize(int suggestedSize, RectF availableSPace) {
    mPaint.setTextSize(suggestedSize);
    String text = getText().toString();
    boolean singleline = getMaxLines() == 1;
    if (singleline) {
        mTextRect.bottom = mPaint.getFontSpacing();
        mTextRect.right = mPaint.measureText(text);
    } else {
        StaticLayout layout = new StaticLayout(text, mPaint,
                mWidthLimit, Alignment.ALIGN_NORMAL, mSpacingMult,
                mSpacingAdd, true);
        // return early if we have more lines
        if (getMaxLines() != NO_LINE_LIMIT
                && layout.getLineCount() > getMaxLines()) {
            return 1;
        }
        mTextRect.bottom = layout.getHeight();
        int maxWidth = -1;
        for (int i = 0; i < layout.getLineCount(); i++) {
            if (maxWidth < layout.getLineWidth(i)) {
                maxWidth = (int) layout.getLineWidth(i);
            }
        }
        mTextRect.right = maxWidth;
    }

    mTextRect.offsetTo(0, 0);
    if (availableSPace.contains(mTextRect)) {
        // may be too small, don't worry we will find the best match
        return -1;
    } else {
        // too big
        return 1;
    }
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:38,代码来源:AutoResizeTextView.java

示例11: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override public boolean onSingleTapConfirmed(MotionEvent e) {

        if (mAttacher == null) {
            return false;
        }
        DraweeView<GenericDraweeHierarchy> draweeView = mAttacher.getDraweeView();
        if (draweeView == null) {
            return false;
        }

        if (mAttacher.getOnPhotoTapListener() != null) {
            final RectF displayRect = mAttacher.getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();
                if (displayRect.contains(x, y)) {
                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();
                    mAttacher.getOnPhotoTapListener().onPhotoTap(draweeView, xResult, yResult);
                    return true;
                }
            }
        }

        if (mAttacher.getOnViewTapListener() != null) {
            mAttacher.getOnViewTapListener().onViewTap(draweeView, e.getX(), e.getY());
            return true;
        }

        return false;
    }
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:32,代码来源:DefaultOnDoubleTapListener.java

示例12: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;
    try {
        ImageView imageView = photoViewAttacher.getImageView();

        if (null != photoViewAttacher.getOnPhotoTapListener()) {
            final RectF displayRect = photoViewAttacher.getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();

                // Check to see if the user tapped on the photo
                if (displayRect.contains(x, y)) {

                    float xResult = (x - displayRect.left)
                            / displayRect.width();
                    float yResult = (y - displayRect.top)
                            / displayRect.height();

                    photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                    return true;
                }
            }
        }
        if (null != photoViewAttacher.getOnViewTapListener()) {
            photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
        }
    }catch ( Exception e1){}
    return false;
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:33,代码来源:DefaultOnDoubleTapListener.java

示例13: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public final boolean onSingleTapConfirmed(MotionEvent e) {
	ImageView imageView = getImageView();

	if (null != imageView) {
		if (null != mPhotoTapListener) {
			final RectF displayRect = getDisplayRect();

			if (null != displayRect) {
				final float x = e.getX(), y = e.getY();

				// Check to see if the user tapped on the photo
				if (displayRect.contains(x, y)) {

					float xResult = (x - displayRect.left)
							/ displayRect.width();
					float yResult = (y - displayRect.top)
							/ displayRect.height();

					mPhotoTapListener.onPhotoTap(imageView, xResult,
							yResult);
					return true;
				}
			}
		}
		if (null != mViewTapListener) {
			mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
		}
	}

	return false;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:32,代码来源:PhotoViewAttacher.java

示例14: getHit

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * 判断被点击的区域
 *
 * @param x
 * @param y
 * @return
 */
public int getHit(float x, float y) {

    if (stickerPaint.getType() == ConstantsPath.STICKER_TYPE_FOREGROUND) {
        return NONE;
    }

    // RectF handleRectF = caclelateRect();
    final RectF rect = new RectF(caclelateRect());
    rect.inset(-mPadding, -mPadding);

    int retval = NONE;
    final boolean verticalCheck = (y >= (rect.top - HIT_TOLERANCE))
            && (y < (rect.bottom + ((textSrcRect != null || stickerPaint.getType() == ConstantsPath.COMMONTEXTSTICKER)
            ? 2 * mAnchorTextHeight : 0) + HIT_TOLERANCE));
    final boolean horizCheck = (x >= (rect.left - HIT_TOLERANCE)) && (x < (rect.right + HIT_TOLERANCE));
    // if horizontal and vertical checks are good then
    // at least the move edge is selected
    if (verticalCheck && horizCheck) {
        retval = MOVE;
    }

    if (mScaleEnabled &&
            (Math.abs(rect.right - x) < HIT_TOLERANCE) && (Math.abs(rect.top - y) < HIT_TOLERANCE) &&
            verticalCheck && horizCheck
            ) {
        retval = GROW;
    }

    if (mRotateEnabled && (Math.abs(rect.right - x) < HIT_TOLERANCE)
            && (Math.abs(rect.bottom - y) < HIT_TOLERANCE) && verticalCheck && horizCheck) {
        retval = ROTATE;
    }

    if (mMoveEnabled && (retval == NONE) && rect.contains((int) x, (int) y)) {
        retval = MOVE;
    }

    Log.e(LOG_TAG, "retValue: " + retval);

    return retval;
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:49,代码来源:MyHighlightView.java


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