commit
1dd956ba38
5 changed files with 29 additions and 13 deletions
|
@ -49,7 +49,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull final TrackViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull final TrackViewHolder holder, int position) {
|
||||||
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_split_interval));
|
holder.iconSegment.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_split_interval));
|
||||||
|
|
||||||
TrkSegment segment = segments.get(position);
|
TrkSegment segment = segments.get(position);
|
||||||
|
|
||||||
|
@ -59,8 +59,10 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
||||||
double distance = getDistance(segment);
|
double distance = getDistance(segment);
|
||||||
long time = getSegmentTime(segment);
|
long time = getSegmentTime(segment);
|
||||||
if (time != 1) {
|
if (time != 1) {
|
||||||
|
holder.timeIcon.setVisibility(View.VISIBLE);
|
||||||
holder.time.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000)));
|
holder.time.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000)));
|
||||||
} else {
|
} else {
|
||||||
|
holder.timeIcon.setVisibility(View.GONE);
|
||||||
holder.time.setText("");
|
holder.time.setText("");
|
||||||
}
|
}
|
||||||
holder.distance.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
holder.distance.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
||||||
|
@ -118,14 +120,16 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
||||||
|
|
||||||
static class TrackViewHolder extends RecyclerView.ViewHolder {
|
static class TrackViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
ImageView icon;
|
ImageView iconSegment;
|
||||||
|
ImageView timeIcon;
|
||||||
TextView name;
|
TextView name;
|
||||||
TextView distance;
|
TextView distance;
|
||||||
TextView time;
|
TextView time;
|
||||||
|
|
||||||
TrackViewHolder(View itemView) {
|
TrackViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
icon = itemView.findViewById(R.id.icon);
|
iconSegment = itemView.findViewById(R.id.icon);
|
||||||
|
timeIcon = itemView.findViewById(R.id.time_icon);
|
||||||
name = itemView.findViewById(R.id.name);
|
name = itemView.findViewById(R.id.name);
|
||||||
distance = itemView.findViewById(R.id.distance);
|
distance = itemView.findViewById(R.id.distance);
|
||||||
time = itemView.findViewById(R.id.time_interval);
|
time = itemView.findViewById(R.id.time_interval);
|
||||||
|
|
|
@ -719,11 +719,11 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) {
|
public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) {
|
||||||
|
app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment);
|
||||||
selectTrackToFollow(gpxFile);
|
selectTrackToFollow(gpxFile);
|
||||||
GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
|
GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
|
||||||
if (paramsBuilder != null) {
|
if (paramsBuilder != null) {
|
||||||
paramsBuilder.setSelectedSegment(selectedSegment);
|
paramsBuilder.setSelectedSegment(selectedSegment);
|
||||||
app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment);
|
|
||||||
app.getRoutingHelper().onSettingsChanged(true);
|
app.getRoutingHelper().onSettingsChanged(true);
|
||||||
}
|
}
|
||||||
updateSelectionMode(false);
|
updateSelectionMode(false);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.routepreparationmenu.cards;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
||||||
import net.osmand.plus.helpers.TrackSelectSegmentAdapter;
|
import net.osmand.plus.helpers.TrackSelectSegmentAdapter;
|
||||||
|
@ -83,19 +85,21 @@ public class TrackEditCard extends BaseCard {
|
||||||
if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) {
|
if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) {
|
||||||
TextView distanceView = view.findViewById(R.id.distance);
|
TextView distanceView = view.findViewById(R.id.distance);
|
||||||
TextView timeView = view.findViewById(R.id.time);
|
TextView timeView = view.findViewById(R.id.time);
|
||||||
TextView pointsView = view.findViewById(R.id.points_count);
|
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
||||||
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false);
|
||||||
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false);
|
||||||
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
||||||
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
||||||
int point = segment.points.size();
|
|
||||||
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
||||||
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
||||||
if (time != 1) {
|
boolean timeAvailable = time != 1;
|
||||||
timeView.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000)));
|
if (timeAvailable) {
|
||||||
} else {
|
timeView.setText(Algorithms.formatDuration((int) (time / 1000),
|
||||||
timeView.setText("");
|
app.accessibilityEnabled()));
|
||||||
}
|
}
|
||||||
|
AndroidUiHelper.updateVisibility(timeView, timeAvailable);
|
||||||
|
AndroidUiHelper.updateVisibility(timeIcon, timeAvailable);
|
||||||
distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
||||||
pointsView.setText(String.valueOf(point));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton editButton = view.findViewById(R.id.show_on_map);
|
ImageButton editButton = view.findViewById(R.id.show_on_map);
|
||||||
|
|
|
@ -1090,10 +1090,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) {
|
public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) {
|
||||||
|
app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment);
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
startNavigationForGPX(gpxFile, mapActivity.getMapActions());
|
startNavigationForGPX(gpxFile, mapActivity.getMapActions());
|
||||||
app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment);
|
|
||||||
RouteProvider.GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
|
RouteProvider.GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute();
|
||||||
if (paramsBuilder != null) {
|
if (paramsBuilder != null) {
|
||||||
paramsBuilder.setSelectedSegment(selectedSegment);
|
paramsBuilder.setSelectedSegment(selectedSegment);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.helpers.TrackSelectSegmentAdapter;
|
import net.osmand.plus.helpers.TrackSelectSegmentAdapter;
|
||||||
import net.osmand.plus.helpers.TrackSelectSegmentAdapter.OnItemClickListener;
|
import net.osmand.plus.helpers.TrackSelectSegmentAdapter.OnItemClickListener;
|
||||||
|
@ -81,6 +82,7 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
TextView distance = gpxTrackContainer.findViewById(R.id.distance);
|
TextView distance = gpxTrackContainer.findViewById(R.id.distance);
|
||||||
TextView pointsCount = gpxTrackContainer.findViewById(R.id.points_count);
|
TextView pointsCount = gpxTrackContainer.findViewById(R.id.points_count);
|
||||||
TextView time = gpxTrackContainer.findViewById(R.id.time);
|
TextView time = gpxTrackContainer.findViewById(R.id.time);
|
||||||
|
ImageView timeIcon = gpxTrackContainer.findViewById(R.id.time_icon);
|
||||||
LinearLayout container = gpxTrackContainer.findViewById(R.id.container);
|
LinearLayout container = gpxTrackContainer.findViewById(R.id.container);
|
||||||
LinearLayout containerNameAndReadSection = gpxTrackContainer.findViewById(R.id.name_and_read_section_container);
|
LinearLayout containerNameAndReadSection = gpxTrackContainer.findViewById(R.id.name_and_read_section_container);
|
||||||
container.setPadding(sidePadding, 0, 0, 0);
|
container.setPadding(sidePadding, 0, 0, 0);
|
||||||
|
@ -93,7 +95,13 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
pointsCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
|
pointsCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
|
||||||
pointsCount.setText(String.valueOf(analysis.wptPoints));
|
pointsCount.setText(String.valueOf(analysis.wptPoints));
|
||||||
time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
|
time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
|
||||||
time.setText(analysis.isTimeSpecified() ? Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()) : "");
|
boolean timeSpecified = analysis.isTimeSpecified();
|
||||||
|
if (timeSpecified) {
|
||||||
|
time.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000),
|
||||||
|
app.accessibilityEnabled()));
|
||||||
|
}
|
||||||
|
AndroidUiHelper.updateVisibility(time, timeSpecified);
|
||||||
|
AndroidUiHelper.updateVisibility(timeIcon, timeSpecified);
|
||||||
|
|
||||||
RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list);
|
RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
|
Loading…
Reference in a new issue