1ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski/* 2ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * Copyright (C) 2011 The Android Open Source Project 3ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * 4ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * Licensed under the Apache License, Version 2.0 (the "License"); 5ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * you may not use this file except in compliance with the License. 6ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * You may obtain a copy of the License at 7ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * 8ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * http://www.apache.org/licenses/LICENSE-2.0 9ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * 10ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * Unless required by applicable law or agreed to in writing, software 11ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * distributed under the License is distributed on an "AS IS" BASIS, 12ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * See the License for the specific language governing permissions and 14ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski * limitations under the License. 15ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski */ 16ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 17ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinskipackage com.android.layoutlib.bridge.bars; 18ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 19e0fdd7563ba0a4d053d4a159dd02c66d811a9e32Deepanshu Guptaimport com.android.layoutlib.bridge.android.BridgeContext; 20e0fdd7563ba0a4d053d4a159dd02c66d811a9e32Deepanshu Gupta 21ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinskiimport org.xmlpull.v1.XmlPullParserException; 22ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 23ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinskiimport android.widget.LinearLayout; 24ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinskiimport android.widget.TextView; 25ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 26ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinskipublic class TitleBar extends CustomBar { 27ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 28ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski private TextView mTextView; 29ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 308b4b0ce31acc9f57c7df5b1c70183a6655c1edfbDeepanshu Gupta public TitleBar(BridgeContext context, String label, int simulatedPlatformVersion) { 31bf50447839d4cdb1765d308a67aca43bb77cedbcDeepanshu Gupta super(context, LinearLayout.HORIZONTAL, "/bars/title_bar.xml", "title_bar.xml", 32bf50447839d4cdb1765d308a67aca43bb77cedbcDeepanshu Gupta simulatedPlatformVersion); 33ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 34ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski // Cannot access the inside items through id because no R.id values have been 35ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski // created for them. 36ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski // We do know the order though. 37366fbe9dd48ae02332bc61eb4bd0b8c7c8a32a88Deepanshu Gupta mTextView = setText(0, label, true); 38ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 39ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski setStyle("windowTitleBackgroundStyle"); 40ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski } 41ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski 42ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski @Override 43ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski protected TextView getStyleableTextView() { 44ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski return mTextView; 45ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski } 46ab775ecdd189b32e35b0d3f4a821502f88b03a4bAdam Lesinski} 47