Back to project page ShareManager.
The source code is released under:
Copyright (c) 2013, Nelspike All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Red...
If you think the Android project ShareManager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package share.manager.adapters; //from ww w. java2 s . co m import share.manager.stock.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class CompanyAdapter extends ArrayAdapter<String> { private String[] strings, regions, changes; private boolean[] status; private Context context; public CompanyAdapter(Context context, int textViewResourceId, String[] objects, String[] regions, boolean[] status, String[] changes) { super(context, textViewResourceId, objects); this.context = context; this.strings = objects; this.regions = regions; this.status = status; this.changes = changes; // x% (absolute value) } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } @Override public View getView(int position, View convertView, ViewGroup parent) { return getCustomView(position, convertView, parent); } public View getCustomView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.company_box, parent, false); TextView label = (TextView) row.findViewById(R.id.company_name_box); label.setText(strings[position]); TextView labelRegion = (TextView) row.findViewById(R.id.company_region_box); labelRegion.setText(regions[position]); ImageView arrow = (ImageView) row.findViewById(R.id.company_arrow_box); if (status != null) { if (status[position]) arrow.setImageDrawable(context.getResources() .getDrawable(R.drawable.upper_arrow)); else { arrow.setImageDrawable(context.getResources().getDrawable( R.drawable.down_arrow)); } } if (changes != null) { TextView labelChange = (TextView) row .findViewById(R.id.company_change_box); labelChange.setText(changes[position]); } return row; } }