BiDiTestActivity.java revision 26e432d25f2ba199ae8b762fc68da8463389dd9b
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.bidi;
18
19import android.app.TabActivity;
20import android.content.Intent;
21import android.os.Bundle;
22import android.widget.TabHost;
23
24public class BiDiTestActivity extends TabActivity {
25
26    @Override
27    protected void onCreate(Bundle savedInstanceState) {
28        super.onCreate(savedInstanceState);
29
30        setContentView(R.layout.main);
31
32        TabHost tabHost = getTabHost();
33        TabHost.TabSpec spec;
34        Intent intent;
35
36        // Create an Intent to launch an Activity for the tab (to be reused)
37        intent = new Intent().setClass(this, BiDiTestBasicActivity.class);
38
39        // Initialize a TabSpec for each tab and add it to the TabHost
40        spec = tabHost.newTabSpec("basic").setIndicator("Basic").
41            setContent(intent);
42        tabHost.addTab(spec);
43
44        // Do the same for the other tabs
45        intent = new Intent().setClass(this, BiDiTestCanvasActivity.class);
46        spec = tabHost.newTabSpec("canvas").setIndicator("Canvas").
47            setContent(intent);
48        tabHost.addTab(spec);
49
50        intent = new Intent().setClass(this, BiDiTestLinearLayoutLtrActivity.class);
51        spec = tabHost.newTabSpec("linear-layout-ltr").setIndicator("Linear LTR").
52            setContent(intent);
53        tabHost.addTab(spec);
54
55        intent = new Intent().setClass(this, BiDiTestLinearLayoutRtlActivity.class);
56        spec = tabHost.newTabSpec("linear-layout-rtl").setIndicator("Linear RTL").
57            setContent(intent);
58        tabHost.addTab(spec);
59
60        intent = new Intent().setClass(this, BiDiTestLinearLayoutLocaleActivity.class);
61        spec = tabHost.newTabSpec("linear-layout-locale").setIndicator("Linear LOC").
62            setContent(intent);
63        tabHost.addTab(spec);
64
65        intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class);
66        spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR").
67            setContent(intent);
68        tabHost.addTab(spec);
69
70        intent = new Intent().setClass(this, BiDiTestFrameLayoutRtlActivity.class);
71        spec = tabHost.newTabSpec("frame-layout-rtl").setIndicator("Frame RTL").
72            setContent(intent);
73        tabHost.addTab(spec);
74
75        intent = new Intent().setClass(this, BiDiTestFrameLayoutLocaleActivity.class);
76        spec = tabHost.newTabSpec("frame-layout-locale").setIndicator("Frame LOC").
77            setContent(intent);
78        tabHost.addTab(spec);
79
80        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class);
81        spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR").
82            setContent(intent);
83        tabHost.addTab(spec);
84
85        intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity.class);
86        spec = tabHost.newTabSpec("relative-layout-rtl").setIndicator("Relative RTL").
87            setContent(intent);
88        tabHost.addTab(spec);
89
90        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity2.class);
91        spec = tabHost.newTabSpec("relative-layout-ltr-2").setIndicator("Relative2 LTR").
92            setContent(intent);
93        tabHost.addTab(spec);
94
95        intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity2.class);
96        spec = tabHost.newTabSpec("relative-layout-rtl-2").setIndicator("Relative2 RTL").
97            setContent(intent);
98        tabHost.addTab(spec);
99
100        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLocaleActivity2.class);
101        spec = tabHost.newTabSpec("relative-layout-locale-2").setIndicator("Relative2 LOC").
102            setContent(intent);
103        tabHost.addTab(spec);
104
105        intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class);
106        spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR").
107            setContent(intent);
108        tabHost.addTab(spec);
109
110        intent = new Intent().setClass(this, BiDiTestTableLayoutRtlActivity.class);
111        spec = tabHost.newTabSpec("table-layout-rtl").setIndicator("Table RTL").
112            setContent(intent);
113        tabHost.addTab(spec);
114
115        intent = new Intent().setClass(this, BiDiTestTableLayoutLocaleActivity.class);
116        spec = tabHost.newTabSpec("table-layout-locale").setIndicator("Table LOC").
117            setContent(intent);
118        tabHost.addTab(spec);
119
120        tabHost.setCurrentTab(0);
121    }
122}