Android Open Source - Bussan Bus Stop Adapter






From Project

Back to project page Bussan.

License

The source code is released under:

Copyright 2011 Kristian Bendiksen. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project Bussan listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package no.kriben.bussan;
/*from  ww  w.  j a  v  a 2  s.  c o m*/
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import no.kriben.busstopstrondheim.model.BusStop;

public class BusStopAdapter extends ArrayAdapter<BusStop> implements BusStopArrayAdapter {
    public BusStopAdapter(Context context,
                          int resource,
                          int textViewResourceId,
                          List<BusStop> objects) {
        super(context, resource, textViewResourceId, objects);
    }

    public BusStopAdapter(Context context,
            int resource,
            int textViewResourceId) {
        super(context, resource, textViewResourceId);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        BusStop busStop = getBusStop(position);
        LayoutInflater mInflater = (LayoutInflater) getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        convertView = mInflater.inflate(R.layout.bus_stop_list_item, null);
        ViewHolder holder = new ViewHolder(convertView);
        convertView.setTag(holder);

        holder = (ViewHolder) convertView.getTag();
        TextView title = holder.getTitle();
        title.setText(BusStopNameFormatter.format(getContext(), busStop));

        return convertView;
    }


    @Override
    public BusStop getBusStop(int position) {
        return getItem(position);
    }

    private class ViewHolder {
        private View row_;
        private TextView title_ = null;

        public ViewHolder(View row) {
            row_ = row;
        }

        public TextView getTitle() {
            if (title_ == null){
                title_ = (TextView) row_.findViewById(R.id.busstop_name);
            }
            return title_;
        }
    }
}




Java Source Code List

no.kriben.bussan.AndroidFileStringCache.java
no.kriben.bussan.BusDepartureDetailActivity.java
no.kriben.bussan.BusStopAdapter.java
no.kriben.bussan.BusStopArrayAdapter.java
no.kriben.bussan.BusStopListActivity.java
no.kriben.bussan.BusStopMenuHandler.java
no.kriben.bussan.BusStopNameFormatter.java
no.kriben.bussan.BusStopWithDistance.java
no.kriben.bussan.BussanApplication.java
no.kriben.bussan.BussanAsyncTask.java
no.kriben.bussan.ConnectivityChecker.java
no.kriben.bussan.FindBusStopByDistanceActivity.java
no.kriben.bussan.FindBusStopByNameActivity.java
no.kriben.bussan.FrontpageActivity.java
no.kriben.bussan.PreferencesUtil.java
no.kriben.bussan.RealTimeActivity.java