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

Commit 7a5f0fd6 authored by Amit Kumar's avatar Amit Kumar
Browse files

Fix #49 - Empty panel remains after dragging last icon to the quickbar

parent 03bfd358
Loading
Loading
Loading
Loading
Loading
+32 −4
Original line number Original line Diff line number Diff line
@@ -701,15 +701,43 @@ public class LauncherActivity extends AppCompatActivity implements
                        }
                        }
                    }
                    }
                    updateFolderInGrid(grid, folderItem, j);
                    updateFolderInGrid(grid, folderItem, j);

                    if (grid.getChildCount() == 0) {
                        pages.remove(i);
                        mHorizontalPager.removeViewAt(i + 1);
                        if (i == pages.size()) {
                            mHorizontalPager.scrollLeft(100);
                        }
                        mIndicator.removeViewAt(i);
                        updateIndicator();
                    }
                } else if (launcherItem.itemType == Constants.ITEM_TYPE_APPLICATION) {
                } else if (launcherItem.itemType == Constants.ITEM_TYPE_APPLICATION) {
                    ApplicationItem applicationItem = (ApplicationItem) launcherItem;
                    ApplicationItem applicationItem = (ApplicationItem) launcherItem;
                    if (applicationItem.packageName.equalsIgnoreCase(packageName) && applicationItem.user.isSameUser(userHandle)) {
                    if (applicationItem.packageName.equalsIgnoreCase(packageName) && applicationItem.user.isSameUser(userHandle)) {
                        grid.removeViewAt(j);
                        grid.removeViewAt(j);
                        if (grid.getChildCount() == 0) {
                            pages.remove(i);
                            mHorizontalPager.removeViewAt(i + 1);
                            if (i == pages.size()) {
                                mHorizontalPager.scrollLeft(100);
                            }
                            mIndicator.removeViewAt(i);
                            updateIndicator();
                        }
                    }
                    }
                } else if (launcherItem.itemType == Constants.ITEM_TYPE_SHORTCUT) {
                } else if (launcherItem.itemType == Constants.ITEM_TYPE_SHORTCUT) {
                    ShortcutItem shortcutItem = (ShortcutItem) launcherItem;
                    ShortcutItem shortcutItem = (ShortcutItem) launcherItem;
                    if (shortcutItem.packageName.equalsIgnoreCase(packageName)) {
                    if (shortcutItem.packageName.equalsIgnoreCase(packageName)) {
                        grid.removeViewAt(j);
                        grid.removeViewAt(j);
                        if (grid.getChildCount() == 0) {
                            pages.remove(i);
                            mHorizontalPager.removeViewAt(i + 1);
                            if (i == pages.size()) {
                                mHorizontalPager.scrollLeft(100);
                            }
                            mIndicator.removeViewAt(i);
                            updateIndicator();
                        }
                    }
                    }
                }
                }
            }
            }
@@ -2283,12 +2311,12 @@ public class LauncherActivity extends AppCompatActivity implements
                    for (int i = 0; i < pages.size(); i++) {
                    for (int i = 0; i < pages.size(); i++) {
                        if (pages.get(i).getChildCount() <= 0) {
                        if (pages.get(i).getChildCount() <= 0) {
                            pages.remove(i);
                            pages.remove(i);
                            int current = getCurrentAppsPageNumber();
                            mHorizontalPager.removeViewAt(i + 1);
                            mHorizontalPager.removeViewAt(i + 1);
                            mIndicator.removeViewAt(i);
                            if (i == pages.size()) {
                            if (current > i) {
                                mHorizontalPager.scrollLeft(100);
                                mHorizontalPager.scrollLeft(1);
                            }
                            }
                            mIndicator.removeViewAt(i);
                            updateIndicator();
                            i--;
                            i--;
                        }
                        }
                    }
                    }