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.resources.Density;
20import com.android.layoutlib.bridge.Bridge;
21
22import org.xmlpull.v1.XmlPullParserException;
23
24import android.content.Context;
25import android.widget.LinearLayout;
26import android.widget.TextView;
27
28public class NavigationBar extends CustomBar {
29
30    public NavigationBar(Context context, Density density, int orientation, boolean isRtl,
31            boolean rtlEnabled) throws XmlPullParserException {
32        super(context, density, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml");
33
34        setBackgroundColor(0xFF000000);
35
36        // Cannot access the inside items through id because no R.id values have been
37        // created for them.
38        // We do know the order though.
39        // 0 is a spacer.
40        int back = 1;
41        int recent = 3;
42        if (orientation == LinearLayout.VERTICAL || (isRtl && !rtlEnabled)) {
43            // If RTL is enabled, then layoutlib mirrors the layout for us.
44            back = 3;
45            recent = 1;
46        }
47
48        loadIcon(back,   "ic_sysbar_back.png",   density, isRtl);
49        loadIcon(2,      "ic_sysbar_home.png",   density, isRtl);
50        loadIcon(recent, "ic_sysbar_recent.png", density, isRtl);
51    }
52
53    @Override
54    protected TextView getStyleableTextView() {
55        return null;
56    }
57}
58