use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class TrackDisplayHelper method updateDisplayGroups.
public void updateDisplayGroups() {
modifiedTime = gpxFile.modifiedTime;
GpxSelectionHelper selectedGpxHelper = app.getSelectedGpxHelper();
displayGroups = filteredGpxFile != null ? selectedGpxHelper.collectDisplayGroups(filteredGpxFile) : selectedGpxHelper.collectDisplayGroups(gpxFile);
originalGroups.clear();
for (GpxDisplayGroup g : displayGroups) {
originalGroups.add(g.cloneInstance());
}
if (file != null) {
SelectedGpxFile sf = selectedGpxHelper.getSelectedFileByPath(gpxFile.path);
if (sf != null && file != null && sf.getDisplayGroups(app) != null) {
displayGroups = sf.getDisplayGroups(app);
}
}
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class TrackPointsCard method updateContent.
@Override
public void updateContent() {
listView = view.findViewById(android.R.id.list);
listView.setOnChildClickListener(this);
List<GpxDisplayGroup> displayGroups = getOriginalGroups();
adapter.setFilterResults(null);
adapter.synchronizeGroups(displayGroups);
if (listView.getAdapter() == null) {
listView.setAdapter(adapter);
}
listView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
locationDataUpdateAllowed = scrollState == SCROLL_STATE_IDLE;
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
if (actionsView == null) {
addActions();
}
expandAllGroups();
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class DisplayPointsGroupsHelper method getGroups.
private DisplayGroupsHolder getGroups(@NonNull List<GpxDisplayGroup> displayGroups, @Nullable Set<?> filteredItems) {
Collections.sort(displayGroups, (g1, g2) -> {
int i1 = g1.getType().ordinal();
int i2 = g2.getType().ordinal();
return Algorithms.compare(i1, i2);
});
List<GpxDisplayGroup> trackPointsGroups = new ArrayList<>();
List<GpxDisplayGroup> routePointsGroups = new ArrayList<>();
for (GpxDisplayGroup group : displayGroups) {
if (group.getType() == GpxDisplayItemType.TRACK_POINTS) {
trackPointsGroups.add(group);
} else if (group.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
routePointsGroups.add(group);
}
}
processDisplayGroups(trackPointsGroups, filteredItems);
processDisplayGroups(routePointsGroups, filteredItems);
return new DisplayGroupsHolder(groups, itemGroups);
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class SplitSegmentDialogFragment method updateHeader.
private void updateHeader() {
final View splitIntervalView = headerView.findViewById(R.id.split_interval_view);
if (getGpx() != null && !getGpx().showCurrentTrack && adapter.getCount() > 0) {
setupSplitIntervalView(splitIntervalView);
if (options.size() == 0) {
prepareSplitIntervalAdapterData();
}
updateSplitIntervalView(splitIntervalView);
splitIntervalView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final ListPopupWindow popup = new ListPopupWindow(v.getContext());
popup.setAnchorView(splitIntervalView);
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
popup.setModal(true);
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
popup.setAdapter(new ArrayAdapter<>(v.getContext(), R.layout.popup_list_text_item, options));
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectedSplitInterval = position;
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), true, false);
final List<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, sf);
}
popup.dismiss();
updateSplitIntervalView(splitIntervalView);
}
});
popup.show();
}
});
splitIntervalView.setVisibility(View.VISIBLE);
} else {
splitIntervalView.setVisibility(View.GONE);
}
}
use of net.osmand.plus.track.helpers.GpxSelectionHelper.GpxDisplayGroup in project Osmand by osmandapp.
the class SplitSegmentDialogFragment method setupSplitIntervalView.
private void setupSplitIntervalView(@NonNull View view) {
final TextView title = (TextView) view.findViewById(R.id.split_interval_title);
final TextView text = (TextView) view.findViewById(R.id.split_interval_text);
final ImageView img = (ImageView) view.findViewById(R.id.split_interval_arrow);
boolean nightMode = !app.getSettings().isLightContent();
int colorId;
final List<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
colorId = ColorUtilities.getPrimaryTextColorId(nightMode);
} else {
colorId = ColorUtilities.getSecondaryTextColorId(nightMode);
}
int color = app.getResources().getColor(colorId);
title.setTextColor(color);
String titleText = getString(R.string.gpx_split_interval);
title.setText(getString(R.string.ltr_or_rtl_combine_via_colon, titleText, ""));
text.setTextColor(color);
img.setImageDrawable(ic.getIcon(R.drawable.ic_action_arrow_drop_down, colorId));
}
Aggregations