Minor UI fixes

This commit is contained in:
androiddevkotlin 2021-02-12 12:14:03 +02:00
parent 3d92a46df6
commit 51c8222447
2 changed files with 12 additions and 3 deletions

View file

@ -56,7 +56,11 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackSelectS
double distance = getDistance(segment); double distance = getDistance(segment);
long time = getSegmentTime(segment); long time = getSegmentTime(segment);
if (time != 1) {
holder.time.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000))); holder.time.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000)));
} else {
holder.time.setText("");
}
holder.distance.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); holder.distance.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -6,6 +6,7 @@ import android.os.Bundle;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -20,7 +21,6 @@ import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities; import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -43,7 +43,6 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment
public static final String TAG = TrackSelectSegmentBottomSheet.class.getSimpleName(); public static final String TAG = TrackSelectSegmentBottomSheet.class.getSimpleName();
protected TrackSelectSegmentAdapter adapterSegments; protected TrackSelectSegmentAdapter adapterSegments;
private GpxSelectionHelper.SelectedGpxFile selectedFile;
private MapActivity mapActivity; private MapActivity mapActivity;
private GPXUtilities.GPXFile gpxFile; private GPXUtilities.GPXFile gpxFile;
private OsmandApplication app; private OsmandApplication app;
@ -89,7 +88,10 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment
AppCompatImageView icon = gpxTrackContainer.findViewById(R.id.icon); AppCompatImageView icon = gpxTrackContainer.findViewById(R.id.icon);
int sidePadding = AndroidUtils.dpToPx(mapActivity, 16f); int sidePadding = AndroidUtils.dpToPx(mapActivity, 16f);
int bottomTopPadding = AndroidUtils.dpToPx(mapActivity, 2f);
LinearLayout readContainer = gpxTrackContainer.findViewById(R.id.read_section);
readContainer.setPadding(0, bottomTopPadding, 0, bottomTopPadding);
TextView name = gpxTrackContainer.findViewById(R.id.name); TextView name = gpxTrackContainer.findViewById(R.id.name);
TextView description = itemView.findViewById(R.id.description); TextView description = itemView.findViewById(R.id.description);
TextView distance = gpxTrackContainer.findViewById(R.id.distance); TextView distance = gpxTrackContainer.findViewById(R.id.distance);
@ -102,8 +104,11 @@ public class TrackSelectSegmentBottomSheet extends MenuBottomSheetDialogFragment
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_polygom_dark)); icon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_polygom_dark));
name.setText(titleGpxTrack); name.setText(titleGpxTrack);
description.setText(gpxTrackName); description.setText(gpxTrackName);
distance.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
distance.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); distance.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app));
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.setText(analysis.isTimeSpecified() ? Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()) : ""); time.setText(analysis.isTimeSpecified() ? Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()) : "");
final RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list); final RecyclerView recyclerView = itemView.findViewById(R.id.gpx_segment_list);