diff --git a/OsmAnd/.gitignore b/OsmAnd/.gitignore
index 3149fb4209..a4e941e9d2 100644
--- a/OsmAnd/.gitignore
+++ b/OsmAnd/.gitignore
@@ -39,11 +39,7 @@ mx_*
valgrind/
bin/
dist/
-assets/specialphrases/*
-assets/voice/*
-assets/fonts/*
-assets/feature_articles/*
-assets/World_basemap_mini*
+
gen/
local.properties
raw/
@@ -56,6 +52,11 @@ out/
use/
osmand.properties
osmand.xml
+assets/specialphrases/*
+assets/voice/*
+assets/fonts/*
+assets/feature_articles/*
+assets/*.obf
assets/style.css
assets/poi_categories.json
assets/help/*.html
diff --git a/OsmAnd/res/layout/track_groups_card.xml b/OsmAnd/res/layout/track_groups_card.xml
new file mode 100644
index 0000000000..ff070c1ed0
--- /dev/null
+++ b/OsmAnd/res/layout/track_groups_card.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java
index 9279a85ce5..e65727b6c1 100644
--- a/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java
+++ b/OsmAnd/src/net/osmand/plus/importfiles/ImportHelper.java
@@ -673,7 +673,10 @@ public class ImportHelper {
public static List asFavourites(OsmandApplication app, List wptPts, String fileName, boolean forceImportFavourites) {
List favourites = new ArrayList<>();
for (WptPt p : wptPts) {
- if (p.name != null) {
+ if (Algorithms.isEmpty(p.name)) {
+ p.name = app.getResources().getString(R.string.shared_string_waypoint);
+ }
+ if (!Algorithms.isEmpty(p.name)) {
final String fpCat;
if (p.category == null) {
if (forceImportFavourites) {
diff --git a/OsmAnd/src/net/osmand/plus/track/PointsGroupsCard.java b/OsmAnd/src/net/osmand/plus/track/PointsGroupsCard.java
new file mode 100644
index 0000000000..be7fad749f
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/track/PointsGroupsCard.java
@@ -0,0 +1,79 @@
+package net.osmand.plus.track;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
+import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionAdapterListener;
+import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionItem;
+import net.osmand.plus.routepreparationmenu.cards.BaseCard;
+import net.osmand.util.Algorithms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PointsGroupsCard extends BaseCard {
+
+ public static final int SELECT_GROUP_INDEX = 0;
+
+ private GpxDisplayGroup selectedGroup;
+ private final List displayGroups = new ArrayList<>();
+
+ public PointsGroupsCard(@NonNull MapActivity mapActivity, @NonNull List groups) {
+ super(mapActivity);
+ displayGroups.addAll(groups);
+ }
+
+ @Override
+ public int getCardLayoutId() {
+ return R.layout.track_groups_card;
+ }
+
+ public GpxDisplayGroup getSelectedGroup() {
+ return selectedGroup;
+ }
+
+ @Override
+ protected void updateContent() {
+ ArrayList items = new ArrayList<>();
+ items.add(new HorizontalSelectionItem(app.getString(R.string.shared_string_all), null));
+ for (GpxDisplayGroup group : displayGroups) {
+ String categoryName = group.getName();
+ if (Algorithms.isEmpty(categoryName)) {
+ categoryName = app.getString(R.string.shared_string_gpx_points);
+ }
+ items.add(new HorizontalSelectionItem(categoryName, group));
+ }
+ final HorizontalSelectionAdapter selectionAdapter = new HorizontalSelectionAdapter(app, nightMode);
+ selectionAdapter.setItems(items);
+ selectionAdapter.setListener(new HorizontalSelectionAdapterListener() {
+ @Override
+ public void onItemSelected(HorizontalSelectionItem item) {
+ selectedGroup = (GpxDisplayGroup) item.getObject();
+ CardListener listener = getListener();
+ if (listener != null) {
+ listener.onCardButtonPressed(PointsGroupsCard.this, SELECT_GROUP_INDEX);
+ }
+ selectionAdapter.notifyDataSetChanged();
+ }
+ });
+ if (selectedGroup != null) {
+ String categoryName = selectedGroup.getName();
+ if (Algorithms.isEmpty(categoryName)) {
+ categoryName = app.getString(R.string.shared_string_gpx_points);
+ }
+ selectionAdapter.setSelectedItemByTitle(categoryName);
+ } else {
+ selectionAdapter.setSelectedItemByTitle(app.getString(R.string.shared_string_all));
+ }
+
+ RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
+ recyclerView.setAdapter(selectionAdapter);
+ recyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
+ selectionAdapter.notifyDataSetChanged();
+ }
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java
index 36fb29caa6..797f8fbf6a 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java
@@ -136,6 +136,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
private DescriptionCard descriptionCard;
private OverviewCard overviewCard;
private TrackPointsCard pointsCard;
+ private PointsGroupsCard groupsCard;
private TextView headerTitle;
private ImageView headerIcon;
@@ -373,6 +374,21 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
blocksBuilder.runUpdatingStatBlocksIfNeeded();
}
} else {
+ if (menuType == TrackMenuType.POINTS && !Algorithms.isEmpty(pointsCard.getGroups())) {
+ if (groupsCard != null && groupsCard.getView() != null) {
+ ViewGroup parent = ((ViewGroup) groupsCard.getView().getParent());
+ if (parent != null) {
+ parent.removeView(groupsCard.getView());
+ }
+ headerContainer.addView(groupsCard.getView());
+ } else {
+ groupsCard = new PointsGroupsCard(getMapActivity(), pointsCard.getGroups());
+ groupsCard.setListener(this);
+ headerContainer.addView(groupsCard.build(getMapActivity()));
+ }
+ } else if (groupsCard != null && groupsCard.getView() != null) {
+ headerContainer.removeView(groupsCard.getView());
+ }
if (overviewCard != null && overviewCard.getView() != null) {
overviewCard.getBlockStatisticsBuilder().stopUpdatingStatBlocks();
headerContainer.removeView(overviewCard.getView());
@@ -869,6 +885,13 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} else if (buttonIndex == OPEN_WAYPOINT_INDEX) {
dismiss();
}
+ } else if (card instanceof PointsGroupsCard) {
+ PointsGroupsCard groupsCard = (PointsGroupsCard) card;
+ GpxDisplayGroup group = groupsCard.getSelectedGroup();
+ if (pointsCard != null) {
+ pointsCard.setSelectedGroup(group);
+ pointsCard.updateContent();
+ }
}
}
diff --git a/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java b/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java
index 3978c83ded..fe824bafc8 100644
--- a/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java
+++ b/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java
@@ -64,6 +64,7 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
private final TrackDisplayHelper displayHelper;
private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
+ private GpxDisplayGroup selectedGroup;
private final Set selectedGroups = new LinkedHashSet<>();
private final LinkedHashMap> selectedItems = new LinkedHashMap<>();
private boolean selectionMode;
@@ -97,7 +98,7 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
listView.setOnChildClickListener(this);
adapter.setFilterResults(null);
- adapter.synchronizeGroups(getOriginalGroups());
+ adapter.synchronizeGroups(getDisplayGroups());
if (listView.getAdapter() == null) {
listView.setAdapter(adapter);
}
@@ -109,6 +110,14 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
expandAllGroups();
}
+ public void setSelectedGroup(GpxDisplayGroup selectedGroup) {
+ this.selectedGroup = selectedGroup;
+ }
+
+ public List getGroups() {
+ return adapter.groups;
+ }
+
private void addActions(LayoutInflater inflater) {
View view = inflater.inflate(R.layout.preference_category_with_descr, listView, false);
TextView title = view.findViewById(android.R.id.title);
@@ -174,6 +183,10 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
return displayHelper.getOriginalGroups(filterTypes);
}
+ private List getDisplayGroups() {
+ return selectedGroup != null ? Collections.singletonList(selectedGroup) : getOriginalGroups();
+ }
+
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
@@ -246,7 +259,7 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
public void onPointsDeleted() {
selectedItems.clear();
selectedGroups.clear();
- adapter.synchronizeGroups(getOriginalGroups());
+ adapter.synchronizeGroups(getDisplayGroups());
}
public void filter(String text) {
@@ -618,16 +631,13 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
} else {
Set