Java Code Examples for android.graphics.RectF
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project cw-omnibus, under directory /external/NineOldAndroids/src/com/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null || view.getParent() == null) { return; } final RectF after=mAfter; computeRect(after,view); after.union(mBefore); ((View)view.getParent()).invalidate((int)Math.floor(after.left),(int)Math.floor(after.top),(int)Math.ceil(after.right),(int)Math.ceil(after.bottom)); }
Example 2
From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 3
From project creamed_glacier_app_settings, under directory /src/net/margaritov/preference/colorpicker/.
Source file: ColorPickerPanelView.java

@Override protected void onDraw(Canvas canvas){ final RectF rect=mColorRect; if (BORDER_WIDTH_PX > 0) { mBorderPaint.setColor(mBorderColor); canvas.drawRect(mDrawingRect,mBorderPaint); } if (mAlphaPattern != null) { mAlphaPattern.draw(canvas); } mColorPaint.setColor(mColor); canvas.drawRect(rect,mColorPaint); }
Example 4
From project danbooru-gallery-android, under directory /src/it/sephiroth/android/library/imagezoom/.
Source file: ImageViewTouchBase.java

public RectF getBitmapRect(){ if (mBitmapDisplayed == null) return null; Matrix m=getImageViewMatrix(); RectF rect=new RectF(0,0,mBitmapDisplayed.getWidth(),mBitmapDisplayed.getHeight()); m.mapRect(rect); return rect; }
Example 5
From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 6
From project android-bankdroid, under directory /src/net/margaritov/preference/colorpicker/.
Source file: ColorPickerPanelView.java

@Override protected void onDraw(Canvas canvas){ final RectF rect=mColorRect; if (BORDER_WIDTH_PX > 0) { mBorderPaint.setColor(mBorderColor); canvas.drawRect(mDrawingRect,mBorderPaint); } if (mAlphaPattern != null) { mAlphaPattern.draw(canvas); } mColorPaint.setColor(mColor); canvas.drawRect(rect,mColorPaint); }
Example 7
From project android-xbmcremote, under directory /src/org/xbmc/android/widget/.
Source file: FastScrollView.java

@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){ super.onSizeChanged(w,h,oldw,oldh); if (mCurrentThumb != null) { mCurrentThumb.setBounds(w - mThumbW,0,w,mThumbH); } final RectF pos=mOverlayPos; pos.left=(w - mOverlaySize) / 2; pos.right=pos.left + mOverlaySize; pos.top=h / 10; pos.bottom=pos.top + mOverlaySize; mOverlayDrawable.setBounds((int)pos.left,(int)pos.top,(int)pos.right,(int)pos.bottom); }
Example 8
From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 9
From project android_packages_apps_Gallery, under directory /src/com/android/camera/.
Source file: ActionMenuButton.java

@Override public void draw(Canvas canvas){ final Layout layout=getLayout(); final RectF rect=mRect; final int left=getCompoundPaddingLeft(); final int top=getExtendedPaddingTop(); rect.set(left + layout.getLineLeft(0) - PADDING_H,top + layout.getLineTop(0) - PADDING_V,Math.min(left + layout.getLineRight(0) + PADDING_H,mScrollX + mRight - mLeft),top + layout.getLineBottom(0) + PADDING_V); canvas.drawRoundRect(rect,CORNER_RADIUS,CORNER_RADIUS,mPaint); super.draw(canvas); }
Example 10
From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/photoeditor/actions/.
Source file: CropView.java

private RectF getCropBoundsDisplayed(){ float width=displayBounds.width(); float height=displayBounds.height(); RectF cropped=new RectF(cropBounds.left * width,cropBounds.top * height,cropBounds.right * width,cropBounds.bottom * height); cropped.offset(displayBounds.left,displayBounds.top); return cropped; }
Example 11
From project apps-for-android, under directory /RingsExtended/src/com/example/android/rings_extended/.
Source file: FastScrollView.java

