diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java index cc10e542ba..646e2da386 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java @@ -1,7 +1,6 @@ package net.osmand.plus.routepreparationmenu.cards; import android.graphics.drawable.ColorDrawable; -import android.opengl.Visibility; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; @@ -17,6 +16,7 @@ import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; import net.osmand.plus.helpers.TrackSelectSegmentAdapter; @@ -24,7 +24,6 @@ import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder; import net.osmand.util.Algorithms; import java.io.File; -import java.util.ArrayList; import java.util.List; public class TrackEditCard extends BaseCard { @@ -87,20 +86,19 @@ public class TrackEditCard extends BaseCard { TextView distanceView = view.findViewById(R.id.distance); TextView timeView = view.findViewById(R.id.time); ImageView timeIcon = view.findViewById(R.id.time_icon); - TextView pointsView = view.findViewById(R.id.points_count); - ImageView pointsIcon = view.findViewById(R.id.points_icon); - pointsView.setVisibility(View.GONE); - pointsIcon.setVisibility(View.GONE); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false); List segments = gpxFile.getNonEmptyTrkSegments(false); GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); double distance = TrackSelectSegmentAdapter.getDistance(segment); long time = TrackSelectSegmentAdapter.getSegmentTime(segment); - if (time != 1) { - timeView.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000))); - } else { - timeIcon.setVisibility(View.GONE); - timeView.setText(""); + boolean timeAvailable = time != 1; + if (timeAvailable) { + timeView.setText(Algorithms.formatDuration((int) (time / 1000), + app.accessibilityEnabled())); } + AndroidUiHelper.updateVisibility(timeView, timeAvailable); + AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java b/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java index cc60c4f057..28bde3ffed 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackSelectSegmentBottomSheet.java @@ -30,6 +30,7 @@ import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.TrackSelectSegmentAdapter; import net.osmand.plus.helpers.TrackSelectSegmentAdapter.OnItemClickListener; @@ -94,13 +95,13 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment pointsCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); pointsCount.setText(String.valueOf(analysis.wptPoints)); time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); - if (analysis.isTimeSpecified()) { + boolean timeAvailable = analysis.timeSpan != 1; + if (timeAvailable) { time.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled())); - } else { - time.setText(""); - timeIcon.setVisibility(View.GONE); } + AndroidUiHelper.updateVisibility(time, timeAvailable); + AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));