Fix split card visibility
This commit is contained in:
parent
0f89e927e0
commit
30a7ebcb30
2 changed files with 16 additions and 10 deletions
|
@ -15,7 +15,6 @@ import com.google.android.material.slider.Slider;
|
|||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -30,6 +29,7 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
|||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -310,17 +310,11 @@ public class SplitIntervalBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
|
||||
@NonNull
|
||||
public List<GpxDisplayGroup> getDisplayGroups() {
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof TrackAppearanceFragment) {
|
||||
List<GpxDisplayGroup> result = ((TrackAppearanceFragment) target).getGpxDisplayGroups();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
if (GpxDisplayItemType.TRACK_SEGMENT == group.getType()) {
|
||||
groups.add(group);
|
||||
return ((TrackAppearanceFragment) target).getDisplaySegmentGroups();
|
||||
}
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static void showInstance(@NonNull FragmentManager fragmentManager, TrackDrawInfo trackDrawInfo, Fragment target) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.data.QuadRect;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -544,7 +545,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
ViewGroup cardsContainer = getCardsContainer();
|
||||
cardsContainer.removeAllViews();
|
||||
|
||||
if (!selectedGpxFile.isShowCurrentTrack()) {
|
||||
if (!selectedGpxFile.isShowCurrentTrack() && !Algorithms.isEmpty(getDisplaySegmentGroups())) {
|
||||
splitIntervalCard = new SplitIntervalCard(mapActivity, trackDrawInfo);
|
||||
splitIntervalCard.setListener(this);
|
||||
cardsContainer.addView(splitIntervalCard.build(mapActivity));
|
||||
|
@ -579,6 +580,17 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
return displayGroups;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<GpxDisplayGroup> getDisplaySegmentGroups() {
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : getGpxDisplayGroups()) {
|
||||
if (GpxDisplayItemType.TRACK_SEGMENT == group.getType()) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void dismissImmediate() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
|
Loading…
Reference in a new issue