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

Commit cda6a8a9 authored by Amit Kumar's avatar Amit Kumar
Browse files

Get correct location of FolderAppsViewPager on screen

parent eab1ae78
Loading
Loading
Loading
Loading
+23 −30
Original line number Original line Diff line number Diff line
@@ -1939,9 +1939,7 @@ public class LauncherActivity extends AppCompatActivity implements
                    if (mWobblingCountDownTimer != null) {
                    if (mWobblingCountDownTimer != null) {
                        mWobblingCountDownTimer.cancel();
                        mWobblingCountDownTimer.cancel();
                    }
                    }
                }
                } else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {

                else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {
                    // Don't offer rearrange functionality when app is being dragged
                    // Don't offer rearrange functionality when app is being dragged
                    // out of folder window
                    // out of folder window
                    if (getAppDetails(movingApp).container != Constants.CONTAINER_DESKTOP
                    if (getAppDetails(movingApp).container != Constants.CONTAINER_DESKTOP
@@ -2012,9 +2010,7 @@ public class LauncherActivity extends AppCompatActivity implements
                        mDockReorderAlarm.setAlarm(REORDER_TIMEOUT);
                        mDockReorderAlarm.setAlarm(REORDER_TIMEOUT);
                    }
                    }
                    return true;
                    return true;
                }
                } else if (dragEvent.getAction() == DragEvent.ACTION_DROP) {

                else if (dragEvent.getAction() == DragEvent.ACTION_DROP) {
                    cleanupDockReorder(true);
                    cleanupDockReorder(true);
                    cleanupReorder(true);
                    cleanupReorder(true);
                    if (mFolderWindowContainer.getVisibility() != View.VISIBLE) {
                    if (mFolderWindowContainer.getVisibility() != View.VISIBLE) {
@@ -2044,14 +2040,15 @@ public class LauncherActivity extends AppCompatActivity implements
                        cX = dragEvent.getX() - dragShadowBuilder.xOffset;
                        cX = dragEvent.getX() - dragShadowBuilder.xOffset;
                        cY = mDock.getY() + dragEvent.getY() - dragShadowBuilder.yOffset;
                        cY = mDock.getY() + dragEvent.getY() - dragShadowBuilder.yOffset;
                        // Drop functionality when the folder window is visible
                        // Drop functionality when the folder window is visible
                        Rect bounds = new Rect((int) mFolderAppsViewPager.getX(),
                        int[] topLeftCorner = new int[2];
                                (int) mFolderAppsViewPager.getY(),
                        mFolderAppsViewPager.getLocationOnScreen(topLeftCorner);
                                (int) (mFolderAppsViewPager.getWidth()
                        int left = topLeftCorner[0];
                                        + mFolderAppsViewPager.getX()),
                        int top = topLeftCorner[1];
                                (int) (mFolderAppsViewPager.getHeight()
                        int right = left + mFolderAppsViewPager.getWidth();
                                        + mFolderAppsViewPager.getY()));
                        int bottom = top + mFolderAppsViewPager.getHeight();


                        if (!bounds.contains((int) cX, (int) cY)) {
                        if (!(left < right && top < bottom && cX >= left
                                && cX < right && cY >= top && cY < bottom)) {
                            removeAppFromFolder();
                            removeAppFromFolder();
                        } else {
                        } else {
                            movingApp.setVisibility(View.VISIBLE);
                            movingApp.setVisibility(View.VISIBLE);
@@ -2081,9 +2078,7 @@ public class LauncherActivity extends AppCompatActivity implements
                    if (mWobblingCountDownTimer != null) {
                    if (mWobblingCountDownTimer != null) {
                        mWobblingCountDownTimer.cancel();
                        mWobblingCountDownTimer.cancel();
                    }
                    }
                }
                } else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {

                else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {
                    cX = dragEvent.getX() - dragShadowBuilder.xOffset;
                    cX = dragEvent.getX() - dragShadowBuilder.xOffset;
                    cY = mHorizontalPager.getY() + dragEvent.getY()
                    cY = mHorizontalPager.getY() + dragEvent.getY()
                            - dragShadowBuilder.yOffset;
                            - dragShadowBuilder.yOffset;
@@ -2196,9 +2191,7 @@ public class LauncherActivity extends AppCompatActivity implements
                            }
                            }
                        }
                        }
                    }
                    }
                }
                } else if (dragEvent.getAction() == DragEvent.ACTION_DROP) {

                else if (dragEvent.getAction() == DragEvent.ACTION_DROP) {
                    cleanupReorder(true);
                    cleanupReorder(true);
                    cleanupDockReorder(true);
                    cleanupDockReorder(true);
                    if (mFolderWindowContainer.getVisibility() != View.VISIBLE) {
                    if (mFolderWindowContainer.getVisibility() != View.VISIBLE) {
@@ -2228,13 +2221,15 @@ public class LauncherActivity extends AppCompatActivity implements
                                - dragShadowBuilder.yOffset;
                                - dragShadowBuilder.yOffset;


                        // Drop functionality when the folder window is visible
                        // Drop functionality when the folder window is visible
                        Rect bounds = new Rect((int) mFolderAppsViewPager.getX(),
                        int[] topLeftCorner = new int[2];
                                (int) mFolderAppsViewPager.getY(),
                        mFolderAppsViewPager.getLocationOnScreen(topLeftCorner);
                                (int) (mFolderAppsViewPager.getWidth()
                        int left = topLeftCorner[0];
                                        + mFolderAppsViewPager.getX()),
                        int top = topLeftCorner[1];
                                (int) (mFolderAppsViewPager.getHeight()
                        int right = left + mFolderAppsViewPager.getWidth();
                                        + mFolderAppsViewPager.getY()));
                        int bottom = top + mFolderAppsViewPager.getHeight();
                        if (!bounds.contains((int) cX, (int) cY)) {

                        if (!(left < right && top < bottom && cX >= left
                                && cX < right && cY >= top && cY < bottom)) {
                            removeAppFromFolder();
                            removeAppFromFolder();
                        } else {
                        } else {
                            movingApp.setVisibility(View.VISIBLE);
                            movingApp.setVisibility(View.VISIBLE);
@@ -2244,9 +2239,7 @@ public class LauncherActivity extends AppCompatActivity implements
                                            currentItem)).indexOfChild(movingApp));
                                            currentItem)).indexOfChild(movingApp));
                        }
                        }
                    }
                    }
                }
                } else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_ENDED) {

                else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_ENDED) {
                    if (isDragging) {
                    if (isDragging) {
                        isDragging = false;
                        isDragging = false;
                    }
                    }