コード例 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.list_view_recording_item, parent, false);

    long songLength = Math.max(song.getDuration(), songDuration);

    RecordingView recordingView = (RecordingView) rowView.findViewById(R.id.recordingViewItem);
    Recording recording = song.getRecordings().get(position);
    Set<String> correctlyPlayed = null;
    if (referentSong != null) {
      correctlyPlayed = new HashSet<String>();
      for (PlayingSound playingSound : recording.getPlayingSounds()) {
        if (contains(referentSong, playingSound)) {
          correctlyPlayed.add(playingSound.getSoundId());
        }
      }
    }
    recordingView.setContent(
        songLength, recording.getPlayingSounds(), correctlyPlayed, soundConfiguration);
    TextView textView = (TextView) rowView.findViewById(R.id.textViewItem);
    textView.setText(recording.getName());

    // here add other content in a recording row. option for delete, volume, edit etc

    return rowView;
  }