Search in sources :

Example 1 with StepViewHolder

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;
}
Also used : IStep(cl.smartcities.isci.transportinspector.router.transappStep.IStep) StepViewHolder(cl.smartcities.isci.transportinspector.router.transappStep.StepViewHolder) View(android.view.View) NonNull(android.support.annotation.NonNull)

Aggregations

NonNull (android.support.annotation.NonNull)1 View (android.view.View)1 IStep (cl.smartcities.isci.transportinspector.router.transappStep.IStep)1 StepViewHolder (cl.smartcities.isci.transportinspector.router.transappStep.StepViewHolder)1