@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){ super.onSizeChanged(w,h,oldw,oldh); if (mCurrentThumb != null) { mCurrentThumb.setBounds(w - mThumbW,0,w,mThumbH); } final RectF pos=mOverlayPos; pos.left=(w - mOverlaySize) / 2; pos.right=pos.left + mOverlaySize; pos.top=h / 10; pos.bottom=pos.top + mOverlaySize; mOverlayDrawable.setBounds((int)pos.left,(int)pos.top,(int)pos.right,(int)pos.bottom); }
Example 12
From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/beintoosdkutility/.
Source file: BDrawableGradient.java

public Canvas beintooRoundedButtonGradient(int h,Canvas canvas){ Paint p=new Paint(Paint.ANTI_ALIAS_FLAG); int[] colors={0xff8292A8,0xff576B87,0xff4C627F,0xff3C5271}; float[] positions={0.0f,0.5f,0.5f,1.0f}; p.setShader(new LinearGradient(0,0,0,h,colors,positions,Shader.TileMode.MIRROR)); final Rect rect=new Rect(0,0,canvas.getClipBounds().width(),canvas.getClipBounds().height()); final RectF rectF=new RectF(rect); canvas.drawRoundRect(rectF,8,8,p); return canvas; }
Example 13
From project BibleQuote-for-Android, under directory /src/com/BibleQuote/controls/ColorPicker/.
Source file: ColorPickerPanelView.java

@Override protected void onDraw(Canvas canvas){ final RectF rect=mColorRect; if (BORDER_WIDTH_PX > 0) { mBorderPaint.setColor(mBorderColor); canvas.drawRect(mDrawingRect,mBorderPaint); } if (mAlphaPattern != null) { mAlphaPattern.draw(canvas); } mColorPaint.setColor(mColor); canvas.drawRect(rect,mColorPaint); }
Example 14
From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.
Source file: FastScroller.java

void onSizeChanged(int w,int h,int oldw,int oldh){ if (mThumbDrawable != null) { mThumbDrawable.setBounds(w - mThumbW,0,w,mThumbH); } final RectF pos=mOverlayPos; pos.left=(w / 8); pos.right=pos.left + w * 3 / 4; pos.top=h / 10; pos.bottom=pos.top + mOverlaySize; if (mOverlayDrawable != null) { mOverlayDrawable.setBounds((int)pos.left,(int)pos.top,(int)pos.right,(int)pos.bottom); } }
Example 15
From project BookingRoom, under directory /src/org/androidaalto/bookingroom/view/.
Source file: WeekView.java

/** * @param viewCanvas */ private void drawFixedAreas(Canvas canvas){ Paint p=mPaint; Rect r=mRect; if (mNumDays > 1) { drawDayHeaderLoop(r,canvas,p); } RectF rf=mRectF; drawNavigationButtons(rf,canvas,p); }
Example 16
From project CHMI, under directory /src/it/sephiroth/android/library/imagezoom/.
Source file: ImageViewTouchBase.java

protected RectF getBitmapRect(){ if (mBitmapDisplayed.getBitmap() == null) return null; Matrix m=getImageViewMatrix(); RectF rect=new RectF(0,0,mBitmapDisplayed.getBitmap().getWidth(),mBitmapDisplayed.getBitmap().getHeight()); m.mapRect(rect); return rect; }
Example 17
From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } view.setAnimation(this); final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 18
From project abalone-android, under directory /src/com/bytopia/abalone/.
Source file: BoardRenderer.java

/** * Updates sizes according to the given board diameter. * @param boardDiameter distance between two opposite corners of the board */ public void rescale(int boardDiameter,int size){ Log.d("rescale","Rescaling the board"); boardRect=new RectF(boardDiameter / 4f - 1,1,3f * boardDiameter / 4f + 1,boardDiameter / 2); balls=new ArrayList<RenderBall>(); ballSize=((float)size - 2 * borderSize) / 9f; view.postInvalidate(); }
Example 19
From project AChartEngine, under directory /achartengine/src/org/achartengine/chart/.
Source file: XYChart.java

