StatusBar.java revision 5a734548455e5bcc8a5fd6b3972017086d3c1287
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
17package com.android.layoutlib.bridge.bars;
18
19import com.android.layoutlib.bridge.impl.Config;
20import com.android.resources.Density;
21import com.android.resources.ResourceType;
22
23import org.xmlpull.v1.XmlPullParserException;
24
25import android.content.Context;
26import android.graphics.drawable.Drawable;
27import android.graphics.drawable.LevelListDrawable;
28import android.view.Gravity;
29import android.widget.LinearLayout;
30import android.widget.TextView;
31
32public class StatusBar extends CustomBar {
33
34    public StatusBar(Context context, Density density, int direction, boolean RtlEnabled,
35            int simulatePlatformVersion) throws XmlPullParserException {
36        // FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
37        super(context, density, LinearLayout.HORIZONTAL, "/bars/status_bar.xml", "status_bar.xml");
38
39        // FIXME: use FILL_H?
40        setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
41        setBackgroundColor(Config.getStatusBarColor(simulatePlatformVersion));
42
43        // Cannot access the inside items through id because no R.id values have been
44        // created for them.
45        // We do know the order though.
46        // 0 is the spacer
47        loadIcon(1, "stat_sys_wifi_signal_4_fully.png", density);
48        loadIcon(2, "stat_sys_battery_charge_anim100.png", density);
49    }
50
51    @Override
52    protected TextView getStyleableTextView() {
53        return null;
54    }
55}
56