Home | History | Annotate | Download | only in keyguard
      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.keyguard;
     18 
     19 import android.content.Context;
     20 import android.view.View;
     21 import android.view.animation.AnimationUtils;
     22 import android.view.animation.Interpolator;
     23 
     24 /**
     25  * A class to make nice disappear transitions for views in a tabular layout.
     26  */
     27 public class DisappearAnimationUtils extends AppearAnimationUtils {
     28 
     29     public DisappearAnimationUtils(Context ctx) {
     30         this(ctx, DEFAULT_APPEAR_DURATION,
     31                 1.0f, 1.0f,
     32                 AnimationUtils.loadInterpolator(ctx, android.R.interpolator.linear_out_slow_in));
     33     }
     34 
     35     public DisappearAnimationUtils(Context ctx, long duration, float translationScaleFactor,
     36             float delayScaleFactor, Interpolator interpolator) {
     37         super(ctx, duration, translationScaleFactor, delayScaleFactor, interpolator);
     38         mScaleTranslationWithRow = true;
     39         mAppearing = false;
     40     }
     41 
     42     protected long calculateDelay(int row, int col) {
     43         return (long) ((row * 60 + col * (Math.pow(row, 0.4) + 0.4) * 10) * mDelayScale);
     44     }
     45 }
     46