Skip to content

Commit 13f8fba

Browse files
Bug fix issue commons-app#1826
Changes made : -Certain category names used to show suffixed with strings prefixed with pipe '|'. Removed everything after the pipe. As per the discussion on the thread, its safe to remove everything after the pipe, including the pipe
1 parent 3f52211 commit 13f8fba

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,18 @@ private void enableDeleteButton(boolean visibility) {
436436
private void rebuildCatList() {
437437
categoryContainer.removeAllViews();
438438
// @fixme add the category items
439-
for (String cat : categoryNames) {
440-
View catLabel = buildCatLabel(cat, categoryContainer);
439+
440+
//As per issue #1826, some categories come suffixed with strings prefixed with |. As per the discussion
441+
//that was meant for alphabetical sorting of the categories and can be safely removed.
442+
for(int i=0;i<categoryNames.size();i++){
443+
String categoryName = categoryNames.get(i);
444+
//Removed everything after '|'
445+
if (categoryName.indexOf('|') != -1) {
446+
categoryName = categoryName.substring(0, categoryName.indexOf('|'));
447+
//Set the updated category to the list as well
448+
categoryNames.set(i, categoryName);
449+
}
450+
View catLabel = buildCatLabel(categoryName, categoryContainer);
441451
categoryContainer.addView(catLabel);
442452
}
443453
}

0 commit comments

Comments
 (0)