use of cl.smartcities.isci.transportinspector.router.transappStep.StepViewHolder in project androidApp by InspectorIncognito.
the class StepAdapter method getView.
@NonNull
public View getView(final int position, View convertView, @NonNull final ViewGroup parent) {
final StepViewHolder holder;
/* set view */
if (convertView == null) {
convertView = inflater.inflate(R.layout.router_step, parent, false);
holder = new StepViewHolder();
/* initialize holder */
holder.icon = convertView.findViewById(R.id.image_icon);
holder.title = convertView.findViewById(R.id.title);
holder.subtitle = convertView.findViewById(R.id.subtitle);
holder.time = convertView.findViewById(R.id.remaining_time);
holder.topLine = convertView.findViewById(R.id.top_line);
holder.bottomLine = convertView.findViewById(R.id.bottom_line);
holder.busIcon = convertView.findViewById(R.id.bus_icon);
holder.busService = convertView.findViewById(R.id.bus_service);
holder.stepTimeWalking = convertView.findViewById(R.id.walking_step_time);
holder.stepTimeBus = convertView.findViewById(R.id.bus_step_time);
holder.stepTimeMetro = convertView.findViewById(R.id.metro_step_time);
holder.walkingLayout = convertView.findViewById(R.id.layout_walking);
holder.busLayout = convertView.findViewById(R.id.layout_bus);
holder.metroLayout = convertView.findViewById(R.id.layout_metro);
holder.title.setTypeface(robotoBold);
holder.subtitle.setTypeface(robotoBold);
holder.time.setTypeface(robotoBold);
holder.busService.setTypeface(robotoBold);
holder.stepTimeWalking.setTypeface(robotoRegular);
holder.stepTimeBus.setTypeface(robotoRegular);
holder.stepTimeMetro.setTypeface(robotoRegular);
holder.row = convertView;
convertView.setTag(holder);
} else {
holder = (StepViewHolder) convertView.getTag();
}
final IStep step = items.get(position);
holder.busLayout.setVisibility(View.GONE);
holder.walkingLayout.setVisibility(View.GONE);
holder.metroLayout.setVisibility(View.GONE);
step.setHolder(convertView.getContext(), holder);
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(step);
}
});
holder.row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(step);
}
});
return convertView;
}
Aggregations