private void deleteGesture(NamedGesture gesture) {
    sStore.removeGesture(gesture.name, gesture.gesture);
    sStore.save();

    final GesturesAdapter adapter = mAdapter;
    adapter.setNotifyOnChange(false);
    adapter.remove(gesture);
    adapter.sort(mSorter);
    checkForEmpty();
    adapter.notifyDataSetChanged();

    Toast.makeText(this, R.string.gestures_delete_success, Toast.LENGTH_SHORT).show();
  }
    @Override
    protected void onProgressUpdate(NamedGesture... values) {
      super.onProgressUpdate(values);

      final GesturesAdapter adapter = mAdapter;
      adapter.setNotifyOnChange(false);

      for (NamedGesture gesture : values) {
        adapter.add(gesture);
      }

      adapter.sort(mSorter);
      adapter.notifyDataSetChanged();
    }
  private void changeGestureName() {
    final String name = mInput.getText().toString();
    if (!TextUtils.isEmpty(name)) {
      final NamedGesture renameGesture = mCurrentRenameGesture;
      final GesturesAdapter adapter = mAdapter;
      final int count = adapter.getCount();

      // Simple linear search, there should not be enough items to warrant
      // a more sophisticated search
      for (int i = 0; i < count; i++) {
        final NamedGesture gesture = adapter.getItem(i);
        if (gesture.gesture.getID() == renameGesture.gesture.getID()) {
          sStore.removeGesture(gesture.name, gesture.gesture);
          gesture.name = mInput.getText().toString();
          sStore.addGesture(gesture.name, gesture.gesture);
          break;
        }
      }

      adapter.notifyDataSetChanged();
    }
    mCurrentRenameGesture = null;
  }