public SeriesSelection getSeriesAndPointForScreenCoordinate(final Point screenPoint){ if (clickableAreas != null) for (int seriesIndex=clickableAreas.size() - 1; seriesIndex >= 0; seriesIndex--) { int pointIndex=0; if (clickableAreas.get(seriesIndex) != null) { RectF rectangle; for ( ClickableArea area : clickableAreas.get(seriesIndex)) { 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); }
Example 20
From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } view.setAnimation(this); final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 21
From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } view.setAnimation(this); final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 22
From project android-cropimage, under directory /src/com/android/camera/.
Source file: CropImage.java

private void handleFace(FaceDetector.Face f){ PointF midPoint=new PointF(); int r=((int)(f.eyesDistance() * mScale)) * 2; f.getMidPoint(midPoint); midPoint.x*=mScale; midPoint.y*=mScale; int midX=(int)midPoint.x; int midY=(int)midPoint.y; HighlightView hv=new HighlightView(mImageView); int width=mBitmap.getWidth(); int height=mBitmap.getHeight(); Rect imageRect=new Rect(0,0,width,height); RectF faceRect=new RectF(midX,midY,midX,midY); faceRect.inset(-r,-r); if (faceRect.left < 0) { faceRect.inset(-faceRect.left,-faceRect.left); } if (faceRect.top < 0) { faceRect.inset(-faceRect.top,-faceRect.top); } if (faceRect.right > imageRect.right) { faceRect.inset(faceRect.right - imageRect.right,faceRect.right - imageRect.right); } if (faceRect.bottom > imageRect.bottom) { faceRect.inset(faceRect.bottom - imageRect.bottom,faceRect.bottom - imageRect.bottom); } hv.setup(mImageMatrix,imageRect,faceRect,mCircleCrop,mAspectX != 0 && mAspectY != 0); mImageView.add(hv); }
Example 23
From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/util/.
Source file: ImageUtilities.java

private static Bitmap createBitmap(Bitmap source,int x,int y,int width,int height,Matrix m,float offset,boolean clipShadow,Paint paint){ int scaledWidth=width; int scaledHeight=height; final Canvas canvas=new Canvas(); canvas.translate(offset / 2.0f,offset / 2.0f); Bitmap bitmap; final Rect from=new Rect(x,y,x + width,y + height); final RectF to=new RectF(0,0,width,height); if (m == null || m.isIdentity()) { bitmap=Bitmap.createBitmap(scaledWidth + (int)offset,scaledHeight + (int)(clipShadow ? (offset / 2.0f) : offset),Bitmap.Config.ARGB_8888); paint=null; } else { RectF mapped=new RectF(); m.mapRect(mapped,to); scaledWidth=Math.round(mapped.width()); scaledHeight=Math.round(mapped.height()); bitmap=Bitmap.createBitmap(scaledWidth + (int)offset,scaledHeight + (int)(clipShadow ? (offset / 2.0f) : offset),Bitmap.Config.ARGB_8888); canvas.translate(-mapped.left,-mapped.top); canvas.concat(m); } canvas.setBitmap(bitmap); canvas.drawRect(0.0f,0.0f,width,height,paint); canvas.drawBitmap(source,from,to,SCALE_PAINT); return bitmap; }
Example 24
From project androidquery, under directory /src/com/androidquery/callback/.
Source file: BitmapAjaxCallback.java

