Android Open Source - EdmontonWifi Construction Array Adapter






From Project

Back to project page EdmontonWifi.

License

The source code is released under:

MIT License

If you think the Android project EdmontonWifi 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 hey.rich.edmontonwifi.adapters;
//from w w  w.j  a  v a2 s  .  co  m
import android.app.Activity;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

import hey.rich.edmontonwifi.Objects.Construction;
import hey.rich.edmontonwifi.R;

/**
 * Created by chris on 17/08/14.
 */
public class ConstructionArrayAdapter extends ArrayAdapter<Construction>{
    private final Activity context;
    private final List<Construction> values;

    public ConstructionArrayAdapter(Activity context, List<Construction> values){
        super(context, R.layout.construction_list_view, values);
        this.context = context;
        this.values = values;
    }

    static class ViewHolder{
        public TextView location, distance, asset;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        View rowView = convertView;

        if(rowView == null){
            LayoutInflater inflater = context.getLayoutInflater();
            rowView = inflater.inflate(R.layout.construction_list_view, null);

            ViewHolder v = new ViewHolder();
            v.location = (TextView) rowView.findViewById(R.id.construction_list_location);
            v.distance = (TextView) rowView.findViewById(R.id.construction_list_distance);
            v.asset = (TextView) rowView.findViewById(R.id.construction_list_asset);
            rowView.setTag(v);
        }

        ViewHolder holder = (ViewHolder) rowView.getTag();
        Construction construction = values.get(position);
        holder.location.setText(construction.getAddress());
        holder.distance.setText(Construction.getDistanceString(construction));
        holder.asset.setText(construction.getAsset().toString());

        return rowView;
    }
}




Java Source Code List

hey.rich.edmontonwifi.EdmontonWifi.java
hey.rich.edmontonwifi.Objects.ConstructionList.java
hey.rich.edmontonwifi.Objects.Construction.java
hey.rich.edmontonwifi.Objects.Data.java
hey.rich.edmontonwifi.Objects.WifiList.java
hey.rich.edmontonwifi.Objects.Wifi.java
hey.rich.edmontonwifi.activities.ConstructionViewActivity.java
hey.rich.edmontonwifi.activities.MainActivity.java
hey.rich.edmontonwifi.activities.SearchActivity.java
hey.rich.edmontonwifi.activities.WifiViewActivity.java
hey.rich.edmontonwifi.adapters.ConstructionArrayAdapter.java
hey.rich.edmontonwifi.adapters.WifiArrayAdapter.java
hey.rich.edmontonwifi.fragments.ClearSearchHistoryDialogFragment.java
hey.rich.edmontonwifi.fragments.ConstructionFragment.java
hey.rich.edmontonwifi.fragments.NavigationDrawerFragment.java
hey.rich.edmontonwifi.fragments.SettingsFragment.java
hey.rich.edmontonwifi.fragments.WifiFragment.java
hey.rich.edmontonwifi.utils.JsonReader.java
hey.rich.edmontonwifi.utils.Sorters.java
hey.rich.edmontonwifi.utils.WifiSearchRecentSuggestionsProvider.java