Make the method universal

This commit is contained in:
Alexander Sytnyk 2017-10-26 12:09:35 +03:00
parent bd20cdfddf
commit 0cb24ed0db
2 changed files with 5 additions and 4 deletions

View file

@ -143,10 +143,10 @@ public class SearchSettings {
return s;
}
public boolean alreadyInOnlineSearch() {
public boolean hasCustomSearchType(ObjectType type) {
if (searchTypes != null) {
for (ObjectType type : searchTypes) {
if (type == ObjectType.ONLINE_SEARCH) {
for (ObjectType t : searchTypes) {
if (t == type) {
return true;
}
}

View file

@ -29,6 +29,7 @@ import net.osmand.plus.search.listitems.QuickSearchListItem;
import net.osmand.plus.search.listitems.QuickSearchListItemType;
import net.osmand.plus.search.listitems.QuickSearchMoreListItem;
import net.osmand.plus.search.listitems.QuickSearchSelectAllListItem;
import net.osmand.search.core.ObjectType;
import net.osmand.search.core.SearchPhrase;
import net.osmand.util.Algorithms;
import net.osmand.util.OpeningHoursParser;
@ -241,7 +242,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
((QuickSearchMoreListItem) listItem).increaseRadiusOnClick();
}
});
if (!app.getSearchUICore().getCore().getSearchSettings().alreadyInOnlineSearch()
if (!app.getSearchUICore().getCore().getSearchSettings().hasCustomSearchType(ObjectType.ONLINE_SEARCH)
&& OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) {
view.findViewById(R.id.online_search_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.online_search_row).setOnClickListener(new View.OnClickListener() {