1 /* 2 * Copyright (C) 2015 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 package android.transition.cts; 17 18 import android.transition.Transition; 19 import android.transition.Transition.TransitionListener; 20 21 /** 22 * Listener captures whether each of the methods is called. 23 */ 24 class SimpleTransitionListener implements TransitionListener { 25 public Transition transition; 26 27 public boolean started; 28 29 public boolean ended; 30 31 public boolean canceled; 32 33 public boolean paused; 34 35 public boolean resumed; 36 37 @Override onTransitionStart(Transition transition)38 public synchronized void onTransitionStart(Transition transition) { 39 started = true; 40 this.transition = transition; 41 notifyAll(); 42 } 43 44 @Override onTransitionEnd(Transition transition)45 public synchronized void onTransitionEnd(Transition transition) { 46 ended = true; 47 notifyAll(); 48 } 49 50 @Override onTransitionCancel(Transition transition)51 public synchronized void onTransitionCancel(Transition transition) { 52 canceled = true; 53 notifyAll(); 54 } 55 56 @Override onTransitionPause(Transition transition)57 public synchronized void onTransitionPause(Transition transition) { 58 paused = true; 59 notifyAll(); 60 } 61 62 @Override onTransitionResume(Transition transition)63 public synchronized void onTransitionResume(Transition transition) { 64 resumed = true; 65 notifyAll(); 66 } 67 } 68