private static Bitmap getRoundedCornerBitmap(Bitmap bitmap,int pixels){ Bitmap output=Bitmap.createBitmap(bitmap.getWidth(),bitmap.getHeight(),Config.ARGB_8888); Canvas canvas=new Canvas(output); final int color=0xff424242; final Paint paint=new Paint(); final Rect rect=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight()); final RectF rectF=new RectF(rect); final float roundPx=pixels; paint.setAntiAlias(true); canvas.drawARGB(0,0,0,0); paint.setColor(color); canvas.drawRoundRect(rectF,roundPx,roundPx,paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap,rect,rect,paint); return output; }
Example 25
From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.
Source file: CropImage.java

private void handleFace(FaceDetector.Face f){ PointF midPoint=new PointF(); int r=((int)(f.eyesDistance() * mScale)) * 2; f.getMidPoint(midPoint); midPoint.x*=mScale; midPoint.y*=mScale; int midX=(int)midPoint.x; int midY=(int)midPoint.y; HighlightView hv=new HighlightView(mImageView); int width=mBitmap.getWidth(); int height=mBitmap.getHeight(); Rect imageRect=new Rect(0,0,width,height); RectF faceRect=new RectF(midX,midY,midX,midY); faceRect.inset(-r,-r); if (faceRect.left < 0) { faceRect.inset(-faceRect.left,-faceRect.left); } if (faceRect.top < 0) { faceRect.inset(-faceRect.top,-faceRect.top); } if (faceRect.right > imageRect.right) { faceRect.inset(faceRect.right - imageRect.right,faceRect.right - imageRect.right); } if (faceRect.bottom > imageRect.bottom) { faceRect.inset(faceRect.bottom - imageRect.bottom,faceRect.bottom - imageRect.bottom); } hv.setup(mImageMatrix,imageRect,faceRect,mCircleCrop,mAspectX != 0 && mAspectY != 0); mImageView.add(hv); }
Example 26
From project android_wallpaper_flier, under directory /src/fi/harism/wallpaper/flier/.
Source file: FlierClouds.java

/** * Generates/initializes cloud with random values. * @param cloud Cloud to modify. */ private void genRandCloud(StructCloud cloud){ RectF rect=cloud.mViewRect; cloud.mZValue=rand(-ZFAR,-ZNEAR); float t=(-cloud.mZValue - ZNEAR) / (ZFAR - ZNEAR); rect.left=mRectNear.left + t * (mRectFar.left - mRectNear.left); rect.right=mRectNear.right + t * (mRectFar.right - mRectNear.right); rect.top=mRectNear.top + t * (mRectFar.top - mRectNear.top); rect.bottom=rect.top * 0.4f; cloud.mWidth=rect.width() * 0.2f; cloud.mHeight=rect.height() * 0.2f; cloud.mSpeed=rand(.3f,.6f); float y=rand(rect.bottom,rect.top - cloud.mHeight); float maxPointSz=MAX_POINTSIZE_NEAR + t * (MAX_POINTSIZE_FAR - MAX_POINTSIZE_NEAR); for ( StructCloudPoint point : cloud.mPoints) { float pointSz=rand(maxPointSz / 2,maxPointSz); point.mSize=pointSz; point.mPosition[0]=rand(pointSz,cloud.mWidth - pointSz); point.mPosition[1]=rand(pointSz,cloud.mHeight - pointSz) + y; } }
Example 27
From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/ui/.
Source file: VendorDetailFragment.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ mRootView=(ViewGroup)inflater.inflate(R.layout.fragment_vendor_detail,null); mName=(TextView)mRootView.findViewById(R.id.vendor_name); mStarred=(CompoundButton)mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); final View starParent=mRootView.findViewById(R.id.header_vendor); FractionalTouchDelegate.setupDelegate(starParent,mStarred,new RectF(0.6f,0f,1f,0.8f)); mLogo=(ImageView)mRootView.findViewById(R.id.vendor_logo); mUrl=(TextView)mRootView.findViewById(R.id.vendor_url); mDesc=(TextView)mRootView.findViewById(R.id.vendor_desc); mProductDesc=(TextView)mRootView.findViewById(R.id.vendor_product_desc); return mRootView; }
Example 28
From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/view/.
Source file: CustomGallery.java

