use of net.osmand.plus.track.cards.GpxInfoCard in project Osmand by osmandapp.
the class TrackMenuFragment method setupCards.
private void setupCards() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
ViewGroup cardsContainer = getCardsContainer();
cardsContainer.removeAllViews();
if (menuType == TrackMenuType.TRACK) {
if (segmentsCard != null && segmentsCard.getView() != null) {
reattachCard(cardsContainer, segmentsCard);
} else {
segmentsCard = new SegmentsCard(mapActivity, displayHelper, gpxPoint, selectedGpxFile, this);
segmentsCard.setListener(this);
cardsContainer.addView(segmentsCard.build(mapActivity));
}
} else if (menuType == TrackMenuType.OPTIONS) {
if (optionsCard != null && optionsCard.getView() != null) {
reattachCard(cardsContainer, optionsCard);
} else {
optionsCard = new OptionsCard(mapActivity, displayHelper, selectedGpxFile);
optionsCard.setListener(this);
cardsContainer.addView(optionsCard.build(mapActivity));
}
} else if (menuType == TrackMenuType.OVERVIEW) {
if (overviewCard != null && overviewCard.getView() != null) {
reattachCard(cardsContainer, overviewCard);
} else {
overviewCard = new OverviewCard(mapActivity, this, selectedGpxFile, analyses, this);
overviewCard.setListener(this);
cardsContainer.addView(overviewCard.build(mapActivity));
if (isCurrentRecordingTrack()) {
overviewCard.getBlockStatisticsBuilder().runUpdatingStatBlocksIfNeeded();
}
}
if (descriptionCard != null && descriptionCard.getView() != null) {
reattachCard(cardsContainer, descriptionCard);
} else {
descriptionCard = new DescriptionCard(getMapActivity(), this, displayHelper.getGpx());
cardsContainer.addView(descriptionCard.build(mapActivity));
}
if (gpxInfoCard != null && gpxInfoCard.getView() != null) {
reattachCard(cardsContainer, gpxInfoCard);
} else {
gpxInfoCard = new GpxInfoCard(getMapActivity(), displayHelper.getGpx());
cardsContainer.addView(gpxInfoCard.build(mapActivity));
}
} else if (menuType == TrackMenuType.POINTS) {
if (pointsCard != null && pointsCard.getView() != null) {
reattachCard(cardsContainer, pointsCard);
} else {
pointsCard = new TrackPointsCard(mapActivity, displayHelper, selectedGpxFile);
pointsCard.setListener(this);
cardsContainer.addView(pointsCard.build(mapActivity));
}
}
}
}
Aggregations