2014-11-18 3 views
0

맞춤 애니메이션 라이브러리를 사용하고 있습니다. 이 (sqlite가에서도) 목록보기에서 행을 삭제에 관해서애니메이션이 완료 될 때까지 기다렸다가 코드를 실행하십시오.

는 zoomin 애니메이션 항목이 zoomout 애니메이션없이 삭제됩니다, 잘

YoYo.with(Techniques.ZoomIn).duration(700).playOn(retView); 

하지만 작동합니다. 삭제 코드를 제거하면 축소 애니메이션이 표시됩니다.

public void onClick(View v) { 
     Log.d("HirakDebug", "tCA delete button pressed"); 
     String row = row_id; 
     YoYo.with(Techniques.ZoomOut).duration(700).playOn(retView); 
     taskslist.closeAnimate(pos); 
     tasksDatabaseOperations.deleteItemWithTask(row_id); 
     adapter.notifyDataSetChanged(); 
     cursor.requery(); 
    } 

어떻게하면 첫 번째 애니메이션이 완료되고 삭제 될 수 있습니까?

답변

2
 
You could try the follow, calling the delete methods after the animation has ended. 

    YoYo.with(Techniques.ZoomOut) 
    .withListener(new Animator.AnimatorListener() { 
    @Override 
     public void onAnimationStart(Animator animation) { 

     } 
     @Override 
     public void onAnimationEnd(Animator animation) { 
     tasksDatabaseOperations.deleteItemWithTask(row_id); 
     adapter.notifyDataSetChanged(); 
     cursor.requery(); 
     } 
     @Override 
     public void onAnimationCancel(Animator animation) { 

     } 
     @Override 
     public void onAnimationRepeat(Animator animation) { 

     } 
     }) 
    .duration(700) 
    .playOn(retView); 

관련 문제