use of it.niedermann.owncloud.notes.R in project nextcloud-notes by stefan-niedermann.
the class DisplayUtils method convertToCategoryNavigationItem.
public static NavigationItem.CategoryNavigationItem convertToCategoryNavigationItem(@NonNull Context context, @NonNull CategoryWithNotesCount counter) {
final var res = context.getResources();
final var englishRes = getEnglishResources(context);
final String category = counter.getCategory().replaceAll("\\s+", "");
int icon = NavigationAdapter.ICON_FOLDER;
for (Map.Entry<Integer, Collection<Integer>> replacement : SPECIAL_CATEGORY_REPLACEMENTS.entrySet()) {
if (Stream.concat(replacement.getValue().stream().map(res::getString), replacement.getValue().stream().map(englishRes::getString)).map(str -> str.replaceAll("\\s+", "")).anyMatch(r -> r.equalsIgnoreCase(category))) {
icon = replacement.getKey();
break;
}
}
return new NavigationItem.CategoryNavigationItem("category:" + counter.getCategory(), counter.getCategory(), counter.getTotalNotes(), icon, counter.getAccountId(), counter.getCategory());
}
Aggregations