don't show duplicates fragment for history search items

This commit is contained in:
nazar-kutz 2020-11-19 13:30:52 +02:00
parent 02da17f726
commit ce498d7e04
4 changed files with 12 additions and 6 deletions

View file

@ -68,6 +68,10 @@ public abstract class CollectionSettingsItem<T> extends SettingsItem {
return res;
}
public boolean shouldShowDuplicates() {
return true;
}
public abstract boolean isDuplicate(@NonNull T item);
@NonNull

View file

@ -143,6 +143,11 @@ public class SearchHistorySettingsItem extends CollectionSettingsItem<HistoryEnt
return false;
}
@Override
public boolean shouldShowDuplicates() {
return false;
}
@Override
public boolean shouldReadOnCollecting() {
return true;

View file

@ -428,8 +428,9 @@ public class SettingsHelper {
duplicateItems.add(((ProfileSettingsItem) item).getModeBean());
}
} else if (item instanceof CollectionSettingsItem<?>) {
List<?> duplicates = ((CollectionSettingsItem<?>) item).processDuplicateItems();
if (!duplicates.isEmpty()) {
CollectionSettingsItem settingsItem = (CollectionSettingsItem) item;
List<?> duplicates = settingsItem.processDuplicateItems();
if (!duplicates.isEmpty() && settingsItem.shouldShowDuplicates()) {
duplicateItems.addAll(duplicates);
}
} else if (item instanceof FileSettingsItem) {

View file

@ -321,10 +321,6 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment {
duplicates.add(getString(R.string.markers_history));
duplicates.addAll(markersHistoryGroups);
}
if (!historyEntries.isEmpty()) {
duplicates.add(getString(R.string.shared_string_search_history));
duplicates.addAll(historyEntries);
}
return duplicates;
}