Home | History | Annotate | Download | only in statusbar
      1 /*
      2  * Copyright (C) 2013 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;
     18 
     19 import android.content.Context;
     20 import android.util.AttributeSet;
     21 import android.view.ViewGroup;
     22 import android.widget.FrameLayout;
     23 
     24 public class ExpandableNotificationRow extends FrameLayout {
     25     private int mRowHeight;
     26 
     27     /** does this row contain layouts that can adapt to row expansion */
     28     private boolean mExpandable;
     29     /** has the user manually expanded this row */
     30     private boolean mUserExpanded;
     31     /** is the user touching this row */
     32     private boolean mUserLocked;
     33 
     34     public ExpandableNotificationRow(Context context, AttributeSet attrs) {
     35         super(context, attrs);
     36     }
     37 
     38     public int getRowHeight() {
     39         return mRowHeight;
     40     }
     41 
     42     public void setRowHeight(int rowHeight) {
     43         this.mRowHeight = rowHeight;
     44     }
     45 
     46     public boolean isExpandable() {
     47         return mExpandable;
     48     }
     49 
     50     public void setExpandable(boolean expandable) {
     51         mExpandable = expandable;
     52     }
     53 
     54     public boolean isUserExpanded() {
     55         return mUserExpanded;
     56     }
     57 
     58     public void setUserExpanded(boolean userExpanded) {
     59         mUserExpanded = userExpanded;
     60     }
     61 
     62     public boolean isUserLocked() {
     63         return mUserLocked;
     64     }
     65 
     66     public void setUserLocked(boolean userLocked) {
     67         mUserLocked = userLocked;
     68     }
     69 
     70     public void setExpanded(boolean expand) {
     71         ViewGroup.LayoutParams lp = getLayoutParams();
     72         if (expand && mExpandable) {
     73             lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
     74         } else {
     75             lp.height = mRowHeight;
     76         }
     77         setLayoutParams(lp);
     78     }
     79 }
     80