use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class TrackAppearanceFragment method applySplit.
void applySplit(GpxSplitType splitType, int timeSplit, double distanceSplit) {
if (splitIntervalCard != null) {
splitIntervalCard.updateContent();
}
SplitTrackListener splitTrackListener = new SplitTrackListener() {
@Override
public void trackSplittingStarted() {
}
@Override
public void trackSplittingFinished() {
if (selectedGpxFile != null) {
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
selectedGpxFile.setDisplayGroups(groups, app);
}
refreshMap();
}
};
List<GpxDisplayGroup> groups = getGpxDisplayGroups();
new SplitTrackAsyncTask(app, splitType, groups, splitTrackListener, trackDrawInfo.isJoinSegments(), timeSplit, distanceSplit).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class TrackMenuFragment method saveGpx.
private void saveGpx(final SelectedGpxFile selectedGpxFile, GPXFile gpxFile) {
new SaveGpxAsyncTask(new File(gpxFile.path), gpxFile, new SaveGpxListener() {
@Override
public void gpxSavingStarted() {
}
@Override
public void gpxSavingFinished(Exception errorMessage) {
if (selectedGpxFile != null) {
List<GpxDisplayGroup> groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] { GpxDisplayItemType.TRACK_SEGMENT });
selectedGpxFile.setDisplayGroups(groups, app);
selectedGpxFile.processPoints(app);
}
updateContent();
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class DisplayGroupsBottomSheet method updateListItems.
private void updateListItems() {
listContainer.removeAllViews();
listViews.clear();
for (SelectableItem<GpxDisplayGroup> item : uiItems) {
View view = inflater.inflate(R.layout.bottom_sheet_item_with_descr_and_switch_56dp, listContainer, false);
TextView title = view.findViewById(R.id.title);
title.setText(item.getTitle());
TextView description = view.findViewById(R.id.description);
description.setText(item.getDescription());
CompoundButton cb = view.findViewById(R.id.compound_button);
UiUtilities.setupCompoundButton(cb, nightMode, CompoundButtonType.GLOBAL);
view.setOnClickListener(v -> {
GpxDisplayGroup group = item.getObject();
updateGroupVisibility(group.getName(), !cb.isChecked());
callback.onPointGroupsVisibilityChanged();
fullUpdate();
});
listContainer.addView(view);
listViews.put(item, view);
}
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class DisplayGroupsBottomSheet method updateList.
private void updateList() {
int defaultIconColor = ColorUtilities.getDefaultIconColor(app, nightMode);
for (SelectableItem<GpxDisplayGroup> item : uiItems) {
View view = listViews.get(item);
if (view == null) {
continue;
}
GpxDisplayGroup group = item.getObject();
boolean isVisible = group != null && !selectedGpxFile.isGroupHidden(group.getName());
int iconId = isVisible ? R.drawable.ic_action_folder : R.drawable.ic_action_folder_hidden;
int iconColor = item.getColor();
if (iconColor == 0 || !isVisible) {
iconColor = defaultIconColor;
}
ImageView icon = view.findViewById(R.id.icon);
icon.setImageDrawable(getPaintedIcon(iconId, iconColor));
CompoundButton cb = view.findViewById(R.id.compound_button);
cb.setChecked(isVisible);
}
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class DisplayPointsGroupsHelper method processDisplayGroups.
private void processDisplayGroups(List<GpxDisplayGroup> displayGroups, Set<?> filteredItems) {
for (int i = 0; i < displayGroups.size(); i++) {
GpxDisplayGroup group = displayGroups.get(i);
if (group.getModifiableList().isEmpty()) {
continue;
}
Map<String, List<GpxDisplayItem>> itemsMap = collectItemsByCategory(group, i);
if (filteredItems != null) {
itemsMap = filterItems(itemsMap, filteredItems);
}
if (!Algorithms.isEmpty(itemsMap)) {
setCollectedItems(group, itemsMap);
}
}
}
Aggregations