@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_set_list, container, false);
    mExerciseId = getArguments().getLong(SetListFragment.ARG_EXERCISE_ID);

    DatabaseHandler db = new DatabaseHandler(getActivity());
    mSets = db.getAllSetsExercise(mExerciseId);
    Collections.sort(mSets, new Set.SetComparator());
    DynamicListView dynamicListView =
        (DynamicListView) rootView.findViewById(R.id.dynamic_list_view);
    dynamicListView.enableDragAndDrop();
    dynamicListView.setDraggableManager(new TouchViewDraggableManager(R.id.grip_view));
    mAdapter = new DynamicListAdapter(getActivity(), R.layout.fragment_set_list_item, mSets, this);
    dynamicListView.setAdapter(mAdapter);
    // dynamicListView.setOnItemMovedListener(new DynamicListViewOnItemMovedListener(mAdapter));
    dynamicListView.setOnItemClickListener(
        new DynamicListViewOnItemClickListener(dynamicListView, mExerciseId, mAdapter));

    return rootView;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    initializeInjector();
    View viewRoot = inflater.inflate(R.layout.fragment_all_events, null);
    ButterKnife.inject(this, viewRoot);
    final EventCollection eventCollection =
        (EventCollection) getArguments().getSerializable(KEY_EVENT);
    final List<Event> eventList = eventCollection.getCollection();
    final ListEventsAdapter adapter =
        new ListEventsAdapter(eventList, activity.getApplicationContext());
    AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(adapter);
    animationAdapter.setAbsListView(listAllEvents);
    listAllEvents.setAdapter(animationAdapter);
    listAllEvents.setAdapter(adapter);

    listAllEvents.enableSwipeToDismiss(
        new OnDismissCallback() {
          @Override
          public void onDismiss(@NonNull ViewGroup viewGroup, @NonNull int[] ints) {
            for (final int pos : ints) {
              eventDataSource.deleteEvent(
                  eventList.get(pos).getId(),
                  new EventCallbackBase() {
                    @Override
                    public void onSuccess() {
                      activity.runOnUiThread(
                          new Runnable() {
                            @Override
                            public void run() {
                              Toast.makeText(
                                      activity.getApplicationContext(),
                                      "Removed",
                                      Toast.LENGTH_SHORT)
                                  .show();
                              eventList.remove(pos);
                              adapter.notifyDataSetChanged();
                            }
                          });
                    }

                    @Override
                    public void onError() {}
                  });
            }
          }
        });

    listAllEvents.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            eventDataSource.getEvent(
                eventCollection.get(position),
                new AnEventCacheCallback() {
                  @Override
                  public void onSuccess(final Event event) {
                    Intent i =
                        new Intent(activity.getApplicationContext(), GenerateTeamActivity.class);
                    i.putExtra(KEY_EVENT, event);
                    startActivity(i);
                  }

                  @Override
                  public void onError() {
                    Toast.makeText(activity.getApplicationContext(), KEY_ERROR, Toast.LENGTH_SHORT)
                        .show();
                  }
                });
          }
        });

    return viewRoot;
  }