`
月下独酌
  • 浏览: 132608 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

and9

 
阅读更多
@Override
    public boolean onTouchEvent(MotionEvent ev) {
      
        case MotionEvent.ACTION_MOVE:

            mNavigator.setDrawToVisible(true);

            final int scrollX = mScrollX;
            final int scrollY = mScrollY;

            final float touchX = mTouchOffsetX;
            final float touchY = mTouchOffsetY;

            final int offsetX = mBitmapOffsetX;
            final int offsetY = mBitmapOffsetY;

            int left = (int) (scrollX + mLastMotionX - touchX - offsetX);
            int top = (int) (scrollY + mLastMotionY - touchY - offsetY);

            final Bitmap dragBitmap = mDragBitmap;
            final int width = dragBitmap.getWidth();
            final int height = dragBitmap.getHeight();

            final Rect rect = mRect;
            rect.set(left - 1, top - 1, left + width + 1, top + height + 1);

            mLastMotionX = x;
            mLastMotionY = y;

            left = (int) (scrollX + x - touchX - offsetX);
            top = (int) (scrollY + y - touchY - offsetY);

            rect.union(left - 1, top - 1, left + width + 1, top + height + 1);

            final int[] coordinates = mDropCoordinates;
            DropTarget dropTarget = findDropTarget((int) x, (int) y, coordinates);
            if (dropTarget != null) {
                if (mLastDropTarget == dropTarget) {
                    dropTarget.onDragOver(mDragSource, coordinates[0], coordinates[1],
                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo);
                } else {
                    if (mLastDropTarget != null) {
                        mLastDropTarget.onDragExit(mDragSource, coordinates[0], coordinates[1],
                            (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo);
                    }
                    dropTarget.onDragEnter(mDragSource, coordinates[0], coordinates[1],
                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo);
                }
            } else {
                if (mLastDropTarget != null) {
                    mLastDropTarget.onDragExit(mDragSource, coordinates[0], coordinates[1],
                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo);
                }
            }

            findCellPoint(dropTarget, coordinates, x, y);

            invalidate();


            mLastDropTarget = dropTarget;

            boolean inDragRegion = false;
            if (mDragRegion != null) {
                final RectF region = mDragRegion;
                final boolean inRegion = region.contains(ev.getRawX(), ev.getRawY());
                if (!mEnteredRegion && inRegion) {
                    mDragPaint = mTrashPaint;
                    mEnteredRegion = true;
                    inDragRegion = true;
                } else if (mEnteredRegion && !inRegion) {
                    mDragPaint = mTranslucence;
                    mEnteredRegion = false;
                }
            }

            int offset = getDragWingsOffset();
          
            if (!inDragRegion && x < SCROLL_ZONE && y >= offset && y <= offset + calculate.getDragWingsHeight()) {
           
                if (mScrollState == SCROLL_OUTSIDE_ZONE) {
                    mScrollState = SCROLL_WAITING_IN_ZONE;
                    mScrollRunnable.setDirection(SCROLL_LEFT);
                    postDelayed(mScrollRunnable, SCROLL_DELAY);
                }
          
            } else if (!inDragRegion && x > getWidth() - SCROLL_ZONE && y >= offset && y <= offset + calculate.getDragWingsHeight()) {
         
                if (mScrollState == SCROLL_OUTSIDE_ZONE) {
                    mScrollState = SCROLL_WAITING_IN_ZONE;
                    mScrollRunnable.setDirection(SCROLL_RIGHT);
                    postDelayed(mScrollRunnable, SCROLL_DELAY);
                }
            } else {
                if (mScrollState == SCROLL_WAITING_IN_ZONE) {
                    mScrollState = SCROLL_OUTSIDE_ZONE;
                    mScrollRunnable.setDirection(SCROLL_RIGHT);
                    removeCallbacks(mScrollRunnable);
                }
            }

            break;
       
    }
分享到:
评论

相关推荐

    Modern Java Recipes Simple Solutions to Difficult Problems in Java 8 and 9 epub

    Modern Java Recipes Simple Solutions to Difficult Problems in Java 8 and 9 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Bootstrap4 for Axure RP8 and 9

    Bootstrap4 for Axure RP8 and 9 打开Axure RP8、9 在左侧资源库里面点+号,增加资源库。 或者打开Axure RP8、9安装目录,进入DefaultSettings\Libraries,复制资源到此目录并重启Axure软件即可看到。

    Linear Algebra and Its Applications 5th David C

    Since then he has supported his brother David in refining and expanding the scope of this popular linear algebra text, including writing most of Chapters 8 and 9. Steven is also the author of three ...

    Operating Systems Internals and Design Principles, 9th Edition

    Operating Systems: Internals and Design Principles (9th Edition) By 作者: William Stallings ISBN-10 书号: 0134670957 ISBN-13 书号: 9780134670959 Edition 版本: 9 出版日期: 2017-03-23 pages 页数: (800 )...

    Microsoft.Excel.2019.VBA.and.Macros

    Chapters 8, ″Arrays,˝ and 9, ″Creating classes and collections,˝ cover arrays, classes, and collections. Chapter 10, ″Userforms: An introduction,˝ introduces custom dialog boxes that you can ...

    Stochastic Numerical Methods_ An Introduction for Students and Scientists

    stochastic differential equations (Chapters 6, 7, and 11), and numerical solutions to master equations (Chapters 8 and 9), although they are intertwined in many occasions and we have tried to ...

    Expert Oracle Database Architecture 9i and 10g programming Techniques and Solutions

    guidelines and practical implementation details on Oracle features and functions. For example, Oracle has a really neat feature called parallel execution. The Oracle documentation tells you how to use...

    《Real-Time 3D Terrain Engines Using C++ And DirectX 9 》 .

    《Real-Time 3D Terrain Engines Using C++ And DirectX 9 》.rar《Real-Time 3D Terrain Engines Using C++ And DirectX 9 》.rar《Real-Time 3D Terrain Engines Using C++ And DirectX 9 》.rar《Real-Time 3D ...

    Wavelets and Filter Banks_MIT

    Lecture 9 Multiresolution Analysis (MRA): Requirements for MRA Nested Spaces and Complementary Spaces Scaling Functions and Wavelets Lecture 10 Refinement Equation: Iterative and Recursive Solution ...

    VHDL例程源码 and_2

    VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2VHDL例程源码 and_2...

    DirectX9 User Interfaces Design and Implementation

    DirectX9 User Interfaces Design and Implementation DirectX9 UI 设计 DirectX9 User Interfaces Design and Implementation DirectX9 UI 设计 DirectX9 User Interfaces Design and Implementation

    Chapter 9- Solvency and liquidation.pdf

    Chapter 9- Solvency and liquidation.pdfChapter 9- Solvency and liquidation.pdfChapter 9- Solvency and liquidation.pdfChapter 9- Solvency and liquidation.pdfChapter 9- Solvency and liquidation.pdf

    MIEA-9.0_Candle_1.1.7_expertadvisor_

    MIEA v 9.0Entrance is based on candlestick and multi-currency analysis at the ... The remaining two (8 and 9) are directly related to the pair 1 and 2 so we compare their direction with exactly 1 and 2.

    Data Structures, Algorithms and Applications in C++ Second Edition

    Chapter 9 Queues Chapter 10 Skip Lists and Hashing Chapter 11 Binary and Other Trees Chapter 12 Priority Queues Chapter 13 Tournament Trees Chapter 14 Binary Search Trees Chapter 15 Balanced Search ...

    Enviro - Sky and Weather.7z

    * Volumetric Lighting requires at least shader-model 3.5+ and will be deactivated on DX9 Current limitation: * Volumetric clouds are currently not suitable for fly-throughs! Will be worked on in ...

    Computer Organization and Architecture 9th

    作者: William Stallings 出版社: Prentice Hall 副标题: Designing for Performance 出版年: 2009-4-13 页数: 792 定价: USD 149.00 装帧: Hardcover ISBN: 9780136073734

Global site tag (gtag.js) - Google Analytics