private void updateTabIndicator(){ int width=getMeasuredWidth(); int middle=width / 2; bar=new RectF(0,0,width,TAB_INDICATOR_HEIGHT); bitmap=Bitmap.createBitmap(width,(int)TAB_INDICATOR_HEIGHT,Bitmap.Config.ARGB_8888); canvas=new Canvas(bitmap); Drawable gradient=getResources().getDrawable(R.drawable.lightgradiant); gradient.setBounds(0,0,width,(int)TAB_INDICATOR_HEIGHT); gradient.draw(canvas); int count=getChildCount(); int start=middle - count / 2 * (int)TAB_INDICATOR_HEIGHT; int bulletSize=(int)TAB_INDICATOR_HEIGHT / 3; int bulletPadding=((int)TAB_INDICATOR_HEIGHT - bulletSize) / 2; for (int i=0; i < count; i++) { RectF selectedTab=new RectF(start + bulletPadding,bulletPadding,start + TAB_INDICATOR_HEIGHT - bulletPadding,TAB_INDICATOR_HEIGHT - bulletPadding); if (i == getCurrentScreen()) { canvas.drawRoundRect(selectedTab,bulletSize / 2,bulletSize / 2,selectedTabPaint); } else { canvas.drawRoundRect(selectedTab,bulletSize / 2,bulletSize / 2,tabPaint); } start+=TAB_INDICATOR_HEIGHT; } }
Example 29
From project CityBikes, under directory /src/net/homelinux/penecoptero/android/citybikes/app/.
Source file: StationOverlay.java

@Override public void draw(Canvas canvas,MapView mapView,boolean shadow){ calculatePixelRadius(mapView); Projection astral=mapView.getProjection(); Point screenPixels=astral.toPixels(this.getCenter(),null); RectF oval=new RectF(screenPixels.x - this.radiusInPixels,screenPixels.y - this.radiusInPixels,screenPixels.x + this.radiusInPixels,screenPixels.y + this.radiusInPixels); if (this.station.isBookmarked()) { canvas.drawPath(createStar(5,screenPixels,(float)(this.radiusInPixels * 1.5),(float)(this.radiusInPixels * 1.5 / 2)),this.currentPaint); if (this.selected) canvas.drawPath(createStar(5,screenPixels,(float)(this.radiusInPixels * 1.5),(float)(this.radiusInPixels * 1.5 / 2)),this.selectedPaint); } else { canvas.drawOval(oval,this.currentPaint); if (this.selected) { canvas.drawCircle(screenPixels.x,screenPixels.y,this.radiusInPixels,this.selectedPaint); } } }
Example 30
From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } view.setAnimation(this); final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 31
From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/ui/.
Source file: VendorDetailFragment.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ mRootView=(ViewGroup)inflater.inflate(R.layout.fragment_vendor_detail,null); mName=(TextView)mRootView.findViewById(R.id.vendor_name); mStarred=(CompoundButton)mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); final View starParent=mRootView.findViewById(R.id.header_vendor); FractionalTouchDelegate.setupDelegate(starParent,mStarred,new RectF(0.6f,0f,1f,0.8f)); mLogo=(ImageView)mRootView.findViewById(R.id.vendor_logo); mUrl=(TextView)mRootView.findViewById(R.id.vendor_url); mDesc=(TextView)mRootView.findViewById(R.id.vendor_desc); mProductDesc=(TextView)mRootView.findViewById(R.id.vendor_product_desc); return mRootView; }
Example 32
From project connectbot, under directory /src/sk/vx/connectbot/util/.
Source file: UberColorPickerDialog.java

