Home | History | Annotate | Download | only in phone
      1 /*
      2  * Copyright (C) 2012 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.content.Context;
     20 import android.util.AttributeSet;
     21 import android.view.LayoutInflater;
     22 import android.view.View;
     23 import android.widget.FrameLayout;
     24 
     25 /**
     26  *
     27  */
     28 class QuickSettingsTileView extends FrameLayout {
     29 
     30     private int mColSpan;
     31     private int mRowSpan;
     32 
     33     public QuickSettingsTileView(Context context, AttributeSet attrs) {
     34         super(context, attrs);
     35 
     36         mColSpan = 1;
     37         mRowSpan = 1;
     38     }
     39 
     40     void setColumnSpan(int span) {
     41         mColSpan = span;
     42     }
     43 
     44     int getColumnSpan() {
     45         return mColSpan;
     46     }
     47 
     48     void setContent(int layoutId, LayoutInflater inflater) {
     49         inflater.inflate(layoutId, this);
     50     }
     51 
     52     @Override
     53     public void setVisibility(int vis) {
     54         if (QuickSettings.DEBUG_GONE_TILES) {
     55             if (vis == View.GONE) {
     56                 vis = View.VISIBLE;
     57                 setAlpha(0.25f);
     58                 setEnabled(false);
     59             } else {
     60                 setAlpha(1f);
     61                 setEnabled(true);
     62             }
     63         }
     64         super.setVisibility(vis);
     65     }
     66 }