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(true), PARTIAL_LOCATION(false),
// 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(true),

View file

@ -305,8 +305,6 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
iconId = R.drawable.ic_type_video;
} else if (pd.isPhotoNote()) {
iconId = R.drawable.ic_type_img;
} else if (pd.isGpxFile()) {
iconId = R.drawable.ic_action_polygom_dark;
} else {
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<QuickSearchListItem> selectedItems = historySearchFragment.getListAdapter().getSelectedItems();
for (QuickSearchListItem searchListItem : selectedItems) {
SearchResult sr = searchListItem.getSearchResult();
Object object = sr.object;
Object object = searchListItem.getSearchResult().object;;
if (object instanceof HistoryEntry) {
historyEntries.add((HistoryEntry) object);
}

View file

@ -464,7 +464,7 @@ public class QuickSearchHelper implements ResourceListener {
if (gpxInfo != null) {
sr.localeName = gpxInfo.getFileName();
sr.object = point;
sr.objectType = ObjectType.RECENT_OBJ;
sr.objectType = ObjectType.GPX_TRACK;
sr.relatedObject = gpxInfo;
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.QuickSearchSelectAllListItem;
import net.osmand.search.SearchUICore;
import net.osmand.search.core.ObjectType;
import net.osmand.search.core.SearchPhrase;
import net.osmand.search.core.SearchResult;
import net.osmand.search.core.SearchWord;
@ -401,7 +402,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
@Nullable View convertView,
@NonNull QuickSearchListItem listItem) {
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);
} else {
return bindSearchResult(position, convertView, listItem);

View file

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

View file

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