/** * Place a small circle on the 2D palette to indicate the current values. * @param canvas * @param markerPosX * @param markerPosY */ private void mark2DPalette(Canvas canvas,int markerPosX,int markerPosY){ mPosMarker.setColor(Color.BLACK); canvas.drawOval(new RectF(markerPosX - 5,markerPosY - 5,markerPosX + 5,markerPosY + 5),mPosMarker); mPosMarker.setColor(Color.WHITE); canvas.drawOval(new RectF(markerPosX - 3,markerPosY - 3,markerPosX + 3,markerPosY + 3),mPosMarker); }
Example 33
From project cornerstone, under directory /frameworks/base/policy/src/com/android/internal/policy/impl/.
Source file: PhoneWindowManager.java

public boolean allowAppAnimationsLw(){ if (mKeyguard != null && mKeyguard.isVisibleLw()) { return false; } if (false) { if (mStatusBar != null && mStatusBar.isVisibleLw()) { RectF rect=new RectF(mStatusBar.getShownFrameLw()); for (int i=mStatusBarPanels.size() - 1; i >= 0; i--) { WindowState w=mStatusBarPanels.get(i); if (w.isVisibleLw()) { rect.union(w.getShownFrameLw()); } } final int insetw=mRestrictedScreenWidth / 10; final int inseth=mRestrictedScreenHeight / 10; if (rect.contains(insetw,inseth,mRestrictedScreenWidth - insetw,mRestrictedScreenHeight - inseth)) { return false; } } } return true; }
Example 34
From project cropimage, under directory /src/com/droid4you/util/cropimage/.
Source file: CropImage.java

private void handleFace(FaceDetector.Face f){ PointF midPoint=new PointF(); int r=((int)(f.eyesDistance() * mScale)) * 2; f.getMidPoint(midPoint); midPoint.x*=mScale; midPoint.y*=mScale; int midX=(int)midPoint.x; int midY=(int)midPoint.y; HighlightView hv=new HighlightView(mImageView); int width=mBitmap.getWidth(); int height=mBitmap.getHeight(); Rect imageRect=new Rect(0,0,width,height); RectF faceRect=new RectF(midX,midY,midX,midY); faceRect.inset(-r,-r); if (faceRect.left < 0) { faceRect.inset(-faceRect.left,-faceRect.left); } if (faceRect.top < 0) { faceRect.inset(-faceRect.top,-faceRect.top); } if (faceRect.right > imageRect.right) { faceRect.inset(faceRect.right - imageRect.right,faceRect.right - imageRect.right); } if (faceRect.bottom > imageRect.bottom) { faceRect.inset(faceRect.bottom - imageRect.bottom,faceRect.bottom - imageRect.bottom); } hv.setup(mImageMatrix,imageRect,faceRect,mCircleCrop,mAspectX != 0 && mAspectY != 0); mImageView.add(hv); }
Example 35
From project danbo, under directory /src/us/donmai/danbooru/danbo/cropimage/.
Source file: CropImage.java

private void handleFace(FaceDetector.Face f){ PointF midPoint=new PointF(); int r=((int)(f.eyesDistance() * mScale)) * 2; f.getMidPoint(midPoint); midPoint.x*=mScale; midPoint.y*=mScale; int midX=(int)midPoint.x; int midY=(int)midPoint.y; HighlightView hv=new HighlightView(mImageView); int width=mBitmap.getWidth(); int height=mBitmap.getHeight(); Rect imageRect=new Rect(0,0,width,height); RectF faceRect=new RectF(midX,midY,midX,midY); faceRect.inset(-r,-r); if (faceRect.left < 0) { faceRect.inset(-faceRect.left,-faceRect.left); } if (faceRect.top < 0) { faceRect.inset(-faceRect.top,-faceRect.top); } if (faceRect.right > imageRect.right) { faceRect.inset(faceRect.right - imageRect.right,faceRect.right - imageRect.right); } if (faceRect.bottom > imageRect.bottom) { faceRect.inset(faceRect.bottom - imageRect.bottom,faceRect.bottom - imageRect.bottom); } hv.setup(mImageMatrix,imageRect,faceRect,mCircleCrop,mAspectX != 0 && mAspectY != 0); mImageView.add(hv); }
Example 36
From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/.
Source file: SessionDetailFragment.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ mRootView=(ViewGroup)inflater.inflate(R.layout.fragment_session_detail,null); mTitle=(TextView)mRootView.findViewById(R.id.session_title); mSubtitle=(TextView)mRootView.findViewById(R.id.session_subtitle); mStarred=(CompoundButton)mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); final View starParent=mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent,mStarred,new RectF(0.6f,0f,1f,0.8f)); mAbstract=(TextView)mRootView.findViewById(R.id.session_abstract); setupSummaryTab(); return mRootView; }
Example 37
From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/.
Source file: AnimatorProxy.java

