mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Displaying Category image and Description (#4531)
* API call done * API call * Image implementation done * Gradle * Java docs and code convention * Description added * Refactoring Category * Refactoring Category * Refactoring Category * Description and thumbnail issue fixed * Description and thumbnail issue fixed * Minor issue fixed * Minor issue fixed * Server changed * Logo changed * Change in structure * Fixed failed tests * Fixed Test failed * Optimized imports * Dialog can't be dismissed * Dialog can't be dismissed * Resolved Conflicts * UI fixed * Added description and thumbnail in local DB * Added description and thumbnail in local DB * Test fixed * Added * Updated with latest master * Test Updated with latest master * Issue fixed * Revert gradle changes * Revert gradle changes * Update gradle-wrapper.properties * Require Api removed
This commit is contained in:
parent
0914eeea53
commit
92957f4204
31 changed files with 373 additions and 151 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
import fr.free.nrw.commons.category.CategoryItem;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class StringSortingUtils {
|
||||
|
|
@ -16,10 +17,10 @@ public class StringSortingUtils {
|
|||
* @param filter String to compare similarity with
|
||||
* @return Comparator with string similarity
|
||||
*/
|
||||
public static Comparator<String> sortBySimilarity(final String filter) {
|
||||
public static Comparator<CategoryItem> sortBySimilarity(final String filter) {
|
||||
return (firstItem, secondItem) -> {
|
||||
double firstItemSimilarity = calculateSimilarity(firstItem, filter);
|
||||
double secondItemSimilarity = calculateSimilarity(secondItem, filter);
|
||||
double firstItemSimilarity = calculateSimilarity(firstItem.getName(), filter);
|
||||
double secondItemSimilarity = calculateSimilarity(secondItem.getName(), filter);
|
||||
return (int) Math.signum(secondItemSimilarity - firstItemSimilarity);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue