Search in sources :

Example 21 with GpxDisplayGroup

use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.

the class DisplayPointsGroupsHelper method setCollectedItems.

private void setCollectedItems(GpxDisplayGroup group, Map<String, List<GpxDisplayItem>> itemsMap) {
    List<String> categories = new ArrayList<>(itemsMap.keySet());
    Collections.sort(categories, comparator);
    for (String category : categories) {
        List<GpxDisplayItem> values = itemsMap.get(category);
        GpxDisplayGroup headerGroup = group.cloneInstance();
        headerGroup.setName(category);
        for (GpxDisplayItem i : values) {
            if (i.locationStart != null && i.locationStart.getColor() != 0) {
                headerGroup.setColor(i.locationStart.getColor(group.getColor()));
                break;
            }
        }
        List<GpxDisplayItem> headerGroupItems = headerGroup.getModifiableList();
        headerGroupItems.clear();
        headerGroupItems.addAll(values);
        itemGroups.put(headerGroup, values);
        this.groups.add(headerGroup);
    }
}
Also used : GpxDisplayGroup(net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup) ArrayList(java.util.ArrayList) GpxDisplayItem(net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayItem)

Example 22 with GpxDisplayGroup

use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.

the class GpxUiHelper method makeGpxDisplayItem.

public static GpxDisplayItem makeGpxDisplayItem(@NonNull OsmandApplication app, @NonNull GPXFile gpxFile, @NonNull ChartPointLayer chartPointLayer) {
    GpxDisplayGroup group = null;
    if (!Algorithms.isEmpty(gpxFile.tracks)) {
        GpxSelectionHelper helper = app.getSelectedGpxHelper();
        String groupName = helper.getGroupName(gpxFile);
        group = helper.buildGpxDisplayGroup(gpxFile, 0, groupName);
    }
    if (group != null && group.getModifiableList().size() > 0) {
        GpxDisplayItem gpxItem = group.getModifiableList().get(0);
        if (gpxItem != null) {
            gpxItem.chartPointLayer = chartPointLayer;
        }
        return gpxItem;
    }
    return null;
}
Also used : GpxDisplayGroup(net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup) GpxDisplayItem(net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayItem) GpxSelectionHelper(net.osmand.plus.track.helpers.GpxSelectionHelper) SpannableString(android.text.SpannableString)

Aggregations

GpxDisplayGroup (net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup)22 ArrayList (java.util.ArrayList)7 GpxDisplayItem (net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayItem)7 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 SelectedGpxFile (net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile)5 CompoundButton (android.widget.CompoundButton)4 View (android.view.View)3 GPXFile (net.osmand.GPXUtilities.GPXFile)3 WptPt (net.osmand.GPXUtilities.WptPt)3 Paint (android.graphics.Paint)2 AbsListView (android.widget.AbsListView)2 File (java.io.File)2 List (java.util.List)2 OsmandApplication (net.osmand.plus.OsmandApplication)2 DisplayGroupsHolder (net.osmand.plus.track.helpers.DisplayPointsGroupsHelper.DisplayGroupsHolder)2 DialogInterface (android.content.DialogInterface)1 Drawable (android.graphics.drawable.Drawable)1 SpannableString (android.text.SpannableString)1 OnClickListener (android.view.View.OnClickListener)1