DT @22.11.2015: Deleted old reportListAdapter
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
package org.deke.risk.riskahead.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.deke.risk.riskahead.R;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReportListAdapter extends BaseAdapter {
|
||||
|
||||
Context context;
|
||||
List<JSONObject> data;
|
||||
|
||||
private static LayoutInflater inflater = null;
|
||||
|
||||
public ReportListAdapter(Context context, List<JSONObject> data) {
|
||||
this.context = context;
|
||||
this.data = data;
|
||||
inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return data.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View vi = convertView;
|
||||
if (vi == null) vi = inflater.inflate(R.layout.activity_reportlist_lvrow, null);
|
||||
|
||||
TextView itemText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_text);
|
||||
TextView titleText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_title);
|
||||
TextView categoryText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_category);
|
||||
LinearLayout ll = (LinearLayout) vi.findViewById(R.id.lay_reportlist_color);
|
||||
|
||||
try {
|
||||
itemText.setText(data.get(position).getString("text_long"));
|
||||
titleText.setText(data.get(position).getString("created_at")+" : "+data.get(position).getString("text_short"));
|
||||
categoryText.setText(data.get(position).getString("cat_name"));
|
||||
titleText.setTypeface(null, Typeface.BOLD);
|
||||
ll.setBackgroundColor(Color.parseColor("#" + data.get(position).getString("color")));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return vi;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user