private void restrictDamagesListHeight() {
    if (adapter.getCount() < 5) {
      View item = adapter.getView(0, null, damagesListView);
      item.measure(0, 0);
      LinearLayout.LayoutParams params =
          new LinearLayout.LayoutParams(
              getResources().getDimensionPixelSize(R.dimen.component_standard_size),
              (int) (5.5 * item.getMeasuredHeight()));
      damagesListView.setLayoutParams(params);
    }
    if (adapter.getCount() >= 5) { // show no more than 8 damages, and not less than 5

      int showNb = Math.min(adapter.getCount(), 5);

      View item = adapter.getView(0, null, damagesListView);
      item.measure(0, 0);
      LinearLayout.LayoutParams params =
          new LinearLayout.LayoutParams(
              getResources().getDimensionPixelSize(R.dimen.component_standard_size),
              (int) ((showNb + 0.5) * item.getMeasuredHeight()));
      damagesListView.setLayoutParams(params);
    }
    damagesListView.requestLayout();
    damagesListView.getParent().requestLayout();
  }
  /** on click on a damage value in listview */
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final SelectableDamageValue item = (SelectableDamageValue) parent.getItemAtPosition(position);
    if (!item.isChecked()) {
      item.setChecked(true);
      int offsetDamage = (position) - lastDamageValueSelected;
      lastDamageValueSelected = position;
      grid.applyFakeDamages(offsetDamage);
    }

    for (int i = 0; i < adapter.getCount(); i++) {
      if (i != position) {
        adapter.getItem(i).setChecked(false);
      }
    }

    adapter.notifyDataSetChanged();
  }