@Override
  @SuppressWarnings("deprecated")
  public View getView(final int position, View convertView, ViewGroup parent) {
    Project.Sheet sheet = (Project.Sheet) getItem(position);
    Resources res = activity.getResources();

    if (convertView == null) {
      convertView = LayoutInflater.from(activity).inflate(R.layout.sheet_list_item, parent, false);
    }

    boolean isCurrentSheet = position == project.getCurrentSheetIndex();

    final TextView sheetName = (TextView) convertView.findViewById(R.id.textview_sheet_name);
    ImageView buttonRename =
        (ImageView) convertView.findViewById(R.id.imageview_sheet_button_rename);
    ImageView buttonDelete =
        (ImageView) convertView.findViewById(R.id.imageview_sheet_button_delete);
    ImageView thumbnailView = (ImageView) convertView.findViewById(R.id.imageview_sheet_thumbnail);
    ImageView dragHandle = (ImageView) convertView.findViewById(R.id.imageview_sheet_drag_handle);

    if (AppearanceUtils.isThemeDark()) {
      convertView.setBackgroundColor(
          res.getColor(isCurrentSheet ? R.color.highlight_dark : R.color.black));
      sheetName.setTextColor(res.getColor(R.color.text_white));
    } else {
      convertView.setBackgroundColor(
          res.getColor(isCurrentSheet ? R.color.highlight : R.color.white));
      sheetName.setTextColor(
          res.getColor(isCurrentSheet ? R.color.text_white : R.color.text_black));
    }

    sheetName.setText(sheet.getName());
    sheetName.setTypeface(isCurrentSheet ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
    if (!isCurrentSheet) {
      sheetName.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              activity.changeSheet(position);
              activity.closeSheetMenu();
            }
          });
    }

    buttonRename.setImageDrawable(
        ResourcesCompat.getDrawable(
            activity, isCurrentSheet ? R.drawable.rename_box_white : R.drawable.rename_box));
    buttonRename.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.renameSheet(position, sheetName);
          }
        });

    buttonDelete.setImageDrawable(
        ResourcesCompat.getDrawable(
            activity, isCurrentSheet ? R.drawable.delete_white : R.drawable.delete));
    buttonDelete.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.deleteSheet(position);
          }
        });

    thumbnailView.setImageDrawable(sheet.getThumbnail());

    dragHandle.setImageDrawable(
        ResourcesCompat.getDrawable(
            activity, isCurrentSheet ? R.drawable.drag_vertical_white : R.drawable.drag_vertical));

    return convertView;
  }
 @Override
 public long getItemId(int position) {
   return project.getSheetAt(position).getId();
 }
 @Override
 public int getCount() {
   return project.getTotalSheets();
 }
 @Override
 public Object getItem(int position) {
   return project.getSheetAt(position);
 }
 @Override
 public void swapItems(int index1, int index2) {
   project.swapSheets(index1, index2);
   notifyDataSetChanged();
 }