ChangeBounds.java revision cbba0a52f7d7b593dbb13a138515f066f75cce80
1/*
2 * Copyright (C) 2016 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.os.Build;
21import android.support.annotation.NonNull;
22import android.support.annotation.Nullable;
23import android.view.ViewGroup;
24
25/**
26 * This transition captures the layout bounds of target views before and after
27 * the scene change and animates those changes during the transition.
28 *
29 * <p>Unlike the platform version, this does not support use in XML resources.</p>
30 */
31public class ChangeBounds extends Transition {
32
33    public ChangeBounds() {
34        super(true);
35        if (Build.VERSION.SDK_INT < 19) {
36            mImpl = new ChangeBoundsIcs(this);
37        } else {
38            mImpl = new ChangeBoundsKitKat(this);
39        }
40    }
41
42    @Override
43    public void captureEndValues(@NonNull TransitionValues transitionValues) {
44        mImpl.captureEndValues(transitionValues);
45    }
46
47    @Override
48    public void captureStartValues(@NonNull TransitionValues transitionValues) {
49        mImpl.captureStartValues(transitionValues);
50    }
51
52    @Override
53    @Nullable
54    public Animator createAnimator(@NonNull ViewGroup sceneRoot,
55            @NonNull TransitionValues startValues, @NonNull TransitionValues endValues) {
56        return mImpl.createAnimator(sceneRoot, startValues, endValues);
57    }
58
59}
60