Home | History | Annotate | Download | only in phone
      1 /*
      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  */
     16 
     17 package com.android.systemui.statusbar.phone;
     18 
     19 import android.view.animation.Interpolator;
     20 
     21 /**
     22  * An implementation of a bouncer interpolator optimized for unlock hinting.
     23  */
     24 public class BounceInterpolator implements Interpolator {
     25 
     26     private final static float SCALE_FACTOR = 7.5625f;
     27 
     28     @Override
     29     public float getInterpolation(float t) {
     30         t *= 11f / 10f;
     31         if (t < 4f / 11f) {
     32             return SCALE_FACTOR * t * t;
     33         } else if (t < 8f / 11f) {
     34             float t2 = t - 6f / 11f;
     35             return SCALE_FACTOR * t2 * t2 + 3f / 4f;
     36         } else if (t < 10f / 11f) {
     37             float t2 = t - 9f / 11f;
     38             return SCALE_FACTOR * t2 * t2 + 15f / 16f;
     39         } else {
     40             return 1;
     41         }
     42     }
     43 }
     44