private void invalidateAfterUpdate(){ View view=mView.get(); if (view == null) { return; } View parent=(View)view.getParent(); if (parent == null) { return; } view.setAnimation(this); final RectF after=mAfter; computeRect(after,view); after.union(mBefore); parent.invalidate((int)FloatMath.floor(after.left),(int)FloatMath.floor(after.top),(int)FloatMath.ceil(after.right),(int)FloatMath.ceil(after.bottom)); }
Example 38
From project Android, under directory /app/src/main/java/com/github/mobile/util/.
Source file: ImageUtils.java

/** * Round the corners of a {@link Bitmap} * @param source * @param radius * @return rounded corner bitmap */ public static Bitmap roundCorners(final Bitmap source,final float radius){ int width=source.getWidth(); int height=source.getHeight(); Paint paint=new Paint(); paint.setAntiAlias(true); paint.setColor(WHITE); Bitmap clipped=Bitmap.createBitmap(width,height,ARGB_8888); Canvas canvas=new Canvas(clipped); canvas.drawRoundRect(new RectF(0,0,width,height),radius,radius,paint); paint.setXfermode(new PorterDuffXfermode(DST_IN)); Bitmap rounded=Bitmap.createBitmap(width,height,ARGB_8888); canvas=new Canvas(rounded); canvas.drawBitmap(source,0,0,null); canvas.drawBitmap(clipped,0,0,paint); source.recycle(); clipped.recycle(); return rounded; }
Example 39
From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.
Source file: TiledMapView.java

public void init(Context context){ tileSize=context.getResources().getDimensionPixelSize(R.dimen.tiledMap_tile); gridPaint=new Paint(Paint.ANTI_ALIAS_FLAG); gridPaint.setColor(Color.WHITE); gridPaint.setStrokeWidth(1.5f); gridPaint.setAlpha(128); debugPaint=new Paint(gridPaint); debugPaint.setColor(Color.CYAN); debugPaint.setAlpha(255); SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); mustDrawGrid=prefs.getBoolean(C.PREFS_MAP_SHOW_GRID,C.DEFAULT_MAP_SHOW_GRID); mustExportGrid=prefs.getBoolean(C.PREFS_EXPORT_SHOW_GRID,C.DEFAULT_EXPORT_SHOW_GRID); emptyTileColor=prefs.getInt(C.PREFS_MAP_COLOR_EMPTY_TILE,C.DEFAULT_MAP_COLOR_EMPTY_TILE); prefs.registerOnSharedPreferenceChangeListener(this); emptyTilePaint=new Paint(Paint.ANTI_ALIAS_FLAG); emptyTilePaint.setColor(emptyTileColor); emptyTilePaint.setStyle(Paint.Style.FILL_AND_STROKE); mapRect=new RectF(0,0,0,0); currentTouchPoint=new PointInfo(); fingerDownPoint=new PointInfo(); }
Example 40
From project Binaural-Beats, under directory /src/com/jjoe64/graphview/.
Source file: GraphView.java

