android Programming Glossary: dy
Android Image View Pinch Zooming http://stackoverflow.com/questions/10630373/android-image-view-pinch-zooming final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY.. x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity color picker in my paint program. So anyone here has already done something like this please give me some tutorials or piece.. I really need to get the whole idea of adding this. I already have set up the canvas for the drawing so I'd like to add the.. touch_move float x float y float dx Math.abs x mX float dy Math.abs y mY if dx TOUCH_TOLERANCE dy TOUCH_TOLERANCE mPath.quadTo..
Is Opengl Development GPU Dependant? http://stackoverflow.com/questions/17229066/is-opengl-development-gpu-dependant isLUp false if count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx.. if count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx firstY dy else if count 2 ux.. count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx firstY dy else if count 2 ux ev.getX..
Overlay images onto Camera preview SurfaceView http://stackoverflow.com/questions/3548666/overlay-images-onto-camera-preview-surfaceview this question Well here's how I did it ... I hope somebody finds it useful though the Qualcomm AR stuff is out.. it might.. case MotionEvent.ACTION_MOVE float dx x mPreviousX float dy y mPreviousY cr.mAngleX dx TOUCH_SCALE_FACTOR cr.mAngleY dy.. y mPreviousY cr.mAngleX dx TOUCH_SCALE_FACTOR cr.mAngleY dy TOUCH_SCALE_FACTOR requestRender mPreviousX x mPreviousY..
How to make Drag & Drop Button in Android http://stackoverflow.com/questions/5037799/how-to-make-drag-drop-button-in-android scales the button doesn't change its position. package com.dynamic import android.app.Activity import android.os.Bundle import.. import android.widget.TextView import com.dynamic.R import com.dynamic.R.layout public class dy extends Activity.. android.widget.TextView import com.dynamic.R import com.dynamic.R.layout public class dy extends Activity int status private..
Android: HorizontalScrollView smoothScroll animation time http://stackoverflow.com/questions/5193678/android-horizontalscrollview-smoothscroll-animation-time public void customSmoothScrollBy int dx int dy if myScroller null smoothScrollBy dx dy return if getChildCount.. int dx int dy if myScroller null smoothScrollBy dx dy return if getChildCount 0 return final int width getWidth getPaddingRight..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x.. mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP..
Pinch Zoom in android for an imageview? http://stackoverflow.com/questions/6758847/pinch-zoom-in-android-for-an-imageview final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x.. mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP..
Slowing speed of Viewpager controller in android http://stackoverflow.com/questions/8155257/slowing-speed-of-viewpager-controller-in-android public void startScroll int startX int startY int dx int dy int duration Ignore received duration use fixed one instead.. use fixed one instead super.startScroll startX startY dx dy mDuration @Override public void startScroll int startX int startY.. public void startScroll int startX int startY int dx int dy Ignore received duration use fixed one instead super.startScroll..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger next points.get i 1 point.dx next.x point.x 3 point.dy next.y point.y 3 else if i points.size 1 Point prev points.get.. prev points.get i 1 point.dx point.x prev.x 3 point.dy point.y prev.y 3 else Point next points.get i 1 Point prev.. Point prev points.get i 1 point.dx next.x prev.x 3 point.dy next.y prev.y 3 boolean first true for int i 0 i points.size..
Android Fragment Pager and Custom Page Indicator( ViewPagerIndicator created by Jake Wharton) http://stackoverflow.com/questions/14433281/android-fragment-pager-and-custom-page-indicator-viewpagerindicator-created-by 2.0f condition threeRadius 2.0f float dX float dY float pageFillRadius mRadius if mPaintStroke.getStrokeWidth.. iLoop threeRadius if mOrientation HORIZONTAL dX drawLong dY shortOffset else dX shortOffset dY drawLong Only paint fill.. HORIZONTAL dX drawLong dY shortOffset else dX shortOffset dY drawLong Only paint fill if not completely transparent if mPaintPageFill.getAlpha..
Is Opengl Development GPU Dependant? http://stackoverflow.com/questions/17229066/is-opengl-development-gpu-dependant ux ux getWidth 2 1 uy 1 uy getHeight 2 secondX ux secondY uy myRenderer.dx firstX myRenderer.dy firstY myRenderer.ux.. firstY myRenderer.ux secondX myRenderer.uy secondY midX firstX secondX 2 midY firstY secondY 2 Log.e JO Line.. secondX myRenderer.uy secondY midX firstX secondX 2 midY firstY secondY 2 Log.e JO Line firstX firstX firstY firstY..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas X int Y int initialY int ballW int ballH int angle float dY float acc Bitmap ball bgr public BallBounce Context context.. ball.getWidth ballH ball.getHeight acc 0.2f acceleration dY 0 vertical speed initialY 100 Initial vertical position. angle.. 0 0 null Compute roughly ball speed and location. Y int dY Increase or decrease vertical position. if Y screenH ballH ..
Where does Android View.scrollTo(x, y) scroll to? http://stackoverflow.com/questions/7773206/where-does-android-view-scrolltox-y-scroll-to the top left corner of the image will be located at dX 2 dY 2 and the bottom right corner at mW dX 2 mH dY 2 . dX represents.. at dX 2 dY 2 and the bottom right corner at mW dX 2 mH dY 2 . dX represents the difference between the widths of the image.. between the widths of the image and the View . And dY represents the difference between the heights of the image and..
Android Image View Pinch Zooming http://stackoverflow.com/questions/10630373/android-image-view-pinch-zooming isn't processing a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId.. a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId INVALID_POINTER_ID break case..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity to be included in the activity I would like to include a color picker in my paint program. So anyone here has already done something like this please give me some tutorials or piece of code to get me started. I really need to get the whole.. give me some tutorials or piece of code to get me started. I really need to get the whole idea of adding this. I already have set up the canvas for the drawing so I'd like to add the color picker to it. Any ideas are welcome. Thanks. java android.. x float y mPath.reset mPath.moveTo x y mX x mY y private void touch_move float x float y float dx Math.abs x mX float dy Math.abs y mY if dx TOUCH_TOLERANCE dy TOUCH_TOLERANCE mPath.quadTo mX mY x mX 2 y mY 2 mX x mY y circlePath.reset circlePath.addCircle..
Is Opengl Development GPU Dependant? http://stackoverflow.com/questions/17229066/is-opengl-development-gpu-dependant ev if myline switch ev.getAction case MotionEvent.ACTION_DOWN isLUp false if count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx firstY dy else if count 2 ux ev.getX uy ev.getY ux ux getWidth.. ev.getAction case MotionEvent.ACTION_DOWN isLUp false if count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx firstY dy else if count 2 ux ev.getX uy ev.getY ux ux getWidth 2 1 uy 1 uy getHeight 2.. ev.getAction case MotionEvent.ACTION_DOWN isLUp false if count 1 dx ev.getX dy ev.getY dx dx getWidth 2 1 dy 1 dy getHeight 2 firstX dx firstY dy else if count 2 ux ev.getX uy ev.getY ux ux getWidth 2 1 uy 1 uy getHeight 2 secondX..
Overlay images onto Camera preview SurfaceView http://stackoverflow.com/questions/3548666/overlay-images-onto-camera-preview-surfaceview android graphics camera surfaceview share improve this question Well here's how I did it ... I hope somebody finds it useful though the Qualcomm AR stuff is out.. it might be obselete.. oh and basically what this does is generate.. e float x e.getX float y e.getY switch e.getAction case MotionEvent.ACTION_MOVE float dx x mPreviousX float dy y mPreviousY cr.mAngleX dx TOUCH_SCALE_FACTOR cr.mAngleY dy TOUCH_SCALE_FACTOR requestRender mPreviousX x mPreviousY.. MotionEvent.ACTION_MOVE float dx x mPreviousX float dy y mPreviousY cr.mAngleX dx TOUCH_SCALE_FACTOR cr.mAngleY dy TOUCH_SCALE_FACTOR requestRender mPreviousX x mPreviousY y return true private final float TOUCH_SCALE_FACTOR 180.0f..
How to make Drag & Drop Button in Android http://stackoverflow.com/questions/5037799/how-to-make-drag-drop-button-in-android where you want it to do and it stays there. Below code only scales the button doesn't change its position. package com.dynamic import android.app.Activity import android.os.Bundle import android.view.MotionEvent import android.view.View import.. import android.widget.FrameLayout import android.widget.ImageView import android.widget.TextView import com.dynamic.R import com.dynamic.R.layout public class dy extends Activity int status private FrameLayout layout ImageView image.. import android.widget.ImageView import android.widget.TextView import com.dynamic.R import com.dynamic.R.layout public class dy extends Activity int status private FrameLayout layout ImageView image Button b LayoutParams..
Android: HorizontalScrollView smoothScroll animation time http://stackoverflow.com/questions/5193678/android-horizontalscrollview-smoothscroll-animation-time e e.printStackTrace catch IllegalAccessException e e.printStackTrace public void customSmoothScrollBy int dx int dy if myScroller null smoothScrollBy dx dy return if getChildCount 0 return final int width getWidth getPaddingRight getPaddingLeft.. e e.printStackTrace public void customSmoothScrollBy int dx int dy if myScroller null smoothScrollBy dx dy return if getChildCount 0 return final int width getWidth getPaddingRight getPaddingLeft final int right getChildAt 0 .getWidth..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events isn't processing a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId.. a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId INVALID_POINTER_ID break case..
Pinch Zoom in android for an imageview? http://stackoverflow.com/questions/6758847/pinch-zoom-in-android-for-an-imageview isn't processing a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId.. a gesture. if mScaleDetector.isInProgress final float dx x mLastTouchX final float dy y mLastTouchY mPosX dx mPosY dy invalidate mLastTouchX x mLastTouchY y break case MotionEvent.ACTION_UP mActivePointerId INVALID_POINTER_ID break case..
Slowing speed of Viewpager controller in android http://stackoverflow.com/questions/8155257/slowing-speed-of-viewpager-controller-in-android flywheel super context interpolator flywheel @Override public void startScroll int startX int startY int dx int dy int duration Ignore received duration use fixed one instead super.startScroll startX startY dx dy mDuration @Override public.. startY int dx int dy int duration Ignore received duration use fixed one instead super.startScroll startX startY dx dy mDuration @Override public void startScroll int startX int startY int dx int dy Ignore received duration use fixed one instead.. super.startScroll startX startY dx dy mDuration @Override public void startScroll int startX int startY int dx int dy Ignore received duration use fixed one instead super.startScroll startX startY dx dy mDuration And using it like this try..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger i points.size i if i 0 Point point points.get i if i 0 Point next points.get i 1 point.dx next.x point.x 3 point.dy next.y point.y 3 else if i points.size 1 Point prev points.get i 1 point.dx point.x prev.x 3 point.dy point.y prev.y.. 3 point.dy next.y point.y 3 else if i points.size 1 Point prev points.get i 1 point.dx point.x prev.x 3 point.dy point.y prev.y 3 else Point next points.get i 1 Point prev points.get i 1 point.dx next.x prev.x 3 point.dy next.y.. point.y prev.y 3 else Point next points.get i 1 Point prev points.get i 1 point.dx next.x prev.x 3 point.dy next.y prev.y 3 boolean first true for int i 0 i points.size i Point point points.get i if first first false path.moveTo..
Android Fragment Pager and Custom Page Indicator( ViewPagerIndicator created by Jake Wharton) http://stackoverflow.com/questions/14433281/android-fragment-pager-and-custom-page-indicator-viewpagerindicator-created-by if mCentered longOffset longSize longPaddingBefore longPaddingAfter 2.0f condition threeRadius 2.0f float dX float dY float pageFillRadius mRadius if mPaintStroke.getStrokeWidth 0 pageFillRadius mPaintStroke.getStrokeWidth 2.0f Draw stroked.. int iLoop 0 iLoop condition iLoop float drawLong longOffset iLoop threeRadius if mOrientation HORIZONTAL dX drawLong dY shortOffset else dX shortOffset dY drawLong Only paint fill if not completely transparent if mPaintPageFill.getAlpha 0.. float drawLong longOffset iLoop threeRadius if mOrientation HORIZONTAL dX drawLong dY shortOffset else dX shortOffset dY drawLong Only paint fill if not completely transparent if mPaintPageFill.getAlpha 0 canvas.drawCircle dX dY pageFillRadius..
Is Opengl Development GPU Dependant? http://stackoverflow.com/questions/17229066/is-opengl-development-gpu-dependant dx firstY dy else if count 2 ux ev.getX uy ev.getY ux ux getWidth 2 1 uy 1 uy getHeight 2 secondX ux secondY uy myRenderer.dx firstX myRenderer.dy firstY myRenderer.ux secondX myRenderer.uy secondY midX firstX secondX 2 midY.. 2 secondX ux secondY uy myRenderer.dx firstX myRenderer.dy firstY myRenderer.ux secondX myRenderer.uy secondY midX firstX secondX 2 midY firstY secondY 2 Log.e JO Line firstX firstX firstY firstY lp new LinePoints firstX firstY.. uy myRenderer.dx firstX myRenderer.dy firstY myRenderer.ux secondX myRenderer.uy secondY midX firstX secondX 2 midY firstY secondY 2 Log.e JO Line firstX firstX firstY firstY lp new LinePoints firstX firstY secondX secondY midX..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas class BallBounce extends View int screenW int screenH int X int Y int initialY int ballW int ballH int angle float dY float acc Bitmap ball bgr public BallBounce Context context super context ball BitmapFactory.decodeResource getResources.. getResources R.drawable.sky_bgr load a background ballW ball.getWidth ballH ball.getHeight acc 0.2f acceleration dY 0 vertical speed initialY 100 Initial vertical position. angle 0 Start value for rotation angle. @Override public void onSizeChanged.. super.onDraw canvas Draw background. canvas.drawBitmap bgr 0 0 null Compute roughly ball speed and location. Y int dY Increase or decrease vertical position. if Y screenH ballH dY 1 dY Reverse speed when bottom hit. dY acc Increase or decrease..
Where does Android View.scrollTo(x, y) scroll to? http://stackoverflow.com/questions/7773206/where-does-android-view-scrolltox-y-scroll-to 0 0 will place the View in the center of the image. This way the top left corner of the image will be located at dX 2 dY 2 and the bottom right corner at mW dX 2 mH dY 2 . dX represents the difference between the widths of the image and the.. This way the top left corner of the image will be located at dX 2 dY 2 and the bottom right corner at mW dX 2 mH dY 2 . dX represents the difference between the widths of the image and the View . And dY represents the difference between.. right corner at mW dX 2 mH dY 2 . dX represents the difference between the widths of the image and the View . And dY represents the difference between the heights of the image and the View . In order to see the bottom right corner and not..
|