add ObjectType.GPX_TRACK

This commit is contained in:
nazar-kutz 2021-03-05 12:38:38 +02:00
parent d942a4f683
commit 0d39173b8b
7 changed files with 10 additions and 9 deletions

View file

@ -8,7 +8,7 @@ public enum ObjectType {
// LOCATION // LOCATION
LOCATION(true), PARTIAL_LOCATION(false), LOCATION(true), PARTIAL_LOCATION(false),
// UI OBJECTS // UI OBJECTS
FAVORITE(true), FAVORITE_GROUP(false), WPT(true), RECENT_OBJ(true), FAVORITE(true), FAVORITE_GROUP(false), WPT(true), RECENT_OBJ(true), GPX_TRACK(false),
// ONLINE SEARCH // ONLINE SEARCH
ONLINE_SEARCH(true), ONLINE_SEARCH(true),

View file

@ -305,8 +305,6 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
iconId = R.drawable.ic_type_video; iconId = R.drawable.ic_type_video;
} else if (pd.isPhotoNote()) { } else if (pd.isPhotoNote()) {
iconId = R.drawable.ic_type_img; iconId = R.drawable.ic_type_img;
} else if (pd.isGpxFile()) {
iconId = R.drawable.ic_action_polygom_dark;
} else { } else {
iconId = R.drawable.ic_action_street_name; iconId = R.drawable.ic_action_street_name;
} }

View file

@ -513,8 +513,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
List<HistoryEntry> historyEntries = new ArrayList<HistoryEntry>(); List<HistoryEntry> historyEntries = new ArrayList<HistoryEntry>();
List<QuickSearchListItem> selectedItems = historySearchFragment.getListAdapter().getSelectedItems(); List<QuickSearchListItem> selectedItems = historySearchFragment.getListAdapter().getSelectedItems();
for (QuickSearchListItem searchListItem : selectedItems) { for (QuickSearchListItem searchListItem : selectedItems) {
SearchResult sr = searchListItem.getSearchResult(); Object object = searchListItem.getSearchResult().object;;
Object object = sr.object;
if (object instanceof HistoryEntry) { if (object instanceof HistoryEntry) {
historyEntries.add((HistoryEntry) object); historyEntries.add((HistoryEntry) object);
} }

View file

@ -464,7 +464,7 @@ public class QuickSearchHelper implements ResourceListener {
if (gpxInfo != null) { if (gpxInfo != null) {
sr.localeName = gpxInfo.getFileName(); sr.localeName = gpxInfo.getFileName();
sr.object = point; sr.object = point;
sr.objectType = ObjectType.RECENT_OBJ; sr.objectType = ObjectType.GPX_TRACK;
sr.relatedObject = gpxInfo; sr.relatedObject = gpxInfo;
publish = true; publish = true;
} }

View file

@ -40,6 +40,7 @@ import net.osmand.plus.search.listitems.QuickSearchListItemType;
import net.osmand.plus.search.listitems.QuickSearchMoreListItem; import net.osmand.plus.search.listitems.QuickSearchMoreListItem;
import net.osmand.plus.search.listitems.QuickSearchSelectAllListItem; import net.osmand.plus.search.listitems.QuickSearchSelectAllListItem;
import net.osmand.search.SearchUICore; import net.osmand.search.SearchUICore;
import net.osmand.search.core.ObjectType;
import net.osmand.search.core.SearchPhrase; import net.osmand.search.core.SearchPhrase;
import net.osmand.search.core.SearchResult; import net.osmand.search.core.SearchResult;
import net.osmand.search.core.SearchWord; import net.osmand.search.core.SearchWord;
@ -401,7 +402,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
@Nullable View convertView, @Nullable View convertView,
@NonNull QuickSearchListItem listItem) { @NonNull QuickSearchListItem listItem) {
SearchResult sr = listItem.getSearchResult(); SearchResult sr = listItem.getSearchResult();
if (sr != null && sr.relatedObject instanceof GPXInfo) { if (sr != null && sr.objectType == ObjectType.GPX_TRACK) {
return bindGpxTrack(position, convertView, listItem, (GPXInfo) sr.relatedObject); return bindGpxTrack(position, convertView, listItem, (GPXInfo) sr.relatedObject);
} else { } else {
return bindSearchResult(position, convertView, listItem); return bindSearchResult(position, convertView, listItem);

View file

@ -100,7 +100,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|| sr.objectType == ObjectType.FAVORITE || sr.objectType == ObjectType.FAVORITE
|| sr.objectType == ObjectType.RECENT_OBJ || sr.objectType == ObjectType.RECENT_OBJ
|| sr.objectType == ObjectType.WPT || sr.objectType == ObjectType.WPT
|| sr.objectType == ObjectType.STREET_INTERSECTION) { || sr.objectType == ObjectType.STREET_INTERSECTION
|| sr.objectType == ObjectType.GPX_TRACK) {
showResult(sr); showResult(sr);
} else { } else {
@ -170,7 +171,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
public void showResult(SearchResult searchResult) { public void showResult(SearchResult searchResult) {
showResult = false; showResult = false;
if (searchResult.relatedObject instanceof GPXInfo) { if (searchResult.objectType == ObjectType.GPX_TRACK) {
showTrackMenuFragment((GPXInfo) searchResult.relatedObject); showTrackMenuFragment((GPXInfo) searchResult.relatedObject);
} else if (searchResult.location != null) { } else if (searchResult.location != null) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();

View file

@ -359,6 +359,8 @@ public class QuickSearchListItem {
} else { } else {
return icon; return icon;
} }
case GPX_TRACK:
return getIcon(app, R.drawable.ic_action_polygom_dark);
case LOCATION: case LOCATION:
return getIcon(app, R.drawable.ic_action_world_globe); return getIcon(app, R.drawable.ic_action_world_globe);
case FAVORITE: case FAVORITE: