• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.systemui.statusbar.notification;
18 
19 import android.util.Pools;
20 
21 /**
22  * A transform state of the action list
23 */
24 public class ActionListTransformState extends TransformState {
25 
26     private static Pools.SimplePool<ActionListTransformState> sInstancePool
27             = new Pools.SimplePool<>(40);
28 
29     @Override
sameAs(TransformState otherState)30     protected boolean sameAs(TransformState otherState) {
31         return otherState instanceof ActionListTransformState;
32     }
33 
obtain()34     public static ActionListTransformState obtain() {
35         ActionListTransformState instance = sInstancePool.acquire();
36         if (instance != null) {
37             return instance;
38         }
39         return new ActionListTransformState();
40     }
41 
42     @Override
transformViewFullyFrom(TransformState otherState, float transformationAmount)43     public void transformViewFullyFrom(TransformState otherState, float transformationAmount) {
44         // Don't do Y transform - let the wrapper handle this based on the content height
45     }
46 
47     @Override
transformViewFullyTo(TransformState otherState, float transformationAmount)48     public void transformViewFullyTo(TransformState otherState, float transformationAmount) {
49         // Don't do Y transform - let the wrapper handle this based on the content height
50     }
51 
52     @Override
resetTransformedView()53     protected void resetTransformedView() {
54         // We need to keep the Y transformation, because this is used to keep the action list
55         // aligned at the bottom, unrelated to transforms.
56         float y = getTransformedView().getTranslationY();
57         super.resetTransformedView();
58         getTransformedView().setTranslationY(y);
59     }
60 
61     @Override
recycle()62     public void recycle() {
63         super.recycle();
64         sInstancePool.release(this);
65     }
66 }
67