private void initViews(View v) {
    typeEdit = (EditText) v.findViewById(R.id.text_edit_type);
    lecturerEdit = (EditText) v.findViewById(R.id.text_edit_lecturer);
    roomEdit = (EditText) v.findViewById(R.id.text_edit_room);
    dateEdit = (EditText) v.findViewById(R.id.text_edit_date);
    startEdit = (EditText) v.findViewById(R.id.text_edit_start);
    endEdit = (EditText) v.findViewById(R.id.text_edit_end);

    typeEdit.setText(event.getType());
    lecturerEdit.setText(event.getLecturer());
    roomEdit.setText(event.getRoom());
    dateEdit.setText(dateFormat.format(event.getEnd()));
    startEdit.setText(timeFormat.format(event.getStart()));
    endEdit.setText(timeFormat.format(event.getEnd()));

    dateEdit.setFocusable(false);
    dateEdit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DatePickerFragment newFragment =
                (DatePickerFragment) DatePickerFragment.newInstance(event.getEnd().getTime());
            newFragment.setOnDateSetListener(
                new DatePickerDialog.OnDateSetListener() {
                  @Override
                  public void onDateSet(
                      DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    Calendar c = Calendar.getInstance(Locale.GERMANY);
                    c.set(Calendar.YEAR, year);
                    c.set(Calendar.MONTH, monthOfYear);
                    c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                    dateEdit.setText(dateFormat.format(c.getTime()));
                  }
                });
            newFragment.show(getSherlockActivity().getSupportFragmentManager(), "timePicker");
          }
        });
    startEdit.setFocusable(false);
    startEdit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            final long dateDiff = event.getEnd().getTime() - event.getStart().getTime();

            TimePickerFragment newFragment =
                (TimePickerFragment) TimePickerFragment.newInstance(event.getStart().getTime());
            newFragment.setOnTimeSetListener(
                new TimePickerDialog.OnTimeSetListener() {
                  @Override
                  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    Calendar c = Calendar.getInstance(Locale.GERMANY);
                    c.set(Calendar.HOUR_OF_DAY, hourOfDay);
                    c.set(Calendar.MINUTE, minute);

                    startEdit.setText(timeFormat.format(c.getTime()));
                    endEdit.setText(timeFormat.format(new Date(c.getTimeInMillis() + dateDiff)));
                  }
                });
            newFragment.show(getSherlockActivity().getSupportFragmentManager(), "startPicker");
          }
        });
    endEdit.setFocusable(false);
    endEdit.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            TimePickerFragment newFragment =
                (TimePickerFragment) TimePickerFragment.newInstance(event.getEnd().getTime());
            newFragment.setOnTimeSetListener(
                new TimePickerDialog.OnTimeSetListener() {
                  @Override
                  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    Calendar c = Calendar.getInstance(Locale.GERMANY);
                    c.set(Calendar.HOUR_OF_DAY, hourOfDay);
                    c.set(Calendar.MINUTE, minute);

                    Date start;
                    Date end;
                    try {
                      end = c.getTime();
                      start = timeFormat.parse(startEdit.getText().toString());
                      if (start.after(end)) {
                        end = start;
                      }
                      endEdit.setText(timeFormat.format(end));
                    } catch (ParseException e) {
                    }
                  }
                });
            newFragment.show(getSherlockActivity().getSupportFragmentManager(), "endPicker");
          }
        });
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    int type = getItemViewType(position);
    if (convertView == null) {
      holder = new ViewHolder();
      switch (type) {
        case TYPE_ITEM:
          convertView = mInflater.inflate(R.layout.fragment_subject_item, null);
          holder.titleView = (TextView) convertView.findViewById(R.id.text_subject_item_title);
          holder.dateView = (TextView) convertView.findViewById(R.id.text_subject_item_time);
          holder.roomView = (TextView) convertView.findViewById(R.id.text_subject_item_room);

          if (position % 2 == 0) {
            convertView.setBackgroundColor(
                context.getResources().getColor(R.color.abs__background_holo_dark));
          } else {
            convertView.setBackgroundColor(
                context.getResources().getColor(R.color.abs__background_holo_light));
          }

          break;
        case TYPE_SEPARATOR:
          convertView = mInflater.inflate(R.layout.fragment_subject_separator, null);
          holder.separatorView = (TextView) convertView.findViewById(R.id.text_subject_separator);
          break;
      }
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    if (type == TYPE_ITEM) {
      final Events item = mData.get(position);

      if (item != null) {
        if (selection == item.getId()) {
          convertView.setBackgroundResource(R.drawable.abs__list_activated_holo);
          int padding = context.getResources().getDimensionPixelSize(R.dimen.default_list_padding);
          convertView.setPadding(padding, padding, padding, padding);
        } else {
          convertView.setBackgroundResource(android.R.color.transparent);
        }

        try {
          holder.titleView.setText(item.getSubjects().getTitle());
        } catch (Exception e) {
          Log.e(TAG, item.getSubjectId() + " " + item.getSubjects());
          HashMap<String, String> extraData = new HashMap<String, String>();
          extraData.put("subjectsid", String.valueOf(item.getSubjectId()));
          extraData.put("subjects", String.valueOf(item.getSubjects()));

          BugSenseHandler.sendExceptionMap(extraData, e);
        }

        holder.roomView.setText(item.getRoom());
        holder.dateView.setText(df.format(item.getStart()) + " - " + df.format(item.getEnd()));
      }

    } else {
      try {
        Calendar nextSeperatorDate = Calendar.getInstance();
        nextSeperatorDate.setTime(fullDateFormat.parse(getSeperatorItem(position)));

        long dateDiff = daysDiff(Calendar.getInstance(), nextSeperatorDate);

        if (dateDiff == 0) {
          holder.separatorView.setText(context.getString(R.string.text_today));
        } else if (dateDiff == 1) {
          holder.separatorView.setText(context.getString(R.string.text_tomorrow));
        } else if (dateDiff == -1) {
          holder.separatorView.setText(context.getString(R.string.text_yesterday));
        } else if (dateDiff == -2) {
          holder.separatorView.setText(context.getString(R.string.text_twoago));
        } else {
          holder.separatorView.setText(getSeperatorItem(position));
        }
      } catch (Exception e) {
        holder.separatorView.setText(getSeperatorItem(position));
        BugSenseHandler.sendException(e);
      }
    }
    return convertView;
  }