Search in sources :

Example 1 with DescriptionCard

use of net.osmand.plus.track.cards.DescriptionCard 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));
            }
        }
    }
}
Also used : OptionsCard(net.osmand.plus.track.cards.OptionsCard) DescriptionCard(net.osmand.plus.track.cards.DescriptionCard) ViewGroup(android.view.ViewGroup) OverviewCard(net.osmand.plus.track.cards.OverviewCard) SegmentsCard(net.osmand.plus.track.cards.SegmentsCard) GpxInfoCard(net.osmand.plus.track.cards.GpxInfoCard) TrackPointsCard(net.osmand.plus.track.cards.TrackPointsCard) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

ViewGroup (android.view.ViewGroup)1 MapActivity (net.osmand.plus.activities.MapActivity)1 DescriptionCard (net.osmand.plus.track.cards.DescriptionCard)1 GpxInfoCard (net.osmand.plus.track.cards.GpxInfoCard)1 OptionsCard (net.osmand.plus.track.cards.OptionsCard)1 OverviewCard (net.osmand.plus.track.cards.OverviewCard)1 SegmentsCard (net.osmand.plus.track.cards.SegmentsCard)1 TrackPointsCard (net.osmand.plus.track.cards.TrackPointsCard)1