Home | History | Annotate | Download | only in impl
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.layoutlib.bridge.impl;
     18 
     19 import com.android.ide.common.rendering.api.IAnimationListener;
     20 import com.android.ide.common.rendering.api.Result;
     21 import com.android.ide.common.rendering.api.Result.Status;
     22 
     23 import android.animation.AnimationThread;
     24 import android.animation.Animator;
     25 
     26 public class PlayAnimationThread extends AnimationThread {
     27 
     28     private final Animator mAnimator;
     29 
     30     public PlayAnimationThread(Animator animator, RenderSessionImpl scene, String animName,
     31             IAnimationListener listener) {
     32         super(scene, animName, listener);
     33         mAnimator = animator;
     34     }
     35 
     36     @Override
     37     public Result preAnimation() {
     38         // start the animation. This will send a message to the handler right away, so
     39         // the queue is filled when this method returns.
     40         mAnimator.start();
     41 
     42         return Status.SUCCESS.createResult();
     43     }
     44 
     45     @Override
     46     public void postAnimation() {
     47         // nothing to be done.
     48     }
     49 }
     50