diff --git a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java index d78df6e49d..aefeabf041 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java @@ -39,7 +39,7 @@ public class SearchHistoryHelper { 5, 60, 60 * 24, 5 * 60 * 24, 10 * 60 * 24, 30 * 60 * 24 }; - private static Comparator historyEntryComparator = new Comparator() { + private static class HistoryEntryComparator implements Comparator { long time = System.currentTimeMillis(); @Override @@ -200,7 +200,7 @@ public class SearchHistoryHelper { HistoryItemDBHelper helper = new HistoryItemDBHelper(); if (loadedEntries == null) { loadedEntries = helper.getEntries(); - Collections.sort(loadedEntries, historyEntryComparator); + Collections.sort(loadedEntries, new HistoryEntryComparator()); for(HistoryEntry he : loadedEntries) { mp.put(he.getName(), he); } @@ -236,7 +236,7 @@ public class SearchHistoryHelper { model.markAsAccessed(System.currentTimeMillis()); helper.add(model); } - Collections.sort(loadedEntries, historyEntryComparator); + Collections.sort(loadedEntries, new HistoryEntryComparator()); if(loadedEntries.size() > HISTORY_LIMIT){ if(helper.remove(loadedEntries.get(loadedEntries.size() - 1))){ loadedEntries.remove(loadedEntries.size() - 1);