1 /*
2  * Copyright (C) 2015 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 
17 package com.android.systemui.statusbar.stack;
18 
19 import android.graphics.Path;
20 import android.view.animation.PathInterpolator;
21 
22 /**
23  * An interpolator specifically designed for the appear animation of heads up notifications.
24  */
25 public class HeadsUpAppearInterpolator extends PathInterpolator {
HeadsUpAppearInterpolator()26     public HeadsUpAppearInterpolator() {
27         super(getAppearPath());
28     }
29 
getAppearPath()30     private static Path getAppearPath() {
31         Path path = new Path();
32         path.moveTo(0, 0);
33         float x1 = 250f;
34         float x2 = 150f;
35         float x3 = 100f;
36         float y1 = 90f;
37         float y2 = 78f;
38         float y3 = 80f;
39         float xTot = (x1 + x2 + x3);
40         path.cubicTo(x1 * 0.9f / xTot, 0f,
41                 x1 * 0.8f / xTot, y1 / y3,
42                 x1 / xTot , y1 / y3);
43         path.cubicTo((x1 + x2 * 0.4f) / xTot, y1 / y3,
44                 (x1 + x2 * 0.2f) / xTot, y2 / y3,
45                 (x1 + x2) / xTot, y2 / y3);
46         path.cubicTo((x1 + x2 + x3 * 0.4f) / xTot, y2 / y3,
47                 (x1 + x2 + x3 * 0.2f) / xTot, 1f,
48                 1f, 1f);
49         return path;
50     }
51 }
52