Ejemplo n.º 1
0
    @Override
    public View getView(final int position, View convertView, final ViewGroup parent) {
      if (convertView == null) {
        final LayoutInflater inflater = ((Activity) context).getLayoutInflater();
        convertView = inflater.inflate(R.layout.map_filter_item, parent, false);
      }

      final TextView titleTextView = (TextView) convertView.findViewById(android.R.id.title);
      final TextView summaryTextView = (TextView) convertView.findViewById(android.R.id.summary);

      final RadioButton checkedTextView = (RadioButton) convertView.findViewById(R.id.radiobutton);

      // /

      final MapListEntry entry = (MapListEntry) getItem(position);

      // /

      titleTextView.setText(entry.getTitle());
      summaryTextView.setText(entry.getSummary());

      checkedTextView.setChecked(entry.isChecked());

      return convertView;
    }
Ejemplo n.º 2
0
  @Override
  public void onItemClick(
      final AdapterView<?> parent, final View view, final int position, final long id) {

    final SectionListAdapter sectionListAdapter = (SectionListAdapter) parent.getAdapter();

    final MapListSectionAdapter mapListSectionAdapter =
        (MapListSectionAdapter) sectionListAdapter.getAdapter(position);

    // /
    final Object item = sectionListAdapter.getItem(position);
    if (item instanceof MapListEntry) {
      final MapListEntry clickedEntry = (MapListEntry) item;

      final List<MapListEntry> mapListEntryList =
          mapListSectionAdapter.mapListSection.getMapListEntryList();

      // uncheck all entries in section:
      for (final MapListEntry mapListEntry : mapListEntryList) mapListEntry.setChecked(false);

      // recheck checked entry:
      clickedEntry.setChecked(true);

      // handle sat differently
      final String value = clickedEntry.getValue();
      final RMBTMainActivity activity = getRMBTMainActivity();
      if (MapProperties.MAP_SAT_KEY.equals(clickedEntry.getKey()))
        activity.setMapTypeSatellite(MapProperties.MAP_SAT_VALUE.equals(value));
      else if (MapProperties.MAP_OVERLAY_KEY.equals(clickedEntry.getKey())) {
        if (MapProperties.MAP_AUTO_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_AUTO);
        else if (MapProperties.MAP_HEATMAP_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_HEATMAP);
        else if (MapProperties.MAP_POINTS_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_POINTS);
        else if (MapProperties.MAP_SHAPES_VALUE.equals(value))
          activity.setMapOverlayType(MapProperties.MAP_OVERLAY_TYPE_SHAPES);
      } else
        // set new filter options:
        activity.updateMapFilter();

      // reload list view:
      ((SectionListAdapter) parent.getAdapter()).notifyDataSetChanged();
    }
  }
Ejemplo n.º 3
0
  /** @return */
  public MapListEntry getCheckedMapListEntry() {

    for (final MapListEntry entry : mapListEntryList) if (entry.isChecked()) return entry;

    return null;
  }
Ejemplo n.º 4
0
  /** @param mapListEntryList */
  public void setMapListEntryList(final List<MapListEntry> mapListEntryList) {
    this.mapListEntryList = mapListEntryList;

    for (final MapListEntry entry : mapListEntryList) entry.setSection(this);
  }