private void manipulatePending() {

    if (!pendingManipulationsWithoutAnimation.isEmpty()) {
      animating = true;
      for (final Manipulator manipulator : pendingManipulationsWithoutAnimation) {
        manipulator.manipulate(adapter.adapter);
      }
      pendingManipulationsWithoutAnimation.clear();
      adapter.notifyDataSetChanged();

      post(
          new Runnable() {

            @Override
            public void run() {
              animating = false;
              manipulatePending();
            }
          });
    } else {

      if (pendingManipulations.isEmpty()) {
        return;
      }

      prepareAnimation();

      for (final Manipulator manipulator : pendingManipulations) {
        manipulator.manipulate(adapter.adapter);
      }
      pendingManipulations.clear();

      doAnimation();
    }
  }
 public <T extends ListAdapter> void manipulateWithoutAnimation(final Manipulator<T> manipulator) {
   if (!animating) {
     manipulator.manipulate((T) adapter.adapter);
     adapter.notifyDataSetChanged();
   } else {
     pendingManipulationsWithoutAnimation.add(manipulator);
   }
 }
  public <T extends ListAdapter> void manipulate(final Manipulator<T> manipulator) {
    if (!animating) {
      prepareAnimation();

      manipulator.manipulate((T) adapter.adapter);

      doAnimation();
    } else {
      pendingManipulations.add(manipulator);
    }
  }
예제 #4
0
 public static void main(String[] args) {
   HasF hf = new HasF();
   Manipulator<HasF> manipulator = new Manipulator<HasF>(hf);
   manipulator.manipulate();
 }