33
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
// 显示时间的adapter类
|
||||
public class MeetingTimeAdapter extends BaseAdapter {
|
||||
private ArrayList<String> list;
|
||||
private int position;
|
||||
|
||||
public MeetingTimeAdapter(ArrayList<String> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return list.get(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int arg0, View arg1, ViewGroup arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder viewHolder;
|
||||
if (arg1 == null) {
|
||||
viewHolder = new ViewHolder();
|
||||
arg1 = UIUtils.inflate(R.layout.item_meeting_time);
|
||||
viewHolder.tv_time = (TextView) arg1.findViewById(R.id.tv_time);
|
||||
viewHolder. v_line = (View) arg1.findViewById(R.id.v_line);
|
||||
viewHolder. iv_time = (ImageView) arg1.findViewById(R.id.iv_time);
|
||||
arg1.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) arg1.getTag();
|
||||
}
|
||||
|
||||
viewHolder.tv_time.setText(list.get(arg0).toString());
|
||||
if (position==arg0) {
|
||||
viewHolder.iv_time.setVisibility(View.VISIBLE);
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.top_title));
|
||||
viewHolder.tv_time.setTextColor(UIUtils.getColor(R.color.top_title));
|
||||
}else{
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.devider_line));
|
||||
viewHolder.tv_time.setTextColor(UIUtils.getColor(R.color.tab_text_nor));
|
||||
viewHolder.iv_time.setVisibility(View.GONE);
|
||||
}
|
||||
return arg1;
|
||||
}
|
||||
|
||||
class ViewHolder{
|
||||
TextView tv_time;
|
||||
View v_line;
|
||||
ImageView iv_time;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user