1684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek/*
2684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * Copyright (C) 2015 The Android Open Source Project
3684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek *
4684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * Licensed under the Apache License, Version 2.0 (the "License");
5684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * you may not use this file except in compliance with the License.
6684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * You may obtain a copy of the License at
7684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek *
8684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek *      http://www.apache.org/licenses/LICENSE-2.0
9684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek *
10684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * Unless required by applicable law or agreed to in writing, software
11684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * distributed under the License is distributed on an "AS IS" BASIS,
12684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * See the License for the specific language governing permissions and
14684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * limitations under the License
15684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek */
16684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek
17684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinekpackage com.android.systemui.statusbar.stack;
18684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek
19684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinekimport android.graphics.Path;
20684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinekimport android.view.animation.PathInterpolator;
21684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek
22684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek/**
23684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek * An interpolator specifically designed for the appear animation of heads up notifications.
24684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek */
25684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinekpublic class HeadsUpAppearInterpolator extends PathInterpolator {
26684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek    public HeadsUpAppearInterpolator() {
27684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        super(getAppearPath());
28684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek    }
29684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek
30684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek    private static Path getAppearPath() {
31684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        Path path = new Path();
32684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        path.moveTo(0, 0);
33684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float x1 = 250f;
34684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float x2 = 150f;
35684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float x3 = 100f;
36684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float y1 = 90f;
37684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float y2 = 78f;
38684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float y3 = 80f;
39684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        float xTot = (x1 + x2 + x3);
40684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        path.cubicTo(x1 * 0.9f / xTot, 0f,
41684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                x1 * 0.8f / xTot, y1 / y3,
42684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                x1 / xTot , y1 / y3);
43684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        path.cubicTo((x1 + x2 * 0.4f) / xTot, y1 / y3,
44684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                (x1 + x2 * 0.2f) / xTot, y2 / y3,
45684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                (x1 + x2) / xTot, y2 / y3);
46684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        path.cubicTo((x1 + x2 + x3 * 0.4f) / xTot, y2 / y3,
47684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                (x1 + x2 + x3 * 0.2f) / xTot, 1f,
48684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek                1f, 1f);
49684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek        return path;
50684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek    }
51684a442b812a5e95d813700ffa2fd17ca72048a7Selim Cinek}
52