1282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/*
2282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Copyright (C) 2011 The Android Open Source Project
3282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
4282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License");
5282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * you may not use this file except in compliance with the License.
6282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * You may obtain a copy of the License at
7282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
8282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *      http://www.apache.org/licenses/LICENSE-2.0
9282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
10282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Unless required by applicable law or agreed to in writing, software
11282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS,
12282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * See the License for the specific language governing permissions and
14282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * limitations under the License.
15282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
16282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
17282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipackage com.android.layoutlib.bridge.bars;
18282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
1958ca246c834d7ab45939367367a5932d8e348f41Deepanshu Guptaimport com.android.layoutlib.bridge.android.BridgeContext;
2058ca246c834d7ab45939367367a5932d8e348f41Deepanshu Gupta
21282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport org.xmlpull.v1.XmlPullParserException;
22282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
23282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport android.widget.LinearLayout;
24282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport android.widget.TextView;
25282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
26282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipublic class TitleBar extends CustomBar {
27282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
28282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    private TextView mTextView;
29282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
30b1484862e2367d87d3ccbd0fd0a6d2598ed5918aDeepanshu Gupta    public TitleBar(BridgeContext context, String label, int simulatedPlatformVersion) {
3142c7ce02f4023c94b315253754a20c20800be731Deepanshu Gupta        super(context, LinearLayout.HORIZONTAL, "/bars/title_bar.xml", "title_bar.xml",
3242c7ce02f4023c94b315253754a20c20800be731Deepanshu Gupta                simulatedPlatformVersion);
33282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
34282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // Cannot access the inside items through id because no R.id values have been
35282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // created for them.
36282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // We do know the order though.
37553a4e91385111f20ddf426f81b3193b9e951762Deepanshu Gupta        mTextView = setText(0, label, true);
38282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
39282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        setStyle("windowTitleBackgroundStyle");
40282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
41282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
42282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @Override
43282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    protected TextView getStyleableTextView() {
44282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return mTextView;
45282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
46282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski}
47