RecordListAdapter.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package de.tudarmstadt.informatik.hostage.ui2.adapter;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.List;
  5. import android.content.Context;
  6. import android.view.View;
  7. import android.widget.TextView;
  8. import de.tudarmstadt.informatik.hostage.R;
  9. import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
  10. public class RecordListAdapter extends ExpandableListAdapter {
  11. public RecordListAdapter(Context context, List<String> listSectionHeaders, HashMap<String, ArrayList<ExpandableListItem>> dataMapping) {
  12. super(context, listSectionHeaders, dataMapping);
  13. }
  14. /*****************************
  15. *
  16. * Required Methods
  17. *
  18. * ***************************/
  19. @Override
  20. public void configureCellView(View cell, int section, int row) {
  21. ExpandableListItem object = this.getDataForRow(section, row);
  22. for (String key : object.getId_Mapping().keySet()){
  23. int viewID = object.getId_Mapping().get(key);
  24. String textualInfo = object.getData().get(key);
  25. TextView tView = (TextView) cell.findViewById(viewID);
  26. tView.setText(textualInfo);
  27. }
  28. }
  29. @Override
  30. public void configureSectionHeaderView(View sectionHeader, int section) {
  31. int headerLabelID = R.id.sectionHeaderTitle;
  32. TextView tView = (TextView) sectionHeader.findViewById(headerLabelID);
  33. tView.setText(this._sectionHeader.get(section));
  34. }
  35. @Override
  36. public int getSectionLayoutID() {
  37. return R.layout.expandable_section_header;
  38. }
  39. @Override
  40. public int getCellLayoutID() {
  41. return R.layout.record_list_item;
  42. }
  43. }