Loading app/src/main/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ </intent-filter> </receiver> --> <receiver android:name="core.broadcast.PackageAddedRemovedHandler" /> <meta-data android:name="android.nfc.disable_beam_default" Loading app/src/main/java/foundation/e/blisslauncher/core/customviews/LauncherPagedView.java +54 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.view.animation.AnimationUtils; import android.view.animation.OvershootInterpolator; import android.widget.GridLayout; import android.widget.Toast; import foundation.e.blisslauncher.BuildConfig; import foundation.e.blisslauncher.R; import foundation.e.blisslauncher.core.Utilities; Loading @@ -61,6 +62,7 @@ import foundation.e.blisslauncher.features.shortcuts.ShortcutKey; import foundation.e.blisslauncher.features.test.Alarm; import foundation.e.blisslauncher.features.test.CellLayout; import foundation.e.blisslauncher.features.test.IconTextView; import foundation.e.blisslauncher.features.test.LauncherItemMatcher; import foundation.e.blisslauncher.features.test.LauncherState; import foundation.e.blisslauncher.features.test.LauncherStateManager; import foundation.e.blisslauncher.features.test.OnAlarmListener; Loading @@ -78,6 +80,7 @@ import foundation.e.blisslauncher.features.test.dragndrop.DropTarget; import foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController; import foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider; import foundation.e.blisslauncher.features.test.uninstall.UninstallHelper; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; Loading @@ -86,6 +89,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; import org.jetbrains.annotations.NotNull; public class LauncherPagedView extends PagedView<PageIndicatorDots> implements View.OnTouchListener, Loading Loading @@ -441,7 +445,6 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V if (count.value == 1) { DeepShortcutManager.getInstance(getContext()).pinShortcut(pinnedShortcut); } } // Save the WorkspaceItemInfo for binding in the workspace addedItemsFinal.add(itemInfo); Loading Loading @@ -2736,6 +2739,55 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V computeScrollHelper(false); } /** * Removes items that match the {@param matcher}. When applications are removed * as a part of an update, this is called to ensure that other widgets and application * shortcuts are not removed. */ public void removeItemsByMatcher(@NotNull LauncherItemMatcher matcher) { for (final CellLayout layout : getWorkspaceAndHotseatCellLayouts()) { HashMap<String, View> idToViewMap = new HashMap<>(); ArrayList<LauncherItem> items = new ArrayList<>(); for (int j = 0; j < layout.getChildCount(); j++) { final View view = layout.getChildAt(j); if (view.getTag() instanceof LauncherItem) { LauncherItem item = (LauncherItem) view.getTag(); items.add(item); idToViewMap.put(item.id, view); } } for (LauncherItem itemToRemove : matcher.filterItemInfos(items)) { View child = idToViewMap.get(itemToRemove.id); if (child != null) { // Note: We can not remove the view directly from CellLayoutChildren as this // does not re-mark the spaces as unoccupied. layout.removeViewInLayout(child); if (child instanceof DropTarget) { mDragController.removeDropTarget((DropTarget) child); } } else if (itemToRemove.container >= 0) { // The item may belong to a folder. View parent = idToViewMap.get(String.valueOf(itemToRemove.container)); if (parent != null) { /* FolderItem folderInfo = (FolderItem) parent.getTag(); folderInfo.prepareAutoUpdate(); folderInfo.remove((WorkspaceItemInfo) itemToRemove, false); */ // TODO: Properly handle item removal from folder. } } } } // Strip all the empty screens stripEmptyScreens(); updateDatabase(getWorkspaceAndHotseatCellLayouts()); } public interface ItemOperator { /** * Process the next itemInfo, possibly with side-effect on the next item. Loading app/src/main/java/foundation/e/blisslauncher/features/launcher/AppProvider.java +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class AppProvider { Context.LAUNCHER_APPS_SERVICE); assert launcher != null; launcher.registerCallback(new LauncherApps.Callback() { /*launcher.registerCallback(new LauncherApps.Callback() { @Override public void onPackageRemoved(String packageName, android.os.UserHandle user) { if (packageName.equalsIgnoreCase(MICROG_PACKAGE) || packageName.equalsIgnoreCase( Loading Loading @@ -194,7 +194,7 @@ public class AppProvider { super.onPackagesUnsuspended(packageNames, user); Log.d(TAG, "onPackagesUnsuspended() called with: packageNames = [" + packageNames + "], user = [" + user + "]"); } }); });*/ mAppsRepository = AppsRepository.getAppsRepository(); } Loading app/src/main/java/foundation/e/blisslauncher/features/test/LauncherAppState.java +0 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ public class LauncherAppState { mCallbacks.put(mModel, wrappedCallback); } launcherApps.registerCallback(wrappedCallback); mModel.registerCallbacks(launcherApps); // Register intent receivers IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_LOCALE_CHANGED); Loading app/src/main/java/foundation/e/blisslauncher/features/test/LauncherItemMatcher.java +8 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.os.UserHandle; import java.util.HashSet; import foundation.e.blisslauncher.core.database.model.ApplicationItem; import foundation.e.blisslauncher.core.database.model.FolderItem; import foundation.e.blisslauncher.core.database.model.LauncherItem; import foundation.e.blisslauncher.core.database.model.ShortcutItem; Loading @@ -22,7 +23,13 @@ public abstract class LauncherItemMatcher { public final HashSet<LauncherItem> filterItemInfos(Iterable<LauncherItem> infos) { HashSet<LauncherItem> filtered = new HashSet<>(); for (LauncherItem i : infos) { if (i instanceof ShortcutItem) { if (i instanceof ApplicationItem) { ApplicationItem info = (ApplicationItem) i; ComponentName cn = info.getTargetComponent(); if (cn != null && matches(info, cn)) { filtered.add(info); } } else if (i instanceof ShortcutItem) { ShortcutItem info = (ShortcutItem) i; ComponentName cn = info.getTargetComponent(); if (cn != null && matches(info, cn)) { Loading Loading
app/src/main/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ </intent-filter> </receiver> --> <receiver android:name="core.broadcast.PackageAddedRemovedHandler" /> <meta-data android:name="android.nfc.disable_beam_default" Loading
app/src/main/java/foundation/e/blisslauncher/core/customviews/LauncherPagedView.java +54 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.view.animation.AnimationUtils; import android.view.animation.OvershootInterpolator; import android.widget.GridLayout; import android.widget.Toast; import foundation.e.blisslauncher.BuildConfig; import foundation.e.blisslauncher.R; import foundation.e.blisslauncher.core.Utilities; Loading @@ -61,6 +62,7 @@ import foundation.e.blisslauncher.features.shortcuts.ShortcutKey; import foundation.e.blisslauncher.features.test.Alarm; import foundation.e.blisslauncher.features.test.CellLayout; import foundation.e.blisslauncher.features.test.IconTextView; import foundation.e.blisslauncher.features.test.LauncherItemMatcher; import foundation.e.blisslauncher.features.test.LauncherState; import foundation.e.blisslauncher.features.test.LauncherStateManager; import foundation.e.blisslauncher.features.test.OnAlarmListener; Loading @@ -78,6 +80,7 @@ import foundation.e.blisslauncher.features.test.dragndrop.DropTarget; import foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController; import foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider; import foundation.e.blisslauncher.features.test.uninstall.UninstallHelper; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; Loading @@ -86,6 +89,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; import org.jetbrains.annotations.NotNull; public class LauncherPagedView extends PagedView<PageIndicatorDots> implements View.OnTouchListener, Loading Loading @@ -441,7 +445,6 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V if (count.value == 1) { DeepShortcutManager.getInstance(getContext()).pinShortcut(pinnedShortcut); } } // Save the WorkspaceItemInfo for binding in the workspace addedItemsFinal.add(itemInfo); Loading Loading @@ -2736,6 +2739,55 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V computeScrollHelper(false); } /** * Removes items that match the {@param matcher}. When applications are removed * as a part of an update, this is called to ensure that other widgets and application * shortcuts are not removed. */ public void removeItemsByMatcher(@NotNull LauncherItemMatcher matcher) { for (final CellLayout layout : getWorkspaceAndHotseatCellLayouts()) { HashMap<String, View> idToViewMap = new HashMap<>(); ArrayList<LauncherItem> items = new ArrayList<>(); for (int j = 0; j < layout.getChildCount(); j++) { final View view = layout.getChildAt(j); if (view.getTag() instanceof LauncherItem) { LauncherItem item = (LauncherItem) view.getTag(); items.add(item); idToViewMap.put(item.id, view); } } for (LauncherItem itemToRemove : matcher.filterItemInfos(items)) { View child = idToViewMap.get(itemToRemove.id); if (child != null) { // Note: We can not remove the view directly from CellLayoutChildren as this // does not re-mark the spaces as unoccupied. layout.removeViewInLayout(child); if (child instanceof DropTarget) { mDragController.removeDropTarget((DropTarget) child); } } else if (itemToRemove.container >= 0) { // The item may belong to a folder. View parent = idToViewMap.get(String.valueOf(itemToRemove.container)); if (parent != null) { /* FolderItem folderInfo = (FolderItem) parent.getTag(); folderInfo.prepareAutoUpdate(); folderInfo.remove((WorkspaceItemInfo) itemToRemove, false); */ // TODO: Properly handle item removal from folder. } } } } // Strip all the empty screens stripEmptyScreens(); updateDatabase(getWorkspaceAndHotseatCellLayouts()); } public interface ItemOperator { /** * Process the next itemInfo, possibly with side-effect on the next item. Loading
app/src/main/java/foundation/e/blisslauncher/features/launcher/AppProvider.java +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class AppProvider { Context.LAUNCHER_APPS_SERVICE); assert launcher != null; launcher.registerCallback(new LauncherApps.Callback() { /*launcher.registerCallback(new LauncherApps.Callback() { @Override public void onPackageRemoved(String packageName, android.os.UserHandle user) { if (packageName.equalsIgnoreCase(MICROG_PACKAGE) || packageName.equalsIgnoreCase( Loading Loading @@ -194,7 +194,7 @@ public class AppProvider { super.onPackagesUnsuspended(packageNames, user); Log.d(TAG, "onPackagesUnsuspended() called with: packageNames = [" + packageNames + "], user = [" + user + "]"); } }); });*/ mAppsRepository = AppsRepository.getAppsRepository(); } Loading
app/src/main/java/foundation/e/blisslauncher/features/test/LauncherAppState.java +0 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ public class LauncherAppState { mCallbacks.put(mModel, wrappedCallback); } launcherApps.registerCallback(wrappedCallback); mModel.registerCallbacks(launcherApps); // Register intent receivers IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_LOCALE_CHANGED); Loading
app/src/main/java/foundation/e/blisslauncher/features/test/LauncherItemMatcher.java +8 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.os.UserHandle; import java.util.HashSet; import foundation.e.blisslauncher.core.database.model.ApplicationItem; import foundation.e.blisslauncher.core.database.model.FolderItem; import foundation.e.blisslauncher.core.database.model.LauncherItem; import foundation.e.blisslauncher.core.database.model.ShortcutItem; Loading @@ -22,7 +23,13 @@ public abstract class LauncherItemMatcher { public final HashSet<LauncherItem> filterItemInfos(Iterable<LauncherItem> infos) { HashSet<LauncherItem> filtered = new HashSet<>(); for (LauncherItem i : infos) { if (i instanceof ShortcutItem) { if (i instanceof ApplicationItem) { ApplicationItem info = (ApplicationItem) i; ComponentName cn = info.getTargetComponent(); if (cn != null && matches(info, cn)) { filtered.add(info); } } else if (i instanceof ShortcutItem) { ShortcutItem info = (ShortcutItem) i; ComponentName cn = info.getTargetComponent(); if (cn != null && matches(info, cn)) { Loading