Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30310487 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Settings: Fix TouchInterceptor widget on tablets" into cm-10.1

parents 408854a8 c6f25145
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -86,13 +86,17 @@ public class TouchInterceptor extends ListView {
                    // The dragger icon itself is quite small, so pretend the
                    // The dragger icon itself is quite small, so pretend the
                    // touch area is bigger
                    // touch area is bigger
                    if (x < r.right * 2) {
                    if (x < r.right * 2) {
                        // Fix x position while dragging
                        int[] itemPos = new int[2];
                        item.getLocationOnScreen(itemPos);

                        item.setDrawingCacheEnabled(true);
                        item.setDrawingCacheEnabled(true);
                        // Create a copy of the drawing cache so that it does
                        // Create a copy of the drawing cache so that it does
                        // not get recycled
                        // not get recycled
                        // by the framework when the list tries to clean up
                        // by the framework when the list tries to clean up
                        // memory
                        // memory
                        Bitmap bitmap = Bitmap.createBitmap(item.getDrawingCache());
                        Bitmap bitmap = Bitmap.createBitmap(item.getDrawingCache());
                        startDragging(bitmap, y);
                        startDragging(bitmap, itemPos[0], y);
                        mDragPos = itemnum;
                        mDragPos = itemnum;
                        mFirstDragPos = mDragPos;
                        mFirstDragPos = mDragPos;
                        mHeight = getHeight();
                        mHeight = getHeight();
@@ -292,12 +296,12 @@ public class TouchInterceptor extends ListView {
        return super.onTouchEvent(ev);
        return super.onTouchEvent(ev);
    }
    }


    private void startDragging(Bitmap bm, int y) {
    private void startDragging(Bitmap bm, int x, int y) {
        stopDragging();
        stopDragging();


        mWindowParams = new WindowManager.LayoutParams();
        mWindowParams = new WindowManager.LayoutParams();
        mWindowParams.gravity = Gravity.TOP;
        mWindowParams.gravity = Gravity.TOP | Gravity.LEFT;
        mWindowParams.x = 0;
        mWindowParams.x = x;
        mWindowParams.y = y - mDragPoint + mCoordOffset;
        mWindowParams.y = y - mDragPoint + mCoordOffset;


        mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;