Home | History | Annotate | Download | only in stack
      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.view.View;
     20 
     21 /**
     22  * A state of a view. This can be used to apply a set of view properties to a view with
     23  * {@link com.android.systemui.statusbar.stack.StackScrollState} or start animations with
     24  * {@link com.android.systemui.statusbar.stack.StackStateAnimator}.
     25 */
     26 public class ViewState {
     27 
     28     public float alpha;
     29     public float yTranslation;
     30     public float zTranslation;
     31     public boolean gone;
     32     public boolean hidden;
     33 
     34     public void copyFrom(ViewState viewState) {
     35         alpha = viewState.alpha;
     36         yTranslation = viewState.yTranslation;
     37         zTranslation = viewState.zTranslation;
     38         gone = viewState.gone;
     39         hidden = viewState.hidden;
     40     }
     41 
     42     public void initFrom(View view) {
     43         alpha = view.getAlpha();
     44         yTranslation = view.getTranslationY();
     45         zTranslation = view.getTranslationZ();
     46         gone = view.getVisibility() == View.GONE;
     47         hidden = false;
     48     }
     49 }
     50