blob: f507a8958e0c0413a69c3006680126abe8bce47c [file] [log] [blame]
Chris Banes49c78902014-07-15 15:30:55 +01001/*
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 */
16package android.support.v4.view;
17
18import android.animation.ValueAnimator;
Alan Viverette8f886fe2016-10-25 18:18:53 +010019import android.annotation.TargetApi;
20import android.support.annotation.RequiresApi;
Chris Banes49c78902014-07-15 15:30:55 +010021import android.view.View;
22
Alan Viverette8f886fe2016-10-25 18:18:53 +010023@RequiresApi(19)
24@TargetApi(19)
Chris Banes49c78902014-07-15 15:30:55 +010025class ViewPropertyAnimatorCompatKK {
26
27 public static void setUpdateListener(final View view,
28 final ViewPropertyAnimatorUpdateListener listener) {
Chris Banes59882c82015-10-14 14:35:43 +010029 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 Banes49c78902014-07-15 15:30:55 +010039 }
40
41}