protected void drawLegend(Canvas canvas,float height,float width){ int shapeSize=15; paint.setARGB(180,100,100,100); float legendHeight=(shapeSize + 5) * graphSeries.size() + 5; float lLeft=width - legendWidth - 10; float lTop; switch (legendAlign) { case TOP: lTop=10; break; case MIDDLE: lTop=height / 2 - legendHeight / 2; break; default : lTop=height - GraphViewConfig.BORDER - legendHeight- 10; } float lRight=lLeft + legendWidth; float lBottom=lTop + legendHeight; canvas.drawRoundRect(new RectF(lLeft,lTop,lRight,lBottom),8,8,paint); for (int i=0; i < graphSeries.size(); i++) { paint.setColor(graphSeries.get(i).style.color); canvas.drawRect(new RectF(lLeft + 5,lTop + 5 + (i * (shapeSize + 5)),lLeft + 5 + shapeSize,lTop + ((i + 1) * (shapeSize + 5))),paint); if (graphSeries.get(i).description != null) { paint.setColor(Color.WHITE); paint.setTextAlign(Align.LEFT); canvas.drawText(graphSeries.get(i).description,lLeft + 5 + shapeSize+ 5,lTop + shapeSize + (i * (shapeSize + 5)),paint); } } }
Example 41
From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/util/.
Source file: CircularProgressView.java

private void updatePath(final int w,final int h){ final float maxAbsSize=Math.min(w,h) / 2f; final float absSize=size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1; path.reset(); if (progress == 0) { path.close(); } else if (progress < maxProgress) { final float angle=progress * 360 / maxProgress; final float x=w / 2f; final float y=h / 2f; path.moveTo(x,y); path.arcTo(new RectF(x - absSize,y - absSize,x + absSize,y + absSize),270,angle); path.close(); } else { path.addCircle(w / 2f,h / 2f,absSize,Direction.CW); } }
Example 42
From project dccsched, under directory /src/com/underhilllabs/dccsched/ui/.
Source file: SessionDetailActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_session_detail); mTitle=(TextView)findViewById(R.id.session_title); mSubtitle=(TextView)findViewById(R.id.session_subtitle); mStarred=(CompoundButton)findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); final View starParent=findViewById(R.id.list_item_session); FractionalTouchDelegate.setupDelegate(starParent,mStarred,new RectF(0.6f,0f,1f,0.8f)); mAbstract=(TextView)findViewById(R.id.session_abstract); mRequirements=(TextView)findViewById(R.id.session_requirements); final Intent intent=getIntent(); mSessionUri=intent.getData(); mSessionId=Sessions.getSessionId(mSessionUri); setupSummaryTab(); setupNotesTab(); final Uri trackUri=resolveTrackUri(intent); final Uri speakersUri=Sessions.buildSpeakersDirUri(mSessionId); mHandler=new NotifyingAsyncQueryHandler(getContentResolver(),this); mHandler.startQuery(SessionsQuery._TOKEN,mSessionUri,SessionsQuery.PROJECTION); mHandler.startQuery(TracksQuery._TOKEN,trackUri,TracksQuery.PROJECTION); mHandler.startQuery(SpeakersQuery._TOKEN,speakersUri,SpeakersQuery.PROJECTION); }
Example 43
From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/.
Source file: SessionDetailFragment.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ mRootView=(ViewGroup)inflater.inflate(R.layout.fragment_session_detail,null); mTabHost=(TabHost)mRootView.findViewById(android.R.id.tabhost); mTabHost.setup(); mTitle=(TextView)mRootView.findViewById(R.id.session_title); mSubtitle=(TextView)mRootView.findViewById(R.id.session_subtitle); mSponsored=(TextView)mRootView.findViewById(R.id.session_sponsored); mStarred=(CompoundButton)mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); final View starParent=mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent,mStarred,new RectF(0.6f,0f,1f,0.8f)); mSummary=(TextView)mRootView.findViewById(R.id.session_abstract); setupSummaryTab(); return mRootView; }