1/*
2 * Copyright (C) 2017 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
17package android.support.transition;
18
19import android.animation.Animator;
20import android.graphics.Matrix;
21import android.os.Build;
22import android.widget.ImageView;
23
24class ImageViewUtils {
25
26    private static final ImageViewUtilsImpl IMPL;
27
28    static {
29        if (Build.VERSION.SDK_INT >= 21) {
30            IMPL = new ImageViewUtilsApi21();
31        } else {
32            IMPL = new ImageViewUtilsApi14();
33        }
34    }
35
36    /**
37     * Starts animating the transformation of the image view. This has to be called before calling
38     * {@link #animateTransform(ImageView, Matrix)}.
39     */
40    static void startAnimateTransform(ImageView view) {
41        IMPL.startAnimateTransform(view);
42    }
43
44    /**
45     * Sets the matrix to animate the content of the image view.
46     */
47    static void animateTransform(ImageView view, Matrix matrix) {
48        IMPL.animateTransform(view, matrix);
49    }
50
51    /**
52     * Reserves that the caller will stop calling {@link #animateTransform(ImageView, Matrix)} when
53     * the specified animator ends.
54     */
55    static void reserveEndAnimateTransform(ImageView view, Animator animator) {
56        IMPL.reserveEndAnimateTransform(view, animator);
57    }
58
59}
60