Fix of possible bugs
This commit is contained in:
parent
5081ffd41d
commit
7d8886f757
2 changed files with 9 additions and 7 deletions
|
@ -28,7 +28,6 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
|||
private final UiUtilities iconsCache;
|
||||
private final List<TrkSegment> segments;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
private ImageView timeIcon;
|
||||
|
||||
public TrackSelectSegmentAdapter(Context ctx, List<TrkSegment> segments) {
|
||||
app = (OsmandApplication) ctx.getApplicationContext();
|
||||
|
@ -43,7 +42,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
|||
View view = themedInflater.inflate(R.layout.gpx_segment_list_item, parent, false);
|
||||
ImageView distanceIcon = view.findViewById(R.id.distance_icon);
|
||||
distanceIcon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_split_interval));
|
||||
timeIcon = view.findViewById(R.id.time_icon);
|
||||
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
||||
timeIcon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_time_moving_16));
|
||||
return new TrackViewHolder(view);
|
||||
}
|
||||
|
@ -60,9 +59,10 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
|||
double distance = getDistance(segment);
|
||||
long time = getSegmentTime(segment);
|
||||
if (time != 1) {
|
||||
holder.timeIcon.setVisibility(View.VISIBLE);
|
||||
holder.time.setText(OsmAndFormatter.getFormattedDurationShort((int) (time / 1000)));
|
||||
} else {
|
||||
timeIcon.setVisibility(View.GONE);
|
||||
holder.timeIcon.setVisibility(View.GONE);
|
||||
holder.time.setText("");
|
||||
}
|
||||
holder.distance.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
||||
|
@ -121,6 +121,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
|||
static class TrackViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView iconSegment;
|
||||
ImageView timeIcon;
|
||||
TextView name;
|
||||
TextView distance;
|
||||
TextView time;
|
||||
|
@ -128,6 +129,7 @@ public class TrackSelectSegmentAdapter extends RecyclerView.Adapter<TrackViewHol
|
|||
TrackViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
iconSegment = itemView.findViewById(R.id.icon);
|
||||
timeIcon = itemView.findViewById(R.id.time_icon);
|
||||
name = itemView.findViewById(R.id.name);
|
||||
distance = itemView.findViewById(R.id.distance);
|
||||
time = itemView.findViewById(R.id.time_interval);
|
||||
|
|
Loading…
Reference in a new issue