diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java b/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java index a2e685425..d24562cca 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreSection.java @@ -101,7 +101,7 @@ public class StoreSection { var matchesSelector = section.anyMatches(entryFilter); var sameCategory = category == null || category.getValue() == null - || category.getValue().contains(section.getWrapper()); + || inCategory(category.getValue(),section.getWrapper()); return showFilter && matchesSelector && sameCategory; }, category, @@ -140,7 +140,7 @@ public class StoreSection { var matchesSelector = section.anyMatches(entryFilter); var sameCategory = category == null || category.getValue() == null - || category.getValue().contains(section.getWrapper()); + || inCategory(category.getValue(),section.getWrapper()); // If this entry is already shown as root due to a different category than parent, don't show it // again here var notRoot = @@ -161,4 +161,16 @@ public class StoreSection { || c.test(wrapper) || allChildren.stream().anyMatch(storeEntrySection -> storeEntrySection.anyMatches(c)); } + + private static boolean inCategory(StoreCategoryWrapper categoryWrapper, StoreEntryWrapper entryWrapper) { + var current = entryWrapper.getCategory().getValue(); + while (current != null) { + if (categoryWrapper.getCategory().getUuid().equals(current.getCategory().getUuid())) { + return true; + } + + current = current.getParent(); + } + return false; + } }