Home | History | Annotate | Download | only in bars
      1 /*
      2  * Copyright (C) 2011 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.layoutlib.bridge.bars;
     18 
     19 import com.android.resources.Density;
     20 import com.android.resources.ResourceType;
     21 
     22 import org.xmlpull.v1.XmlPullParserException;
     23 
     24 import android.content.Context;
     25 import android.graphics.drawable.Drawable;
     26 import android.graphics.drawable.LevelListDrawable;
     27 import android.view.Gravity;
     28 import android.widget.TextView;
     29 
     30 public class PhoneSystemBar extends CustomBar {
     31 
     32     public PhoneSystemBar(Context context, Density density) throws XmlPullParserException {
     33         super(context, density, "/bars/phone_system_bar.xml", "phone_system_bar.xml");
     34 
     35         // FIXME: use FILL_H?
     36         setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
     37         setBackgroundColor(0xFF000000);
     38 
     39         // Cannot access the inside items through id because no R.id values have been
     40         // created for them.
     41         // We do know the order though.
     42         // 0 is the spacer
     43         loadIcon(1, "stat_sys_wifi_signal_4_fully.png", density);
     44         Drawable drawable = loadIcon(2, ResourceType.DRAWABLE, "stat_sys_battery_charge");
     45         if (drawable instanceof LevelListDrawable) {
     46             ((LevelListDrawable) drawable).setLevel(100);
     47         }
     48     }
     49 
     50     @Override
     51     protected TextView getStyleableTextView() {
     52         return null;
     53     }
     54 }
     55