Chris Banes | 49c7890 | 2014-07-15 15:30:55 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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.support.v4.view; |
| 17 | |
| 18 | import android.animation.ValueAnimator; |
Alan Viverette | 8f886fe | 2016-10-25 18:18:53 +0100 | [diff] [blame] | 19 | import android.annotation.TargetApi; |
| 20 | import android.support.annotation.RequiresApi; |
Chris Banes | 49c7890 | 2014-07-15 15:30:55 +0100 | [diff] [blame] | 21 | import android.view.View; |
| 22 | |
Alan Viverette | 8f886fe | 2016-10-25 18:18:53 +0100 | [diff] [blame] | 23 | @RequiresApi(19) |
| 24 | @TargetApi(19) |
Chris Banes | 49c7890 | 2014-07-15 15:30:55 +0100 | [diff] [blame] | 25 | class ViewPropertyAnimatorCompatKK { |
| 26 | |
| 27 | public static void setUpdateListener(final View view, |
| 28 | final ViewPropertyAnimatorUpdateListener listener) { |
Chris Banes | 59882c8 | 2015-10-14 14:35:43 +0100 | [diff] [blame] | 29 | ValueAnimator.AnimatorUpdateListener wrapped = null; |
| 30 | if (listener != null) { |
| 31 | wrapped = new ValueAnimator.AnimatorUpdateListener() { |
| 32 | @Override |
| 33 | public void onAnimationUpdate(ValueAnimator valueAnimator) { |
| 34 | listener.onAnimationUpdate(view); |
| 35 | } |
| 36 | }; |
| 37 | } |
| 38 | view.animate().setUpdateListener(wrapped); |
Chris Banes | 49c7890 | 2014-07-15 15:30:55 +0100 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | } |